21 #ifndef AGX_HASHTABLECONTEXT_H 22 #define AGX_HASHTABLECONTEXT_H 31 # pragma warning(push) 32 # pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients 44 static AbstractHashTableComponent *load(TiXmlElement *eHashTable, Device *device);
47 AbstractHashTableComponent(
const agx::Name& name);
53 virtual ~AbstractHashTableComponent();
63 template <
typename KeyT,
typename DataT,
typename HashT = agx::HashFn<KeyT> >
64 class HashTableComponent :
public AbstractHashTableComponent
72 typedef QuadraticProbingHashTable<KeyT, DataT, HashT, agxData::BufferProxyAllocator> ImplementationType;
76 HashTableComponent(
const agx::Name& name);
79 void commitImplementation();
80 void updateImplementation();
83 ImplementationType& impl();
84 const ImplementationType& impl()
const;
88 HashTableComponent(
const agx::Name& name,
size_t numBytes);
91 virtual ~HashTableComponent();
94 ImplementationType m_implementation;
102 template <
typename KeyT,
typename DataT,
typename HashT>
103 HashTableComponent<KeyT, DataT, HashT>::HashTableComponent(
const agx::Name& name) : AbstractHashTableComponent(name)
105 this->addObject(&m_numFilled);
106 this->addObject(&m_maxProbeLength);
108 m_buckets =
new agxData::Buffer(
"buckets", agxData::getFormat<typename ImplementationType::Bucket>());
109 this->addObject(m_buckets);
111 m_implementation.allocator().setBuffer(m_buckets);
114 template <
typename KeyT,
typename DataT,
typename HashT>
115 HashTableComponent<KeyT, DataT, HashT>::HashTableComponent(
const agx::Name& name,
size_t numBytes) : AbstractHashTableComponent(name)
117 this->addObject(&m_numFilled);
118 this->addObject(&m_maxProbeLength);
121 this->addObject(m_buckets);
123 m_implementation.allocator().setBuffer(m_buckets);
127 template <
typename KeyT,
typename DataT,
typename HashT>
128 HashTableComponent<KeyT, DataT, HashT>::~HashTableComponent()
132 this->removeAllObjects();
135 template <
typename KeyT,
typename DataT,
typename HashT>
136 AGX_FORCE_INLINE typename HashTableComponent<KeyT, DataT, HashT>::ImplementationType& HashTableComponent<KeyT, DataT, HashT>::impl() {
return m_implementation; }
138 template <
typename KeyT,
typename DataT,
typename HashT>
139 AGX_FORCE_INLINE const typename HashTableComponent<KeyT, DataT, HashT>::ImplementationType& HashTableComponent<KeyT, DataT, HashT>::impl()
const {
return m_implementation; }
141 template <
typename KeyT,
typename DataT,
typename HashT>
142 void HashTableComponent<KeyT, DataT, HashT>::commitImplementation()
144 m_numFilled = m_implementation.m_size;
145 m_maxProbeLength = m_implementation.m_maxProbeLength;
147 m_implementation.allocator().commit();
150 template <
typename KeyT,
typename DataT,
typename HashT>
151 void HashTableComponent<KeyT, DataT, HashT>::updateImplementation()
153 m_implementation.allocator().update();
154 m_implementation.m_size = m_numFilled;
155 m_implementation.m_maxProbeLength = m_maxProbeLength;
163 # pragma warning(pop) A model is an abstract representation of the class of an agx::Object.
Representation of a name string.
Buffer is deallocated and replaced by an newly allocated empty buffer.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Abstract representation of a data buffer.
AGXCORE_EXPORT Format * getGenericStructFormat(size_t numBytes)
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()