All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SdfChildrenView< _ChildPolicy, _Predicate, _Adapter > Class Template Reference

Provides a view onto an object's children. More...

#include <childrenView.h>

Public Types

typedef SdfChildrenView< _ChildPolicy, _Predicate, _Adapter > This
 
typedef _Adapter Adapter
 
typedef _Predicate Predicate
 
typedef _ChildPolicy ChildPolicy
 
typedef ChildPolicy::KeyPolicy KeyPolicy
 
typedef Sdf_Children< ChildPolicy > ChildrenType
 
typedef ChildPolicy::KeyType key_type
 
typedef Adapter::PublicType value_type
 
typedef Sdf_ChildrenViewTraits< This, _InnerIterator, Predicate > _Traits
 
typedef _Traits::const_iterator const_iterator
 
typedef Tf_ProxyReferenceReverseIterator< const_iterator > const_reverse_iterator
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 

Public Member Functions

 SdfChildrenView (const SdfLayerHandle &layer, const SdfPath &path, const TfToken &childrenKey, const KeyPolicy &keyPolicy=KeyPolicy())
 
 SdfChildrenView (const SdfLayerHandle &layer, const SdfPath &path, const TfToken &childrenKey, const Predicate &predicate, const KeyPolicy &keyPolicy=KeyPolicy())
 
 SdfChildrenView (const SdfChildrenView &other)
 
template<class OtherAdapter >
 SdfChildrenView (const SdfChildrenView< ChildPolicy, Predicate, OtherAdapter > &other)
 
SdfChildrenViewoperator= (const SdfChildrenView &other)
 
const_iterator begin () const
 Returns an const_iterator pointing to the beginning of the vector.
 
const_iterator end () const
 Returns an const_iterator pointing to the end of the vector.
 
const_reverse_iterator rbegin () const
 Returns an const_reverse_iterator pointing to the beginning of the reversed vector.
 
const_reverse_iterator rend () const
 Returns an const_reverse_iterator pointing to the end of the reversed vector.
 
size_type size () const
 Returns the size of the vector.
 
bool empty () const
 Returns true if the vector is empty.
 
value_type operator[] (size_type n) const
 Returns the n'th element.
 
value_type front () const
 Returns the first element.
 
value_type back () const
 Returns the last element.
 
const_iterator find (const key_type &x) const
 Finds the element with key x.
 
const_iterator find (const value_type &x) const
 Finds element x, if present in this view.
 
key_type key (const const_iterator &x) const
 Returns the key for an element.
 
key_type key (const value_type &x) const
 Returns the key for a value.
 
std::vector< value_type > values () const
 Returns the elements, in order.
 
template<typename V >
values_as () const
 Returns the elements, in order.
 
std::vector< key_type > keys () const
 Returns the keys for all elements, in order.
 
template<typename V >
keys_as () const
 Returns the keys for all elements, in order.
 
template<typename Dict >
Dict items_as () const
 Returns the elements as a dictionary.
 
bool has (const key_type &x) const
 Returns true if an element with key x is in the container.
 
bool has (const value_type &x) const
 Returns true if an element with the same key as x is in the container.
 
size_type count (const key_type &x) const
 Returns the number of elements with key x in the container.
 
value_type get (const key_type &x) const
 Returns the element with key x or a default constructed value if no such element exists.
 
value_type get (const key_type &x, const value_type &fallback) const
 Returns the element with key x or the fallback if no such element exists.
 
value_type operator[] (const key_type &x) const
 Returns the element with key x or a default constructed value if no such element exists.
 
bool operator== (const This &other) const
 Compares children for equality.
 
bool operator!= (const This &other) const
 Compares children for inequality.
 
bool IsValid () const
 
ChildrenType & GetChildren ()
 
const Predicate & GetPredicate () const
 

Detailed Description

template<typename _ChildPolicy, typename _Predicate = SdfChildrenViewTrivialPredicate< typename _ChildPolicy::ValueType>, typename _Adapter = SdfChildrenViewTrivialAdapter< typename _ChildPolicy::ValueType>>
class SdfChildrenView< _ChildPolicy, _Predicate, _Adapter >

Provides a view onto an object's children.

