TfToken#

Fully qualified name: usdrt::TfToken

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 omni::fabric::Token &token)#

Copy constructor.

inline explicit TfToken(omni::fabric::Token &&token) noexcept#

Move constructor.

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#

Equality operator [TODO more fabric info?].

inline bool operator!=(const TfToken &other) const#

Inequality operator.

inline bool operator<(const TfToken &other) const#

Less-than operator that compares tokenized strings lexicographically.

inline explicit operator omni::fabric::TokenC() const#

Explicit conversion operator for omni::fabric::TokenC, an integer key that identify paths to C-ABI interfaces.

Returns:

Return omni::fabric::TokenC representation of this token.

inline explicit operator omni::fabric::Token() && noexcept#

Explicit operator for std::move.

Friends

friend struct std::hash< usdrt::TfToken >