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

#include <dictionary.h>

Classes

class  Iterator
 

Public Types

typedef _Map::key_type key_type
 
typedef _Map::mapped_type mapped_type
 
typedef _Map::value_type value_type
 
typedef _Map::allocator_type allocator_type
 
typedef _Map::size_type size_type
 
typedef Iterator< _Map
*, _Map::iterator > 
iterator
 
typedef Iterator< _Map const
*, _Map::const_iterator > 
const_iterator
 

Public Member Functions

 TF_MALLOC_TAG_NEW ("Vt","VtDictionary")
 
 VtDictionary ()
 Creates an empty VtDictionary. More...
 
 VtDictionary (int size)
 Creates an empty VtDictionary with at least size buckets. More...
 
template<class _InputIterator >
 VtDictionary (_InputIterator f, _InputIterator l)
 Creates a VtDictionary with a copy of a range. More...
 
VT_API VtDictionary (VtDictionary const &other)
 Creates a copy of the supplied VtDictionary. More...
 
VT_API VtDictionary (VtDictionary &&other)=default
 Creates a new VtDictionary by moving the supplied VtDictionary. More...
 
VT_API VtDictionary (std::initializer_list< value_type > init)
 Creates a new VtDictionary from a braced initializer list. More...
 
VT_API VtDictionaryoperator= (VtDictionary const &other)
 Copy assignment operator. More...
 
VT_API VtDictionaryoperator= (VtDictionary &&other)=default
 Move assignment operator. More...
 
VT_API VtValueoperator[] (const std::string &key)
 
VT_API size_type count (const std::string &key) const
 Counts the number of elements whose key is key. More...
 
VT_API size_type count (const char *key) const
 Counts the number of elements whose key is key. More...
 
VT_API size_type erase (const std::string &key)
 Erases the element whose key is key. More...
 
VT_API void erase (iterator it)
 Erases the element pointed to by it. More...
 
VT_API void erase (iterator f, iterator l)
 Erases all elements in a range. More...
 
VT_API void clear ()
 Erases all of the elements. More...
 
VT_API iterator find (const std::string &key)
 Finds an element whose key is key. More...
 
VT_API iterator find (const char *key)
 Finds an element whose key is key. More...
 
VT_API const_iterator find (const std::string &key) const
 Finds an element whose key is key. More...
 
VT_API const_iterator find (const char *key) const
 Finds an element whose key is key. More...
 
VT_API iterator begin ()
 Returns an iterator pointing to the beginning of the VtDictionary. More...
 
VT_API const_iterator begin () const
 Returns an iterator pointing to the beginning of the VtDictionary. More...
 
VT_API iterator end ()
 Returns an iterator pointing to the end of the VtDictionary. More...
 
VT_API const_iterator end () const
 Returns an iterator pointing to the end of the VtDictionary. More...
 
VT_API size_type size () const
 Returns the size of the VtDictionary. More...
 
VT_API bool empty () const
 true if the VtDictionary's size is 0. More...
 
VT_API void swap (VtDictionary &dict)
 Swaps the contents of two VtDictionaries. More...
 
template<class _InputIterator >
void insert (_InputIterator f, _InputIterator l)
 Inserts a range into the VtDictionary. More...
 
VT_API std::pair< iterator, bool > insert (const value_type &obj)
 Inserts obj into the VtDictionary. More...
 
VT_API VtValue const * GetValueAtPath (std::string const &keyPath, char const *delimiters=":") const
 
VT_API VtValue const * GetValueAtPath (std::vector< std::string > const &keyPath) const
 
VT_API void SetValueAtPath (std::string const &keyPath, VtValue const &value, char const *delimiters=":")
 
VT_API void SetValueAtPath (std::vector< std::string > const &keyPath, VtValue const &value)
 
VT_API void EraseValueAtPath (std::string const &keyPath, char const *delimiters=":")
 
VT_API void EraseValueAtPath (std::vector< std::string > const &keyPath)
 

Friends

void swap (VtDictionary &lhs, VtDictionary &rhs)
 
size_t hash_value (VtDictionary const &dict)
 

Detailed Description

A map with string keys and VtValue values.

VtDictionary converts to and from a python dictionary as long as each element contains either

  • another VtDictionary (converts to a nested dictionary)
  • std::vector<VtValue> (converts to a nested list)
  • VtValue with one of the supported Vt Types.

For a list of functions that can manipulate VtDictionary objects, see the VtDictionary Functions group page .

Definition at line 60 of file dictionary.h.

Member Typedef Documentation

typedef _Map::allocator_type VtDictionary::allocator_type

Definition at line 194 of file dictionary.h.

typedef Iterator<_Map const*, _Map::const_iterator> VtDictionary::const_iterator

Definition at line 198 of file dictionary.h.

typedef Iterator<_Map*, _Map::iterator> VtDictionary::iterator

Definition at line 197 of file dictionary.h.

typedef _Map::key_type VtDictionary::key_type

Definition at line 191 of file dictionary.h.

typedef _Map::mapped_type VtDictionary::mapped_type

Definition at line 192 of file dictionary.h.

typedef _Map::size_type VtDictionary::size_type

Definition at line 195 of file dictionary.h.

typedef _Map::value_type VtDictionary::value_type

Definition at line 193 of file dictionary.h.

Constructor & Destructor Documentation

VtDictionary::VtDictionary ( )
inline

Creates an empty VtDictionary.

Definition at line 201 of file dictionary.h.

VtDictionary::VtDictionary ( int  size)
inlineexplicit

Creates an empty VtDictionary with at least size buckets.