The _ChildPolicy dictates the type of children being viewed by this object. This policy defines the key type by which children are referenced (e.g. a TfToken, or an SdfPath) and the value type of the children objects.

The _Predicate takes a value type argument and returns true if the object should be included in the view and false otherwise.

The _Adapter allows the view to present the children objects as a different type. The _Adapter class must provide functions to convert the children object type defined by _ChildPolicy to the desired public type and vice-versa. See SdfChildrenViewTrivialAdapter for an example. By default, the view presents children objects as the value type defined in _ChildPolicy.

Note that all methods are const, i.e. the children cannot be changed through a view.

Definition at line 205 of file childrenView.h.

Member Typedef Documentation

◆ _Traits

typedef Sdf_ChildrenViewTraits<This, _InnerIterator, Predicate> _Traits

Definition at line 364 of file childrenView.h.

◆ Adapter

typedef _Adapter Adapter

Definition at line 209 of file childrenView.h.

◆ ChildPolicy

typedef _ChildPolicy ChildPolicy

Definition at line 211 of file childrenView.h.

◆ ChildrenType

typedef Sdf_Children<ChildPolicy> ChildrenType

Definition at line 213 of file childrenView.h.

◆ const_iterator

typedef _Traits::const_iterator const_iterator

Definition at line 365 of file childrenView.h.

◆ const_reverse_iterator

typedef Tf_ProxyReferenceReverseIterator<const_iterator> const_reverse_iterator

Definition at line 366 of file childrenView.h.

◆ difference_type

typedef ptrdiff_t difference_type

Definition at line 368 of file childrenView.h.

◆ key_type

typedef ChildPolicy::KeyType key_type

Definition at line 215 of file childrenView.h.

◆ KeyPolicy

typedef ChildPolicy::KeyPolicy KeyPolicy

Definition at line 212 of file childrenView.h.

◆ Predicate

typedef _Predicate Predicate

Definition at line 210 of file childrenView.h.

◆ size_type

typedef size_t size_type

Definition at line 367 of file childrenView.h.

◆ This

typedef SdfChildrenView<_ChildPolicy, _Predicate, _Adapter> This

Definition at line 207 of file childrenView.h.

◆ value_type

typedef Adapter::PublicType value_type

Definition at line 216 of file childrenView.h.

Constructor & Destructor Documentation

◆ SdfChildrenView() [1/5]

SdfChildrenView ( )
inline

Definition at line 370 of file childrenView.h.

◆ SdfChildrenView() [2/5]

SdfChildrenView ( const SdfLayerHandle &  layer,
const SdfPath path,
const TfToken childrenKey,
const KeyPolicy &  keyPolicy = KeyPolicy() 
)
inline

Definition at line 374 of file childrenView.h.

◆ SdfChildrenView() [3/5]

SdfChildrenView ( const SdfLayerHandle &  layer,
const SdfPath path,
const TfToken childrenKey,
const Predicate &  predicate,
const KeyPolicy &  keyPolicy = KeyPolicy() 
)
inline

Definition at line 381 of file childrenView.h.

◆ SdfChildrenView() [4/5]

SdfChildrenView ( const SdfChildrenView< _ChildPolicy, _Predicate, _Adapter > &  other)
inline

Definition at line 390 of file childrenView.h.

◆ SdfChildrenView() [5/5]

SdfChildrenView ( const SdfChildrenView< ChildPolicy, Predicate, OtherAdapter > &  other)
inline

Definition at line 397 of file childrenView.h.

◆ ~SdfChildrenView()

~SdfChildrenView ( )
inline

Definition at line 404 of file childrenView.h.

Member Function Documentation

◆ back()

value_type back ( ) const
inline

Returns the last element.

Definition at line 462 of file childrenView.h.

◆ begin()

const_iterator begin ( ) const
inline

Returns an const_iterator pointing to the beginning of the vector.

Definition at line 416 of file childrenView.h.

◆ count()

size_type count ( const key_type &  x) const
inline

Returns the number of elements with key x in the container.

Definition at line 547 of file childrenView.h.

◆ empty()

bool empty ( ) const
inline

Returns true if the vector is empty.

Definition at line 445 of file childrenView.h.

◆ end()

const_iterator end ( ) const
inline

