HDK
|
Files | |
file | dl.h |
file | getenv.h |
file | setenv.h |
Functions | |
TF_API void * | TfDlopen (const std::string &filename, int flag, std::string *error=NULL, bool loadScriptBindings=true) |
TF_API int | TfDlclose (void *handle) |
Close a dynamic library. More... | |
TF_API std::string | TfGetenv (const std::string &envName, const std::string &defaultValue="") |
TF_API int | TfGetenvInt (const std::string &envName, int defaultValue) |
TF_API bool | TfGetenvBool (const std::string &, bool defaultValue) |
TF_API double | TfGetenvDouble (const std::string &envName, double defaultValue) |
PXR_NAMESPACE_OPEN_SCOPE TF_API bool | TfSetenv (const std::string &envName, const std::string &value) |
TF_API bool | TfUnsetenv (const std::string &envName) |
TF_API void* TfDlopen | ( | const std::string & | filename, |
int | flag, | ||
std::string * | error = NULL , |
||
bool | loadScriptBindings = true |
||
) |
Open a dynamic library and notify lib/tf
that a new module has been loaded.
This is a wrapper around ArchLibraryOpen() in the sense that this function calls ArchLibraryOpen
(filename
, flag
) but it will additionally load script bindings if scripting is initialized and loading is requested.
If error
is not NULL
it will be set to a system reported error if opening the library failed, otherwise it will be cleared.
If you set TF_DLOPEN in the TF_DEBUG environment variable then debug output will be reported on each invocation of this function.
This returns an opaque handle to the opened library or NULL
on failure.
TF_API std::string TfGetenv | ( | const std::string & | envName, |
const std::string & | defaultValue = "" |
||
) |
Return an environment variable as a string.
Return the value of the environment variable envName
as a string. If the variable is unset, or is the empty string, then defaultValue
is returned.
TF_API bool TfGetenvBool | ( | const std::string & | , |
bool | defaultValue | ||
) |
Return an environment variable as a boolean.
Return the value of the environment variable envName
as a boolean. If the variable is unset, or is the empty string, then defaultValue
is returned. A value of true
is returned if the environment variable is any of "true", "yes", "on" or "1"; the match is not case sensitive. All other values yield a return value of false
.
TF_API double TfGetenvDouble | ( | const std::string & | envName, |
double | defaultValue | ||
) |
Return an environment variable as a double.
Return the value of the environment variable envName
as a double. If the variable is unset, or is the empty string, then defaultValue
is returned. Otherwise, the function uses TfStringToDouble() to convert the string to a double: the implication being that if the string is not a valid double, you get back whatever value TfStringToDouble() comes up with.
TF_API int TfGetenvInt | ( | const std::string & | envName, |
int | defaultValue | ||
) |
Return an environment variable as an integer.
Return the value of the environment variable envName
as an integer. If the variable is unset, or is the empty string, then defaultValue
is returned. Otherwise, the function uses atoi() to convert the string to an integer: the implication being that if the string is not a valid integer, you get back whatever value atoi() comes up with.
PXR_NAMESPACE_OPEN_SCOPE TF_API bool TfSetenv | ( | const std::string & | envName, |
const std::string & | value | ||
) |
Set an environment variable.
Sets an environment variable and ensures that it appears in the Python environment if Python is initialized. If Python has not yet been initialized, the variable envName
is set to value
in the environment using setenv
. Otherwise, it is set both in the environment and in Python using TfPySetenv
. The new value overwrites any existing value.
If the value cannot be set, false is returned and a warning is posted. Otherwise, the return value is true.
TF_API bool TfUnsetenv | ( | const std::string & | envName | ) |
Unset an environment variable.
Unsets an environment variable and ensures that it is also removed from the Python environment if Python is initialized. If Python has not yet been initialized, the variable envName
is unset in the environment using unsetenv
. Otherwise, it is unset both in the environment and in Python using TfPyUnsetenv
.
If the value cannot be unset, false is returned and a warning is posted. Otherwise, the return value is true.