HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdDataSourceLocator Class Reference

#include <dataSourceLocator.h>

Public Member Functions

HD_API HdDataSourceLocator ()
 
HD_API HdDataSourceLocator (const TfToken &t1)
 
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)
 
 HdDataSourceLocator (const HdDataSourceLocator &rhs)=default
 Copy constructor. More...
 
HD_API size_t GetElementCount () const
 Returns the number of elements (tokens) in this data source. More...
 
HD_API const TfTokenGetElement (size_t i) const
 
HD_API const TfTokenGetFirstElement () const
 Returns the first element, or empty token if none. More...
 
HD_API const TfTokenGetLastElement () const
 Returns the last element, or empty token if none. More...
 
HD_API HdDataSourceLocator ReplaceLastElement (const TfToken &name) const
 
HD_API HdDataSourceLocator RemoveLastElement () const
 
HD_API HdDataSourceLocator RemoveFirstElement () const
 
HD_API HdDataSourceLocator Append (const TfToken &name) const
 Appends name to this data source locator. More...
 
HD_API HdDataSourceLocator Append (const HdDataSourceLocator &locator) const
 Appends all of the elements in locator to this data source locator. More...
 
HD_API HdDataSourceLocator Prepend (const TfToken &name) const
 Prepends name to this data source locator. More...
 
HD_API HdDataSourceLocator Prepend (const HdDataSourceLocator &locator) const
 Prepends all of the elements in locator to this data source locator. More...
 
HD_API bool HasPrefix (const HdDataSourceLocator &prefix) const
 
HD_API HdDataSourceLocator GetCommonPrefix (const HdDataSourceLocator &other) const
 
HD_API HdDataSourceLocator ReplacePrefix (const HdDataSourceLocator &oldPrefix, const HdDataSourceLocator &newPrefix) const
 
HD_API bool Intersects (const HdDataSourceLocator &other) const
 
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. More...
 
bool IsEmpty () const
 
HD_API std::string GetString (const char *delimiter="/") const
 
size_t Hash () const
 

Static Public Member Functions

static HD_API const
HdDataSourceLocator
EmptyLocator ()
 

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

HD_API HdDataSourceLocator::HdDataSourceLocator ( )

Creates an empty locator.

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

HD_API HdDataSourceLocator::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.

HD_API HdDataSourceLocator::HdDataSourceLocator ( const TfToken t1,
const TfToken t2 
)
HD_API HdDataSourceLocator::HdDataSourceLocator ( const TfToken t1,
const TfToken t2,
const TfToken t3 
)
HD_API HdDataSourceLocator::HdDataSourceLocator ( const TfToken t1,
const TfToken t2,
const TfToken t3,
const TfToken t4 
)
HD_API HdDataSourceLocator::HdDataSourceLocator ( const TfToken t1,
const TfToken t2,
const TfToken t3,
const TfToken t4,
const TfToken t5 
)
HD_API HdDataSourceLocator::HdDataSourceLocator ( const TfToken t1,
const TfToken t2,
const TfToken t3,
const TfToken t4,
const TfToken t5,
const TfToken t6 
)
HD_API HdDataSourceLocator::HdDataSourceLocator ( size_t  count,
const TfToken tokens 
)

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

HdDataSourceLocator::HdDataSourceLocator ( const HdDataSourceLocator rhs)
default

Copy constructor.

Member Function Documentation

HD_API HdDataSourceLocator HdDataSourceLocator::Append ( const TfToken name) const

Appends name to this data source locator.

HD_API HdDataSourceLocator HdDataSourceLocator::Append ( const HdDataSourceLocator locator) const

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

static HD_API const HdDataSourceLocator& 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.

HD_API HdDataSourceLocator HdDataSourceLocator::GetCommonPrefix ( const HdDataSourceLocator other) const

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

HD_API const TfToken& HdDataSourceLocator::GetElement ( size_t  i) const

Returns the element (token) at index i.

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

HD_API size_t HdDataSourceLocator::GetElementCount ( ) const

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

HD_API const TfToken& HdDataSourceLocator::GetFirstElement ( ) const

Returns the first element, or empty token if none.

HD_API const TfToken& HdDataSourceLocator::GetLastElement ( ) const

Returns the last element, or empty token if none.

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

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

size_t HdDataSourceLocator::Hash ( ) const
inline

Definition at line 212 of file dataSourceLocator.h.

HD_API bool HdDataSourceLocator::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.

HD_API bool HdDataSourceLocator::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.

bool HdDataSourceLocator::IsEmpty ( ) const
inline

Definition at line 189 of file dataSourceLocator.h.

bool HdDataSourceLocator::operator!= ( const HdDataSourceLocator rhs) const
inline

Definition at line 181 of file dataSourceLocator.h.

HD_API bool HdDataSourceLocator::operator< ( const HdDataSourceLocator rhs) const

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

bool HdDataSourceLocator::operator== ( const HdDataSourceLocator rhs) const
inline

Definition at line 177 of file dataSourceLocator.h.

HD_API HdDataSourceLocator HdDataSourceLocator::Prepend ( const TfToken name) const

Prepends name to this data source locator.

HD_API HdDataSourceLocator HdDataSourceLocator::Prepend ( const HdDataSourceLocator locator) const

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

HD_API HdDataSourceLocator HdDataSourceLocator::RemoveFirstElement ( ) const

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

HD_API HdDataSourceLocator HdDataSourceLocator::RemoveLastElement ( ) const

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

HD_API HdDataSourceLocator 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.

HD_API HdDataSourceLocator 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

template<class HashState >
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: