36 template <
typename DataT,
typename HashT = HashFn<DataT> >
82 if (
this == &other ) {
86 m_vector = other.m_vector;
87 m_hash = other.m_hash;
122 return m_vector.
size();
130 return m_vector.
empty();
147 template<
typename T2 >
153 if (it != m_hash.
end())
156 m_vector[it->second] = data;
157 return &m_vector[it->second];
181 template<
typename T2 >
199 template<
typename OldDataT,
typename NewDataT >
204 auto oldIt = m_hash.
find( oldData );
205 if ( oldIt == m_hash.
end() )
208 size_t index = oldIt->second;
209 m_vector[ index ] = newData;
210 m_hash.
erase( oldIt );
211 m_hash.
insert( newData, index );
213 return begin() + index;
224 template<
typename T2 >
240 template<
typename T2 >
246 if (it == m_hash.
end())
249 return &m_vector[it->second];
259 template<
typename T2 >
265 if (it == m_hash.
end())
269 return &m_vector[it->second];
280 return m_vector.
begin();
290 return m_vector.
begin();
320 return m_vector.
end();
329 return m_vector.
end();
339 return m_vector.
rend(); }
347 return m_vector.
rend();
374 return m_vector[m_vector.
size()-1];
380 inline const DataT&
back()
const
383 return m_vector[m_vector.
size()-1];
396 template<
typename T2 >
402 if (it == m_hash.
end())
488 inline const DataT&
at(
size_t index)
const
490 return m_vector.
at(index);
499 inline DataT&
at(
size_t index)
501 return m_vector.
at(index);
554 for(; it != m_vector.
end(); ++it)
588 return removeElements.
size();
596 return m_vector.
size() == m_hash.
size();
599 void erase(
typename HashType::iterator it )
601 size_t idx = it->second;
606 if (m_vector.
size() > 1 && idx != (m_vector.
size()-1))
612 m_vector[idx] = lastElement;
618 m_hash.
insert( lastElement, idx );
ClearPolicy
agxData::Values from this enumeration is passed to the subclasses' 'clear' method in order to control...
@ SHRINK_BUFFER
Buffer is deallocated and replaced by an newly allocated empty buffer.
@ MAINTAIN_BUFFER
Buffer is maintained (normal stl behavior).
@ SHRINK_BUFFER_AVERAGED
Buffer is shrunk if a smoothing average (which is updated each clear call) goes below a threshold.
iterator insert(const KeyT &key, const ValueT value)
Insert a key/value pair into the hash table.
bool contains(const KeyT &k) const
Check if the hash table contains a key/value pair for the given key.
iterator end()
Iterator marking end of hash table.
bool erase(const KeyT &key)
Erase an element from the hash table.
void clear(int policy=SHRINK_BUFFER_AVERAGED)
Remove all elements.
void reserve(size_t num_elems)
Make room for this many elements in the hash table.
iterator find(const KeyT &key)
Find a key/value pair in the hash table given a key.
Inheritance with partial specialization due to bug with ref_ptr containers.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
const DataT & back() const
void reserve(size_t size)
Reserve capacity in the hash table.
DataT & operator[](size_t i)
Access an element in the vector using an index.
size_t purge(T purger)
Purge the hash set.
bool contains(const T2 &key) const
Hash search for the data in the container.
const VectorType & vector() const
DataT & at(size_t index)
Access an element in the vector using an index.
VectorType::const_reverse_iterator const_reverse_iterator
const_iterator end() const
iterator find(const T2 &key)
Perform a hash search for a given key.
HashTable< DataT, size_t, HashT > HashType
const_iterator find(const T2 &key) const
Perform a hash search for a given key.
void clear(ClearPolicy policy=SHRINK_BUFFER_AVERAGED)
Remove all elements.
VectorType::reverse_iterator reverse_iterator
const_iterator begin() const
const_reverse_iterator rbegin() const
bool erase(const iterator &it)
Erase an element using an iterator.
reverse_iterator rbegin()
SetVector(const ContainerType &other)
Copy constructor.
iterator push_back(const T2 &data)
Insert a data element in to the end of the container.
bool empty() const
Return true if the container is empty.
const DataT & front() const
iterator insert(const T2 &data)
Insert a data element in to the end of the container.
const HashType & table() const
size_t size() const
Return the number of inserted elements.
Vector< DataT > VectorType
iterator replace(const OldDataT &oldData, const NewDataT &newData)
Replace data in set vector.
ContainerType & operator=(const ContainerType &other)
Assignment operator.
VectorType::const_iterator const_iterator
const DataT & const_reference
bool erase(const T2 &key)
Erase an element from the container.
const DataT & operator[](size_t i) const
Access an element in the vector using an index.
SetVector< DataT, HashT > ContainerType
VectorType::iterator iterator
const DataT & at(size_t index) const
Access an element in the vector using an index.
const_reverse_iterator rend() const
void clear(ClearPolicy policy=SHRINK_BUFFER_AVERAGED)
Remove all elements, optionally with maintained buffer allocation.
reverse_iterator rbegin()
T & at(size_t index) const
const DataT * const_iterator
void reserve(size_t size)
Reserve capacity in the vector.
void push_back(const T2 &value)
std::reverse_iterator< iterator > reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
The agx namespace contains the dynamics/math part of the AGX Dynamics API.