BifrostGraph Executor utility functions and helpers.
More...
BifrostGraph Executor utility functions and helpers.
◆ getEnv()
Get the value of an environment variable.
- Note
- This function is thread-safe as long as the host environment is not modified by another function (like std::setenv, std::unsetenv or std::putenv).
- Parameters
-
| [in] | evName | The name of the environment variable. |
- Returns
- An empty string if the environment variable is unset; the value of the environment variable otherwise.
◆ getEnvBool()
| BIFROSTGRAPH_EXECUTOR_SHARED_DECL bool BifrostGraph::Executor::Utility::getEnvBool |
( |
const Amino::String & |
evName | ) |
|
|
noexcept |
Get the boolean value of an environment variable.
If the environment variable is unset, false is returned. If the environment variable is set, then the leading and trailing whitespaces from its value are first discarded, then if the result is "0", false is returned, otherwise true is returned.
- Note
- This function is thread-safe as long as the host environment is not modified by another function (like std::setenv, std::unsetenv or std::putenv).
- Parameters
-
| [in] | evName | The name of the environment variable. |
- Returns
- false if the environment variable is "0" or unset; true otherwise.
◆ getEnvInt()
| BIFROSTGRAPH_EXECUTOR_SHARED_DECL std::int32_t BifrostGraph::Executor::Utility::getEnvInt |
( |
const Amino::String & |
evName, |
|
|
std::int32_t |
defaultValue |
|
) |
| |
|
noexcept |
Get the integer value of an environment variable.
If the environment variable is unset then defaultValue is returned. If the environment variable is set but its value cannot be converted to an int32 (if its value does not represent an integer, or if its value is too big or too small to fit in an int32, or if the conversion would have left some trailing characters that would not have been interpreted), then defaultValue is returned. Otherwise, the integer value of the environment variable is returned.
- Note
- This function is thread-safe as long as the host environment is not modified by another function (like std::setenv, std::unsetenv or std::putenv).
- Parameters
-
| [in] | evName | The name of the environment variable. |
| [in] | defaultValue | The default value to use if the environment variable evName is unset or if an error is detected when attempting to convert its value to an int32. |
- Returns
defaultValue if the environment variable is unset or if its value cannot be converted to an int32; the integer value of the environment variable otherwise.
◆ getInnermostElementTypeName()
| BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String BifrostGraph::Executor::Utility::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 is not an array, and it returns its fully qualified name. For example, if the given type is an array of arrays of floats, then "float" is returned. Given a type whose kind is not an array, this function returns its fully qualified name.
- Parameters
-
| [in] | type | The array type whose innermost element's type is queried. |
- Returns
- The fully qualified name of the innermost element type of a given array type, or the fully qualified name of a given type that is not an array type. If the given type or any encountered type during traversal is invalid, an empty string is returned.
◆ getLibraryExtension()
| BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String BifrostGraph::Executor::Utility::getLibraryExtension |
( |
| ) |
|
|
noexcept |
Get the library extension to be used on the current platform.
On windows, the library extension is ".dll", on Linux it is ".so" and on OSX the extension ".dylib" is used.
- Returns
- The library extension to be used on the current platform.
◆ getLibraryPrefix()
| BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String BifrostGraph::Executor::Utility::getLibraryPrefix |
( |
| ) |
|
|
noexcept |
Get the library prefix to be used on the current platform.
On windows, the library prefix is just an empty string, while on OSX and Linux the prefix "lib" is used.
- Returns
- The library prefix to be used on the current platform.
◆ getNormalizedPath()
Convert a path to a Bifrost normalized path.
Take the longest leading sequence of elements in path that exist, if any, convert it to an absolute pathname that resolves to the same directory entry as this sequence and whose resolution does not involve ".", "..", or symbolic links. Then append the remaining sequence of elements in path that do not exist, removing the unnecessary ".", ".." and directory separators from this trailing sequence.
- Note
- A normalized path in Bifrost uses the generic directory separator '/' (forward slash).
- Parameters
-
| [in] | path | The path to normalize. |
- Returns
- A Bifrost normalized path.
◆ getTypeName()
| BIFROSTGRAPH_EXECUTOR_SHARED_DECL Amino::String BifrostGraph::Executor::Utility::getTypeName |
( |
const Amino::Type & |
type | ) |
|
|
noexcept |
Return the fully qualified name of a given type. An empty string is returned to indicate any encountered error.
- Parameters
-
| [in] | type | The type whose fully qualified name is queried. |
- Returns
- The fully qualified name of the given type. If the given type is invalid, an empty string is returned.
◆ isArrayType()
| BIFROSTGRAPH_EXECUTOR_SHARED_DECL bool BifrostGraph::Executor::Utility::isArrayType |
( |
const Amino::Type & |
type | ) |
|
|
noexcept |
Check if a given type is of array kind.
- Parameters
-
| [in] | type | The type whose kind is checked. |
- Returns
- true is the given type is valid and of array kind; false otherwise.