![]() |
A mapping from SdfPath to MappedType, somewhat similar to map<SdfPath, MappedType> and TfHashMap<SdfPath, MappedType>, but with key differences. More...
Public Types | |
typedef SdfPath | key_type |
typedef MappedType | mapped_type |
typedef std::pair< key_type, mapped_type > | value_type |
typedef Iterator< value_type, _Entry * > | iterator |
typedef Iterator< const value_type, const _Entry * > | const_iterator |
typedef std::pair< iterator, bool > | _IterBoolPair |
Result type for insert(). More... | |
Public Member Functions | |
SdfPathTable () | |
Default constructor. More... | |
SdfPathTable (SdfPathTable const &other) | |
Copy constructor. More... | |
SdfPathTable (SdfPathTable &&other) | |
Move constructor. More... | |
~SdfPathTable () | |
Destructor. More... | |
SdfPathTable & | operator= (SdfPathTable const &other) |
Copy assignment. More... | |
SdfPathTable & | operator= (SdfPathTable &&other) |
Move assignment. More... | |
iterator | begin () |
Return an iterator to the start of the table. More... | |
const_iterator | begin () const |
Return a const_iterator to the start of the table. More... | |
iterator | end () |
Return an iterator denoting the end of the table. More... | |
const_iterator | end () const |
Return a const_iterator denoting the end of the table. More... | |
bool | erase (SdfPath const &path) |
Remove the element with path path from the table as well as all elements whose paths are prefixed by path. More... | |
void | erase (iterator const &i) |
Remove the element pointed to by i from the table as well as all elements whose paths are prefixed by i->first. More... | |
iterator | find (SdfPath const &path) |
Return an iterator to the element corresponding to path, or end() if there is none. More... | |
const_iterator | find (SdfPath const &path) const |
Return a const_iterator to the element corresponding to path, or end() if there is none. More... | |
std::pair< iterator, iterator > | FindSubtreeRange (SdfPath const &path) |
Return a pair of iterators [b, e), describing the maximal range such that for all i in the range, i->first is b->first or is prefixed by b->first. More... | |
std::pair< const_iterator, const_iterator > | FindSubtreeRange (SdfPath const &path) const |
Return a pair of const_iterators [b, e), describing the maximal range such that for all i in the range, i->first is b->first or is prefixed by b->first. More... | |
size_t | count (SdfPath const &path) const |
Return 1 if there is an element for path in the table, otherwise 0. More... | |
size_t | size () const |
Return the number of elements in the table. More... | |
bool | empty () const |
Return true if this table is empty. More... | |
_IterBoolPair | insert (value_type const &value) |
Insert value into the table, and additionally insert default entries for all ancestral paths of value.first that do not already exist in the table. More... | |
mapped_type & | operator[] (SdfPath const &path) |
Shorthand for the following, where t is an SdfPathTable<T>. More... | |
void | clear () |
Remove all elements from the table, leaving size() == 0. More... | |
void | ClearInParallel () |
Equivalent to clear(), but destroy contained objects in parallel. More... | |
void | swap (SdfPathTable &other) |
Swap this table's contents with other. More... | |
std::vector< size_t > | GetBucketSizes () const |
Return a vector of the count of elements in each bucket. More... | |
void | UpdateForRename (const SdfPath &oldName, const SdfPath &newName) |
Replaces all prefixes from oldName to newName . More... | |
Friends | |
template<class , class > | |
class | Iterator |
A mapping from SdfPath to MappedType, somewhat similar to map<SdfPath, MappedType> and TfHashMap<SdfPath, MappedType>, but with key differences.
Notably:
Works exclusively with absolute paths.
Inserting a path p also implicitly inserts all of p's ancestors.
Erasing a path p also implicitly erases all of p's descendants.
The table has an order: it's a preordering of the paths in the table, but with arbitrary sibling order. Given a path p in the table, all other paths in the table with p as a prefix appear contiguously, immediately following p. For example, suppose a table contains the paths:
{'/a/b/c', '/a', '/a/d', '/', '/a/b'}
Then there are two possible valid orderings:
['/', '/a', '/a/d', '/a/b', '/a/b/c'] ['/', '/a', '/a/b', '/a/b/c', '/a/d']
In addition to the ordinary map and TfHashMap methods, this class provides a method FindSubtreeRange, which, given a path p, returns a pair of iterators [b, e) defining a range such that for every iterator i in [b, e), i->first is either equal to p or is prefixed by p.
Iterator Invalidation
Like most other node-based containers, iterators are only invalidated when the element they refer to is removed from the table. Note however, that since removing the element with path p also implicitly removes all elements with paths prefixed by p, a call to erase(i) may invalidate many iterators.
Definition at line 84 of file pathTable.h.
typedef std::pair<iterator, bool> _IterBoolPair |
Result type for insert().
Definition at line 275 of file pathTable.h.
|
inline |
Default constructor.
Definition at line 278 of file pathTable.h.
|
inline |
Copy constructor.
Definition at line 281 of file pathTable.h.
|
inline |
Move constructor.
Definition at line 308 of file pathTable.h.
|
inline |
Destructor.
Definition at line 318 of file pathTable.h.
|
inline |
Return an iterator to the start of the table.
Definition at line 338 of file pathTable.h.
|
inline |
Return a const_iterator to the start of the table.
Definition at line 346 of file pathTable.h.
|
inline |
Remove all elements from the table, leaving size() == 0.
Note that this function will not shrink the number of buckets used for the hash table. To do that, swap this instance with a default constructed instance. See also TfReset.
Definition at line 491 of file pathTable.h.
|
inline |
Equivalent to clear(), but destroy contained objects in parallel.
This requires that running the contained objects' destructors is thread-safe.
Definition at line 507 of file pathTable.h.
|
inline |
Return 1 if there is an element for path in the table, otherwise 0.
Definition at line 441 of file pathTable.h.
|
inline |
Return true if this table is empty.
Definition at line 449 of file pathTable.h.
|
inline |
Return an iterator denoting the end of the table.
Definition at line 354 of file pathTable.h.
|
inline |
Return a const_iterator denoting the end of the table.
Definition at line 359 of file pathTable.h.
|
inline |
Remove the element with path path from the table as well as all elements whose paths are prefixed by path.
Return true if any elements were removed, false otherwise.
Note that since descendant paths are also erased, size() may be decreased by more than one after calling this function.
Definition at line 369 of file pathTable.h.
|
inline |
Remove the element pointed to by i
from the table as well as all elements whose paths are prefixed by i->first.
i must be a valid iterator for this table.
Note that since descendant paths are also erased, size() may be decreased by more than one after calling this function.
Definition at line 383 of file pathTable.h.
|
inline |
Return an iterator to the element corresponding to path, or end() if there is none.
Definition at line 394 of file pathTable.h.
|
inline |
Return a const_iterator to the element corresponding to path, or end() if there is none.
Definition at line 407 of file pathTable.h.
|
inline |
Return a pair of iterators [b, e), describing the maximal range such that for all i in the range, i->first is b->first or is prefixed by b->first.
Definition at line 422 of file pathTable.h.
|
inline |
Return a pair of const_iterators [b, e), describing the maximal range such that for all i in the range, i->first is b->first or is prefixed by b->first.
Definition at line 433 of file pathTable.h.
|
inline |
Return a vector of the count of elements in each bucket.
Definition at line 521 of file pathTable.h.
|
inline |
Insert value into the table, and additionally insert default entries for all ancestral paths of value.first that do not already exist in the table.
Return a pair of iterator and bool. The iterator points to the inserted element, the bool indicates whether insertion was successful. The bool is true if value was successfully inserted and false if an element with path value.first was already present in the map.
Note that since ancestral paths are also inserted, size() may be increased by more than one after calling this function.
Definition at line 462 of file pathTable.h.
|
inline |
Copy assignment.
Definition at line 324 of file pathTable.h.
|
inline |
Move assignment.
Definition at line 331 of file pathTable.h.
|
inline |
Shorthand for the following, where t is an SdfPathTable<T>.
Definition at line 483 of file pathTable.h.
|
inline |
Return the number of elements in the table.
Definition at line 446 of file pathTable.h.
|
inline |
Swap this table's contents with other.
Definition at line 514 of file pathTable.h.
Replaces all prefixes from oldName
to newName
.
Note that oldName
and newName
need to be silbing paths (ie. their parent paths must be the same).
Definition at line 534 of file pathTable.h.