Definition at line 204 of file dictionary.h.

template<class _InputIterator >
VtDictionary::VtDictionary ( _InputIterator  f,
_InputIterator  l 
)
inline

Creates a VtDictionary with a copy of a range.

Definition at line 208 of file dictionary.h.

VT_API VtDictionary::VtDictionary ( VtDictionary const &  other)

Creates a copy of the supplied VtDictionary.

VT_API VtDictionary::VtDictionary ( VtDictionary &&  other)
default

Creates a new VtDictionary by moving the supplied VtDictionary.

VT_API VtDictionary::VtDictionary ( std::initializer_list< value_type init)

Creates a new VtDictionary from a braced initializer list.

Member Function Documentation

VT_API iterator VtDictionary::begin ( )

Returns an iterator pointing to the beginning of the VtDictionary.

VT_API const_iterator VtDictionary::begin ( ) const

Returns an iterator pointing to the beginning of the VtDictionary.

VT_API void VtDictionary::clear ( )

Erases all of the elements.

VT_API size_type VtDictionary::count ( const std::string key) const

Counts the number of elements whose key is key.

VT_API size_type VtDictionary::count ( const char *  key) const

Counts the number of elements whose key is key.

VT_API bool VtDictionary::empty ( ) const

true if the VtDictionary's size is 0.

VT_API iterator VtDictionary::end ( )

Returns an iterator pointing to the end of the VtDictionary.

VT_API const_iterator VtDictionary::end ( ) const

Returns an iterator pointing to the end of the VtDictionary.

VT_API size_type VtDictionary::erase ( const std::string key)

Erases the element whose key is key.

VT_API void VtDictionary::erase ( iterator  it)

Erases the element pointed to by it.

VT_API void VtDictionary::erase ( iterator  f,
iterator  l 
)

Erases all elements in a range.

VT_API void VtDictionary::EraseValueAtPath ( std::string const &  keyPath,
char const *  delimiters = ":" 
)

Erase the value at keyPath. keyPath is a delimited string of sub-dictionary names. Key path elements are produced by calling TfStringTokenize() with keyPath and delimiters. If no such element exists at keyPath, do nothing. If keyPath identifies a sub-dictionary, erase the entire sub-dictionary.

VT_API void VtDictionary::EraseValueAtPath ( std::vector< std::string > const &  keyPath)

Erase the value at keyPath. If no such element exists at keyPath, do nothing. If keyPath identifies a sub-dictionary, erase the entire sub-dictionary.

VT_API iterator VtDictionary::find ( const std::string key)

Finds an element whose key is key.

VT_API iterator VtDictionary::find ( const char *  key)

Finds an element whose key is key.

VT_API const_iterator VtDictionary::find ( const std::string key) const

Finds an element whose key is key.

VT_API const_iterator VtDictionary::find ( const char *  key) const

Finds an element whose key is key.

VT_API VtValue const* VtDictionary::GetValueAtPath ( std::string const &  keyPath,
char const *  delimiters = ":" 
) const

Return a pointer to the value at keyPath if one exists. keyPath is a delimited string of sub-dictionary names. Key path elements are produced by calling TfStringTokenize() with keyPath and delimiters. keyPath may identify a leaf element or an entire sub-dictionary. Return null if no such element at keyPath exists.

VT_API VtValue const* VtDictionary::GetValueAtPath ( std::vector< std::string > const &  keyPath) const

Return a pointer to the value at keyPath if one exists. keyPath may identify a leaf element or an entire sub-dictionary. Return null if no such element at keyPath exists.

template<class _InputIterator >
void VtDictionary::insert ( _InputIterator  f,
_InputIterator  l 
)
inline

Inserts a range into the VtDictionary.

Definition at line 321 of file dictionary.h.

VT_API std::pair<iterator, bool> VtDictionary::insert ( const value_type obj)

Inserts obj into the VtDictionary.

VT_API VtDictionary& VtDictionary::operator= ( VtDictionary const &  other)

Copy assignment operator.

VT_API VtDictionary& VtDictionary::operator= ( VtDictionary &&  other)
default

Move assignment operator.

VT_API VtValue& VtDictionary::operator[] ( const std::string key)

Returns a reference to the VtValue that is associated with a particular key.

VT_API void VtDictionary::SetValueAtPath ( std::string const &  keyPath,
VtValue const &  value,
char const *  delimiters = ":" 
)

Set the value at keyPath to value. keyPath is a delimited string of sub-dictionary names. Key path elements are produced by calling TfStringTokenize() with keyPath and delimiters. Create sub-dictionaries as necessary according to the path elements in keyPath. If keyPath identifies a full sub-dictionary, replace the entire sub-dictionary with value.

VT_API void VtDictionary::SetValueAtPath ( std::vector< std::string > const &  keyPath,
VtValue const &  value 
)

Set the value at keyPath to value. Create sub-dictionaries as necessary according to the path elements in keyPath. If keyPath identifies a full sub-dictionary, replace the entire sub-dictionary with value.

VT_API size_type VtDictionary::size ( ) const

Returns the size of the VtDictionary.

VT_API void VtDictionary::swap ( VtDictionary dict)

Swaps the contents of two VtDictionaries.

VtDictionary::TF_MALLOC_TAG_NEW ( "Vt"  ,
"VtDictionary"   
)

Friends And Related Function Documentation

size_t hash_value ( VtDictionary const &  dict)
friend

Definition at line 311 of file dictionary.h.

void swap ( VtDictionary lhs,
VtDictionary rhs 
)
friend

Definition at line 307 of file dictionary.h.


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