Bifrost SDK
Bifrost SDK documentation
Utility.h
Go to the documentation of this file.
1//-
2// ================================================================================================
3// Copyright 2024 Autodesk, Inc. All rights reserved.
4//
5// Use of this software is subject to the terms of the Autodesk license agreement provided
6// at the time of installation or download, or which otherwise accompanies this software in
7// either electronic or hard copy form.
8// ================================================================================================
9//+
10
15
16#ifndef BIFROSTGRAPH_EXECUTOR_UTILITY_H
17#define BIFROSTGRAPH_EXECUTOR_UTILITY_H
18
19#include <BifrostGraph/Executor/internal/ExecutorExport.h>
20#include <BifrostGraph/Executor/internal/PropagateConstPtr.h>
21
24
25#include <Amino/Core/Array.h>
26#include <Amino/Core/Ptr.h>
27#include <Amino/Core/String.h>
28
29#include <cstdint>
30
31namespace Amino {
32class Type;
33class Value;
34} // namespace Amino
35
36namespace BifrostGraph {
37namespace Executor {
38namespace Utility {
39
44
50BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getTypeName(const Amino::Type& type) noexcept;
51
63BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getInnermostElementTypeName(
64 const Amino::Type& type) noexcept;
65
69BIFROSTGRAPH_EXECUTOR_SHARED_DECL bool isArrayType(const Amino::Type& type) noexcept;
70
79BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getEnv(const Amino::String& evName) noexcept;
80
92BIFROSTGRAPH_EXECUTOR_SHARED_DECL bool getEnvBool(const Amino::String& evName) noexcept;
93
111BIFROSTGRAPH_EXECUTOR_SHARED_DECL std::int32_t getEnvInt(const Amino::String& evName,
112 std::int32_t defaultValue) noexcept;
113
114// clang-format off
151// clang-format on
152class BIFROSTGRAPH_EXECUTOR_SHARED_DECL ConfigEnv final {
153protected:
161 ConfigEnv() noexcept;
162
163public:
166
168 ~ConfigEnv() noexcept;
169
174 bool isValid() const noexcept;
175
180 bool hasKey(const Amino::String& key) const noexcept;
181
188 const StringArray& values(const Amino::String& key) const noexcept;
189
190private:
191 ConfigEnv(const ConfigEnv&) = delete;
192 ConfigEnv(ConfigEnv&&) = delete;
193 ConfigEnv& operator=(const ConfigEnv&) = delete;
194 ConfigEnv& operator=(ConfigEnv&&) = delete;
195
196private:
197 class Impl;
198 BifrostGraph::Executor::Internal::PropagateConstPtr<Impl, Internal::Owned::kYes> m_impl;
199};
200
207BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getLibraryPrefix() noexcept;
208
215BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getLibraryExtension() noexcept;
216
229BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getNormalizedPath(
230 const Amino::String& path) noexcept;
231
233} // namespace Utility
234} // namespace Executor
235} // namespace BifrostGraph
236
237#endif
A resizable container of contiguous elements.
Smart pointers used to allow custom user classes (opaque classes) to be used within Amino graphs....
String class.
Provide factory functions for Executor core classes.
#define EXECUTOR_DECLARE_MAKE_OWNER_FRIENDSHIP()
Helper macro to declare friend the makeOwner<> factory functions.
Definition: Factory.h:115
BIFROSTGRAPH_EXECUTOR_SHARED_DECL bool isArrayType(const Amino::Type &type) noexcept
Check if a given type is of array kind.
BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getInnermostElementTypeName(const Amino::Type &type) noexcept
Given a type whose kind is an array, this function finds the type of the innermost element whose kind...
BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getEnv(const Amino::String &evName) noexcept
Get the value of an environment variable.
BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getLibraryPrefix() noexcept
Get the library prefix to be used on the current platform.
BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getLibraryExtension() noexcept
Get the library extension to be used on the current platform.
BIFROSTGRAPH_EXECUTOR_SHARED_DECL std::int32_t getEnvInt(const Amino::String &evName, std::int32_t defaultValue) noexcept
Get the integer value of an environment variable.
BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getNormalizedPath(const Amino::String &path) noexcept
Convert a path to a Bifrost normalized path.
BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String getTypeName(const Amino::Type &type) noexcept
Return the fully qualified name of a given type. An empty string is returned to indicate any encounte...
BIFROSTGRAPH_EXECUTOR_SHARED_DECL bool getEnvBool(const Amino::String &evName) noexcept
Get the boolean value of an environment variable.
Definition: HostData.h:33
Define a Amino array of elements of type T.
Definition: Array.h:105
The string class used by Amino.
Definition: String.h:46
ConfigEnv represents a map containing (key, values) pairs describing the current Bifrost configuratio...
Definition: Utility.h:152
BifrostGraph Executor common types.