Loading...
Searching...
No Matches
HdDataSourceLocator Class Reference

Represents an object that can identify the location of a data source. More...

#include <dataSourceLocator.h>

Public Member Functions

HD_API HdDataSourceLocator ()
 Creates an empty locator.
 
HD_API HdDataSourceLocator (const TfToken &t1)
 The following constructors take a number of tokens and build a locator with the apporpriate number of tokens in the given order.
 
HD_API HdDataSourceLocator (const TfToken &t1, const TfToken &t2)
 
HD_API HdDataSourceLocator (const TfToken &t1, const TfToken &t2, const TfToken &t3)
 
HD_API HdDataSourceLocator (const TfToken &t1, const TfToken &t2, const TfToken &t3, const TfToken &t4)
 
HD_API HdDataSourceLocator (const TfToken &t1, const TfToken &t2, const TfToken &t3, const TfToken &t4, const TfToken &t5)
 
HD_API HdDataSourceLocator (const TfToken &t1, const TfToken &t2, const TfToken &t3, const TfToken &t4, const TfToken &t5, const TfToken &t6)
 
HD_API HdDataSourceLocator (size_t count, const TfToken *tokens)
 Builds a data source locator from the tokens array of the given count.
 
 HdDataSourceLocator (const HdDataSourceLocator &rhs)=default
 Copy constructor.
 
HD_API size_t GetElementCount () const
 Returns the number of elements (tokens) in this data source.
 
HD_API const TfTokenGetElement (size_t i) const
 Returns the element (token) at index i.
 
HD_API const TfTokenGetFirstElement () const
 Returns the first element, or empty token if none.
 
HD_API const TfTokenGetLastElement () const
 Returns the last element, or empty token if none.
 
HD_API HdDataSourceLocator ReplaceLastElement (const TfToken &name) const
 Returns a copy of this data source locator with the last element replaced by the one given by name.
 
HD_API HdDataSourceLocator RemoveLastElement () const
 Returns a copy of this data source locator with the last element removed.
 
HD_API HdDataSourceLocator RemoveFirstElement () const
 Returns a copy of this data source locator with the first element removed.
 
HD_API HdDataSourceLocator Append (const TfToken &name) const
 Appends name to this data source locator.
 
HD_API HdDataSourceLocator Append (const HdDataSourceLocator &locator) const
 Appends all of the elements in locator to this data source locator.
 
HD_API HdDataSourceLocator Prepend (const TfToken &name) const
 Prepends name to this data source locator.
 
HD_API HdDataSourceLocator Prepend (const HdDataSourceLocator &locator) const
 Prepends all of the elements in locator to this data source locator.
 
HD_API bool HasPrefix (const HdDataSourceLocator &prefix) const
 Returns true if and only if this data source locator has prefix as a prefix.
 
HD_API HdDataSourceLocator GetCommonPrefix (const HdDataSourceLocator &other) const
 Returns a data source locator that represents the common prefix between this data source and other.
 
HD_API HdDataSourceLocator ReplacePrefix (const HdDataSourceLocator &oldPrefix, const HdDataSourceLocator &newPrefix) const
 Returns a copy of this data source locator with oldPrefix replaced by newPrefix.
 
HD_API bool Intersects (const HdDataSourceLocator &other) const
 Returns true if and only if either of the two locators is a prefix of the other one - in the sense of HasPrefix.
 
bool operator== (const HdDataSourceLocator &rhs) const
 
bool operator!= (const HdDataSourceLocator &rhs) const
 
HD_API bool operator< (const HdDataSourceLocator &rhs) const
 Lexicographic order. If y has x as prefix, x < y.
 
bool IsEmpty () const
 
HD_API std::string GetString (const char *delimiter="/") const
 Returns a string representation of this data source locator with the given delimiter inserted between each element.
 
size_t Hash () const
 

Static Public Member Functions

static HD_API const HdDataSourceLocatorEmptyLocator ()
 Returns a common empty locator.
 

Friends

template<class HashState >
void TfHashAppend (HashState &h, HdDataSourceLocator const &myObj)
 

Detailed Description

Represents an object that can identify the location of a data source.

Data Source Locators are meant to be short lists of tokens that, taken together, can represent the location of a given data source.

Definition at line 44 of file dataSourceLocator.h.

Constructor & Destructor Documentation

◆ HdDataSourceLocator() [1/4]

HD_API HdDataSourceLocator ( )

Creates an empty locator.

If all you need is an empty locator, see EmptyLocator().

◆ HdDataSourceLocator() [2/4]

