usdrt::TfToken
Defined in usdrt/scenegraph/base/tf/token.h
-
class TfToken
Token for efficient comparison, assignment, and hashing of known strings.
A TfToken is a handle for a registered string, and can be compared, assigned, and hashed in constant time.
This implementation fairly simply wraps omni::fabric::Token.
Public Functions
-
inline TfToken()
Create the empty token containing omni::fabric::kUninitializedToken.
-
inline TfToken(const std::string &token)
Aquire a token for the given string.
- Parameters
token – String representation of token
-
inline TfToken(const char *token)
Acquire a token for the given string.
- Parameters
token – C-string representation of token
-
inline const std::string GetString() const
Get the string that this token represents.
- Returns
String representation of the token.
-
inline const char *GetText() const
Get the text that this token represents.
Note
The returned pointer value is not valid after this TfToken object has been destroyed.
- Returns
Return the C-string value that this token represents.
-
inline size_t size() const
Get the size of the string that this token represents.
- Returns
Return the size of the string that this token represents.
-
inline void pyUpdate(const char *fromPython)
Update this token with a value from python.
This is used in the python bindings for TfToken to convert from python strings.
// where source is the source PyObject* from python and // value is the result TfToken PyObject* tmp = PyObject_Str(source); value.pyUpdate(PyUnicode_AsUTF8(tmp));
See bindings/common.h [TODO link to this when documented]
- Parameters
fromPython – Value extracted from python in the TfToken custom python converter.
-
inline bool IsEmpty() const
Check if this token is empty.
- Returns
Return true if this token contains omni::fabric::kUninitializedToken, and false otherwise.
-
inline bool operator<(const TfToken &other) const
Less-than operator that compares tokenized strings lexicographically.
-
inline TfToken()