Loading...
Searching...
No Matches
VdfConnectorMap< Connector > Class Template Reference

Maps names to inputs or outputs (a.k.a. More...

#include <connectorMap.h>

Public Types

using key_type = TfToken
 
using mapped_type = Connector *
 
using value_type = _Pair
 
using pointer = _Pair *
 
using reference = _Pair &
 
using const_reference = const _Pair &
 
using size_type = typename _Vector::size_type
 
using difference_type = typename _Vector::difference_type
 
using iterator = typename _Vector::const_iterator
 
using reverse_iterator = typename _Vector::const_reverse_iterator
 
using const_iterator = typename _Vector::const_iterator
 
using const_reverse_iterator = typename _Vector::const_reverse_iterator
 

Public Member Functions

 VdfConnectorMap ()=default
 Creates an empty vector.
 
 VdfConnectorMap (size_t n)
 Creates a map that can hold at least n elements without reallocation.
 
 ~VdfConnectorMap ()
 Destroys all connector instances owned by this map.
 
const_iterator begin () const
 Returns a const_iterator pointing to the beginning of the map.
 
const_iterator end () const
 Returns a const_iterator pointing to the end of the map.
 
const_reverse_iterator rbegin () const
 Returns a const_reverse_iterator pointing to the beginning of the map.
 
const_reverse_iterator rend () const
 Returns a const_reverse_iterator pointing to the end of the map.
 
size_type size () const
 Returns the size of the map.
 
bool empty () const
 Returns true if the map's size is 0.
 
void swap (VdfConnectorMap &x)
 Swaps the contents of this map with x.
 
void clear ()
 Erases all of the elements.
 
const_iterator find (const key_type &k) const
 Finds the element with key k.
 
bool operator== (const VdfConnectorMap &x) const
 Test two maps for equality.
 
bool operator!= (const VdfConnectorMap &x) const
 
template<typename... Args>
std::pair< const_iterator, bool > try_emplace (const key_type &k, Args &&... args)
 Inserts an element with key k if one does not already exist.
 
template<typename... Args>
std::pair< typename VdfConnectorMap< Connector >::const_iterator, bool > try_emplace (const key_type &k, Args &&... args)
 

Friends

void swap (VdfConnectorMap &lhs, VdfConnectorMap &rhs)
 Swaps the contents of lhs and rhs.
 

Detailed Description

template<typename Connector>
class VdfConnectorMap< Connector >

Maps names to inputs or outputs (a.k.a.

connectors.)

VdfConnectorMap is intended to map TfToken names to VdfInput or VdfOutput pointers on behalf of VdfNode. The map is responsible for constructing Connector objects and retains ownership of the pointed-to objects.

Only a limited subset of the associative container interface is provided and lookup is implemented with a linear search. This can be efficient for storing small numbers of elements, especially when key comparison is quick.

Definition at line 34 of file connectorMap.h.

Member Typedef Documentation

◆ const_iterator

using const_iterator = typename _Vector::const_iterator

Definition at line 51 of file connectorMap.h.

◆ const_reference

using const_reference = const _Pair&

Definition at line 46 of file connectorMap.h.

◆ const_reverse_iterator

using const_reverse_iterator = typename _Vector::const_reverse_iterator

Definition at line 52 of file connectorMap.h.

◆ difference_type

using difference_type = typename _Vector::difference_type

Definition at line 48 of file connectorMap.h.

◆ iterator

using iterator = typename _Vector::const_iterator

Definition at line 49 of file connectorMap.h.

◆ key_type

using key_type = TfToken

Definition at line 41 of file connectorMap.h.

◆ mapped_type

using mapped_type = Connector*

Definition at line 42 of file connectorMap.h.

◆ pointer

using pointer = _Pair*

Definition at line 44 of file connectorMap.h.

◆ reference

using reference = _Pair&

Definition at line 45 of file connectorMap.h.

◆ reverse_iterator

using reverse_iterator = typename _Vector::const_reverse_iterator

Definition at line 50 of file connectorMap.h.

◆ size_type

using size_type = typename _Vector::size_type

Definition at line 47 of file connectorMap.h.

◆ value_type

using value_type = _Pair

Definition at line 43 of file connectorMap.h.

Constructor & Destructor Documentation

◆ VdfConnectorMap() [1/2]

VdfConnectorMap ( )
default

Creates an empty vector.

◆ VdfConnectorMap() [2/2]

VdfConnectorMap ( size_t  n)
inlineexplicit

Creates a map that can hold at least n elements without reallocation.

Definition at line 61 of file connectorMap.h.

◆ ~VdfConnectorMap()

~VdfConnectorMap ( )
inline

Destroys all connector instances owned by this map.

Definition at line 66 of file connectorMap.h.

Member Function Documentation

◆ begin()

const_iterator begin ( ) const
inline

Returns a const_iterator pointing to the beginning of the map.

Definition at line 71 of file connectorMap.h.

◆ clear()

void clear

Erases all of the elements.

This destroys all connector instances owned by this map.

Definition at line 176 of file connectorMap.h.

◆ empty()

bool empty ( ) const
inline

Returns true if the map's size is 0.

Definition at line 96 of file connectorMap.h.

◆ end()

const_iterator end ( ) const
inline

Returns a const_iterator pointing to the end of the map.

Definition at line 76 of file connectorMap.h.

◆ find()

VdfConnectorMap< Connector >::const_iterator find ( const key_type k) const

Finds the element with key k.

Definition at line 149 of file connectorMap.h.

◆ operator!=()

bool operator!= ( const VdfConnectorMap< Connector > &  x) const
inline

Definition at line 124 of file connectorMap.h.

◆ operator==()

bool operator== ( const VdfConnectorMap< Connector > &  x) const
inline

Test two maps for equality.

Definition at line 120 of file connectorMap.h.

◆ rbegin()

const_reverse_iterator rbegin ( ) const
inline

Returns a const_reverse_iterator pointing to the beginning of the map.

Definition at line 81 of file connectorMap.h.

◆ rend()

const_reverse_iterator rend ( ) const
inline

Returns a const_reverse_iterator pointing to the end of the map.

Definition at line 86 of file connectorMap.h.

◆ size()

size_type size ( ) const
inline

Returns the size of the map.

Definition at line 91 of file connectorMap.h.

◆ swap()

void swap ( VdfConnectorMap< Connector > &  x)
inline

Swaps the contents of this map with x.

Definition at line 101 of file connectorMap.h.

◆ try_emplace() [1/2]

std::pair< const_iterator, bool > try_emplace ( const key_type k,
Args &&...  args 
)

Inserts an element with key k if one does not already exist.

If a new element is inserted, a new Connector is constructed by forwarding args. Otherwise, args are not moved.

Returns a pair of (const_iterator, bool) where the iterator points to the element in the map for key \k and bool is true if a new element was inserted.

◆ try_emplace() [2/2]

std::pair< typename VdfConnectorMap< Connector >::const_iterator, bool > try_emplace ( const key_type k,
Args &&...  args 
)

Definition at line 164 of file connectorMap.h.

Friends And Related Function Documentation

◆ swap

void swap ( VdfConnectorMap< Connector > &  lhs,
VdfConnectorMap< Connector > &  rhs 
)
friend

Swaps the contents of lhs and rhs.

Definition at line 106 of file connectorMap.h.


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