Returns an const_iterator pointing to the end of the vector.

Definition at line 422 of file childrenView.h.

◆ find() [1/2]

const_iterator find ( const key_type &  x) const
inline

Finds the element with key x.

Definition at line 467 of file childrenView.h.

◆ find() [2/2]

const_iterator find ( const value_type &  x) const
inline

Finds element x, if present in this view.

Definition at line 480 of file childrenView.h.

◆ front()

value_type front ( ) const
inline

Returns the first element.

Definition at line 457 of file childrenView.h.

◆ get() [1/2]

value_type get ( const key_type &  x) const
inline

Returns the element with key x or a default constructed value if no such element exists.

Definition at line 553 of file childrenView.h.

◆ get() [2/2]

value_type get ( const key_type &  x,
const value_type &  fallback 
) const
inline

Returns the element with key x or the fallback if no such element exists.

Definition at line 563 of file childrenView.h.

◆ GetChildren()

ChildrenType & GetChildren ( )
inline

Definition at line 596 of file childrenView.h.

◆ GetPredicate()

const Predicate & GetPredicate ( ) const
inline

Definition at line 601 of file childrenView.h.

◆ has() [1/2]

bool has ( const key_type &  x) const
inline

Returns true if an element with key x is in the container.

Definition at line 536 of file childrenView.h.

◆ has() [2/2]

bool has ( const value_type &  x) const
inline

Returns true if an element with the same key as x is in the container.

Definition at line 542 of file childrenView.h.

◆ IsValid()

bool IsValid ( ) const
inline

Definition at line 591 of file childrenView.h.

◆ items_as()

Dict items_as ( ) const
inline

Returns the elements as a dictionary.

Definition at line 527 of file childrenView.h.

◆ key() [1/2]

key_type key ( const const_iterator &  x) const
inline

Returns the key for an element.

Definition at line 486 of file childrenView.h.

◆ key() [2/2]

key_type key ( const value_type &  x) const
inline

Returns the key for a value.

Definition at line 491 of file childrenView.h.

◆ keys()

std::vector< key_type > keys ( ) const
inline

Returns the keys for all elements, in order.

Definition at line 509 of file childrenView.h.

◆ keys_as()

V keys_as ( ) const
inline

Returns the keys for all elements, in order.

Definition at line 520 of file childrenView.h.

◆ operator!=()

bool operator!= ( const This other) const
inline

Compares children for inequality.

Children are not equal if list edits are not identical or the keys don't contain the same elements.

Definition at line 586 of file childrenView.h.

◆ operator=()

SdfChildrenView & operator= ( const SdfChildrenView< _ChildPolicy, _Predicate, _Adapter > &  other)
inline

Definition at line 408 of file childrenView.h.

◆ operator==()

bool operator== ( const This other) const
inline

Compares children for equality.

Children are equal if the list edits are identical and the keys contain the same elements.

Definition at line 579 of file childrenView.h.

◆ operator[]() [1/2]

value_type operator[] ( const key_type &  x) const
inline

Returns the element with key x or a default constructed value if no such element exists.

Definition at line 573 of file childrenView.h.

◆ operator[]() [2/2]

value_type operator[] ( size_type  n) const
inline

Returns the n'th element.

Definition at line 450 of file childrenView.h.

◆ rbegin()

const_reverse_iterator rbegin ( ) const
inline

Returns an const_reverse_iterator pointing to the beginning of the reversed vector.

Definition at line 429 of file childrenView.h.

◆ rend()

const_reverse_iterator rend ( ) const
inline

Returns an const_reverse_iterator pointing to the end of the reversed vector.

Definition at line 435 of file childrenView.h.

◆ size()

size_type size ( ) const
inline

Returns the size of the vector.

Definition at line 440 of file childrenView.h.

◆ values()

std::vector< value_type > values ( ) const
inline

Returns the elements, in order.

Definition at line 496 of file childrenView.h.

◆ values_as()

V values_as ( ) const
inline

Returns the elements, in order.

Definition at line 502 of file childrenView.h.

Friends And Related Function Documentation

◆ SdfChildrenView

friend class SdfChildrenView
friend

Definition at line 617 of file childrenView.h.


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