HD_API HdDataSourceLocator ( const TfToken t1)
explicit

The following constructors take a number of tokens and build a locator with the apporpriate number of tokens in the given order.

These are convenience constructors for commonly used patterns. Note that we generally expect a very small number of entities in a locator, which is why we haven't gone with a more general N-way solution.

◆ HdDataSourceLocator() [3/4]

HD_API HdDataSourceLocator ( size_t  count,
const TfToken tokens 
)

Builds a data source locator from the tokens array of the given count.

◆ HdDataSourceLocator() [4/4]

HdDataSourceLocator ( const HdDataSourceLocator rhs)
default

Copy constructor.

Member Function Documentation

◆ Append() [1/2]

HD_API HdDataSourceLocator Append ( const HdDataSourceLocator locator) const

Appends all of the elements in locator to this data source locator.

◆ Append() [2/2]

HD_API HdDataSourceLocator Append ( const TfToken name) const

Appends name to this data source locator.

◆ EmptyLocator()

static HD_API const HdDataSourceLocator & EmptyLocator ( )
static

Returns a common empty locator.

This is an often needed locator and is quicker to get this way rather than creating your own empty one.

◆ GetCommonPrefix()

HD_API HdDataSourceLocator GetCommonPrefix ( const HdDataSourceLocator other) const

Returns a data source locator that represents the common prefix between this data source and other.

◆ GetElement()

HD_API const TfToken & GetElement ( size_t  i) const

Returns the element (token) at index i.

If i is out of bounds, the behavior is undefined.

◆ GetElementCount()

HD_API size_t GetElementCount ( ) const

Returns the number of elements (tokens) in this data source.

◆ GetFirstElement()

HD_API const TfToken & GetFirstElement ( ) const

Returns the first element, or empty token if none.

◆ GetLastElement()

HD_API const TfToken & GetLastElement ( ) const

Returns the last element, or empty token if none.

◆ GetString()

HD_API std::string GetString ( const char *  delimiter = "/") const

Returns a string representation of this data source locator with the given delimiter inserted between each element.

◆ Hash()

size_t Hash ( ) const
inline

Definition at line 212 of file dataSourceLocator.h.

◆ HasPrefix()

HD_API bool HasPrefix ( const HdDataSourceLocator prefix) const

Returns true if and only if this data source locator has prefix as a prefix.

In particular, returns true if this locator is equal to prefix.

◆ Intersects()

HD_API bool Intersects ( const HdDataSourceLocator other) const

Returns true if and only if either of the two locators is a prefix of the other one - in the sense of HasPrefix.

In particular, it is true if the two locators are equal.

◆ IsEmpty()

bool IsEmpty ( ) const
inline

Definition at line 189 of file dataSourceLocator.h.

◆ operator!=()

bool operator!= ( const HdDataSourceLocator rhs) const
inline

Definition at line 181 of file dataSourceLocator.h.

◆ operator<()

HD_API bool operator< ( const HdDataSourceLocator rhs) const

Lexicographic order. If y has x as prefix, x < y.

◆ operator==()

bool operator== ( const HdDataSourceLocator rhs) const
inline

Definition at line 177 of file dataSourceLocator.h.

◆ Prepend() [1/2]

HD_API HdDataSourceLocator Prepend ( const HdDataSourceLocator locator) const

Prepends all of the elements in locator to this data source locator.

◆ Prepend() [2/2]

HD_API HdDataSourceLocator Prepend ( const TfToken name) const

Prepends name to this data source locator.

◆ RemoveFirstElement()

HD_API HdDataSourceLocator RemoveFirstElement ( ) const

Returns a copy of this data source locator with the first element removed.

◆ RemoveLastElement()

HD_API HdDataSourceLocator RemoveLastElement ( ) const

Returns a copy of this data source locator with the last element removed.

◆ ReplaceLastElement()

HD_API HdDataSourceLocator ReplaceLastElement ( const TfToken name) const

Returns a copy of this data source locator with the last element replaced by the one given by name.

If this data source locator is empty an identical copy is returned.

◆ ReplacePrefix()

HD_API HdDataSourceLocator ReplacePrefix ( const HdDataSourceLocator oldPrefix,
const HdDataSourceLocator newPrefix 
) const

Returns a copy of this data source locator with oldPrefix replaced by newPrefix.

Friends And Related Function Documentation

◆ TfHashAppend

void TfHashAppend ( HashState &  h,
HdDataSourceLocator const &  myObj 
)
friend

Definition at line 200 of file dataSourceLocator.h.


The documentation for this class was generated from the following file: