17#ifndef AGXDATA_TYPE2_H
18#define AGXDATA_TYPE2_H
41 #define AGX_TYPE_NAME_MAX_LENGTH 1023
124 template <
typename T>
127 template <
typename T>
133 Format *getDefaultFormat();
134 const Format *getDefaultFormat()
const;
155 template <
typename T>
168 template <
typename T>
173 Type *type = getType<T>();
179 #define AGX_TYPE_BINDING(_Type, _Name) \
183 struct TypeBinding<_Type> \
185 static Type *getType() \
187 return agxData::getOrCreateType(_Name); \
192 #define AGX_TEMPLATED_TYPE_BINDING(_Type, _Name) \
195 template <typename T> \
196 struct TypeBinding< _Type<T> > \
198 static Type *getType() \
200 Format *format = agxData::getFormat<T>(); \
201 const agx::String& elementName = format->getName() == "default" ? format->getType()->getName().str() : format->fullName(); \
202 agx::String typeName = _Name "<" + elementName + ">"; \
203 Type *type = agxData::getOrCreateType(typeName); \
205 if (!type->getDefaultFormat()) \
206 type->addFormat(new FormatT< _Type<T> >("default"), true); \
212 template <typename T> \
213 struct FormatBinding< _Type<T> > \
215 static Format *getFormat() \
217 return getType< _Type<T> >()->getDefaultFormat(); \
233 return it == m_formats.
end() ? nullptr : it->second;
243 template <
typename T>
247 if (it->second->getImplementationName() ==
typeid(T).name())
253 template <
typename T>
256 return const_cast<Type *
>(
this)->getFormat<T>();
261 template <
typename T>
268 template <
typename T>
293 template <
typename T>
302 template <
typename T>
307 return getType<T*>()->getDefaultFormat();
312 template <>
AGX_FORCE_INLINE Format *getFormat<agx::String>() {
return agxData::getType<agx::String>()->getDefaultFormat(); }
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGX_TYPE_BINDING(_Type, _Name)
#define AGX_TEMPLATED_TYPE_BINDING(_Type, _Name)
Type(const agx::Name &name)
void addFormat(Format *format, bool isDefault=false)
Format * getFormat(const agx::Name &name)
const FormatTable & getFormats() const
void setDefaultFormat(Format *format)
Format * getDefaultFormat()
static agx::Model * ClassModel()
An agx::Device is an abstract representation of a device on which data can be stored and processed.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
iterator begin()
Iterator to first element in hash table.
iterator end()
Iterator marking end of 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.
A model is an abstract representation of the class of an agx::Object.
Representation of a name string.
const char * c_str() const
const agx::Name & getName() const
#define agxAssertN(expr, format,...)
Contains classes for low level data storage for AGX.
void printAllTypesAndFormats()
Print all types and formats to std::cout.
AGXCORE_EXPORT Format * getGenericStructFormat(size_t numBytes)
AGXCORE_EXPORT Type * getOrCreateType(const agx::String &name)
AGXCORE_EXPORT Format * getFormat(const agx::String &typeFormatName)
agx::HashTable< agx::Name, FormatRef > FormatTable
agx::HashVector< agx::Name, TypeRef > TypeTable
const TypeTable & getTypes()
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Type binding, templated type -> abstract type.