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

A map with string keys and VtValue values. More...

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)
 Returns a reference to the VtValue that is associated with a particular key. More...
 
VT_API size_type count (const std::string &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 const_iterator find (const std::string &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
 Return a pointer to the value at keyPath if one exists. More...
 
VT_API VtValue const * GetValueAtPath (std::vector< std::string > const &keyPath) const
 Return a pointer to the value at keyPath if one exists. More...
 
VT_API void SetValueAtPath (std::string const &keyPath, VtValue const &value, char const *delimiters=":")
 Set the value at keyPath to value. More...
 
VT_API void SetValueAtPath (std::vector< std::string > const &keyPath, VtValue const &value)
 Set the value at keyPath to value. More...
 
VT_API void EraseValueAtPath (std::string const &keyPath, char const *delimiters=":")
 Erase the value at keyPath. More...
 
VT_API void EraseValueAtPath (std::vector< std::string > const &keyPath)
 Erase the value at keyPath. More...
 

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 61 of file dictionary.h.

Constructor & Destructor Documentation

VtDictionary ( )
inline

Creates an empty VtDictionary.

Definition at line 159 of file dictionary.h.

VtDictionary ( int  size)
inlineexplicit

Creates an empty VtDictionary with at least size buckets.

Definition at line 162 of file dictionary.h.

VtDictionary ( _InputIterator  f,
_InputIterator  l 
)
inline

Creates a VtDictionary with a copy of a range.

Definition at line 166 of file dictionary.h.

VT_API VtDictionary ( VtDictionary const &  other)

Creates a copy of the supplied VtDictionary.

VT_API VtDictionary ( VtDictionary &&  other)
default

Creates a new VtDictionary by moving the supplied VtDictionary.

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

Creates a new VtDictionary from a braced initializer list.

Member Function Documentation

VT_API iterator begin ( )

Returns an iterator pointing to the beginning of the VtDictionary.

VT_API const_iterator begin ( ) const

Returns an iterator pointing to the beginning of the VtDictionary.

VT_API void clear ( )

Erases all of the elements.

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

Counts the number of elements whose key is key.

VT_API bool empty ( ) const

true if the VtDictionary's size is 0.

VT_API iterator end ( )

Returns an iterator pointing to the end of the VtDictionary.

VT_API const_iterator end ( ) const

Returns an iterator pointing to the end of the VtDictionary.

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

Erases the element whose key is key.

VT_API void erase ( iterator  it)

Erases the element pointed to by it.

VT_API void erase ( iterator  f,
iterator  l 
)

Erases all elements in a range.

VT_API void 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 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 find ( const std::string &  key)

Finds an element whose key is key.

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

Finds an element whose key is key.

VT_API VtValue const* 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* 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.

void insert ( _InputIterator  f,
_InputIterator  l 
)
inline

Inserts a range into the VtDictionary.

Definition at line 267 of file dictionary.h.

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

Inserts obj into the VtDictionary.

VT_API VtDictionary& operator= ( VtDictionary const &  other)

Copy assignment operator.

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

Move assignment operator.

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

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

VT_API void 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 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 size ( ) const

Returns the size of the VtDictionary.

VT_API void swap ( VtDictionary dict)

Swaps the contents of two VtDictionaries.


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