17#ifndef AGXDATA_FORMAT_H
18#define AGXDATA_FORMAT_H
31# pragma warning(disable:4100)
102 const agx::Name& getImplementationName()
const;
107 size_t getSize()
const;
142 virtual void copyElements(
void *buffer,
const void *source,
size_t numElements)
const;
184 friend class TypeManager;
207 Format *getElementFormat();
208 const Format *getElementFormat()
const;
213 using Format::copyElement;
214 using Format::moveElement;
216 template <
typename T>
219 template <
typename T>
260 virtual void initializeElement(
void *
element,
const void *value)
const override;
261 virtual void initializeElements(
void *buffer,
const void *value,
size_t numElements)
const override;
262 virtual void constructElement(
void *
element)
const override;
263 virtual void constructElements(
void *buffer,
size_t numElements)
const override;
264 virtual void destroyElement(
void *
element)
const override;
265 virtual void destroyElements(
void *buffer,
size_t numElements)
const override;
266 virtual void copyElement(
void *
target,
const void *source)
const override;
267 virtual void copyElements(
void *
target,
const void *source,
size_t numElements)
const override;
268 virtual void moveElement(
void *
target,
void *source)
const override;
269 virtual void moveElements(
void *
target,
void *source,
size_t numElements)
const override;
281 HashSetFormat(Format *elementFormat);
283 virtual void initializeElement(
void *element,
const void *value)
const override;
284 virtual void initializeElements(
void *buffer,
const void *value,
size_t numElements)
const override;
285 virtual void constructElement(
void *element)
const override;
286 virtual void constructElements(
void *buffer,
size_t numElements)
const override;
287 virtual void destroyElement(
void *element)
const override;
288 virtual void destroyElements(
void *buffer,
size_t numElements)
const override;
289 virtual void copyElement(
void *target,
const void *source)
const override;
290 virtual void copyElements(
void *target,
const void *source,
size_t numElements)
const override;
291 virtual void moveElement(
void *target,
void *source)
const override;
292 virtual void moveElements(
void *target,
void *source,
size_t numElements)
const override;
293 virtual void swapElements(
void *element1,
void *element2)
const override;
296 virtual ~HashSetFormat();
329 template <
typename T>
338 virtual void initializeElements(
void *buffer,
const void *value,
size_t numElements)
const override;
342 virtual void destroyElements(
void *buffer,
size_t numElements)
const override;
344 virtual void copyElements(
void *
target,
const void *source,
size_t numElements)
const override;
346 virtual void moveElements(
void *
target,
void *source,
size_t numElements)
const override;
364 typedef void (*FormatConstructorFn)();
377 FormatConstructorFn m_constructor;
378 bool m_isInitialized;
382 template <
size_t NUM_BYTES>
435 CallbackType m_callbackReal32;
436 CallbackType m_callbackReal64;
437 CallbackType m_callbackInt8;
438 CallbackType m_callbackUInt8;
439 CallbackType m_callbackInt16;
440 CallbackType m_callbackUInt16;
441 CallbackType m_callbackInt32;
442 CallbackType m_callbackUInt32;
443 CallbackType m_callbackInt64;
444 CallbackType m_callbackUInt64;
445 CallbackType m_callbackBool;
455 template<
typename T>
459 std::cout <<
"Format: Hit typeless callDispatch() for C++ type " <<
typeid(T).name() << std::endl;
535 agxVerifyN(
padding < stride,
"Format: A format cannot be all padding, or contain more padding than total memory usage. "
536 "stride: %d, padding: %d.", stride,
padding );
538 "Format: The format \'%s\' have already been registered.", format->
fullName().c_str() );
546 #define AGX_FORMAT_INITIALIZER(_Name) \
547 static void AGX_CONCAT(__agx_createFormat, __LINE__)(); \
548 static agxData::FormatInitializer AGX_CONCAT(__agx_formatInitializer, __LINE__)(_Name, &AGX_CONCAT(__agx_createFormat, __LINE__)); \
549 static void AGX_CONCAT(__agx_createFormat, __LINE__)()
571# pragma warning(disable: 4800)
574 template <
typename TargetT,
typename SourceT>
577 for (
size_t i = 0; i < numElements; ++i)
581 template <
typename T>
584 ::memcpy(
target, source, numElements *
sizeof(T));
607 ::new((T *)
element) T(*(
const T *)value);
610 template <class T, typename std::enable_if<!std::is_copy_constructible<T>::value>::type* =
nullptr >
614 ::new((T *)element) T();
618 template <
typename T>
622 template <
typename T>
630 template <
typename T>
643 template <
typename T>
646 for (
size_t i = 0; i < numElements; ++i) {
656 for (
size_t i = 0; i < numElements; ++i)
662 template <
typename T>
669 template <
typename T>
672 for (
size_t i = 0; i < numElements; ++i)
673 ::new(&((T *)buffer)[i]) T();
676 template <
typename T>
682 ::memset(
element, 0xFF,
sizeof(T));
686 template <
typename T>
689 for (
size_t i = 0; i < numElements; ++i)
690 ((T *)buffer)[i].~T();
693 if (buffer !=
nullptr) {
694 ::memset(buffer, 0xFF, numElements *
sizeof(T));
700 template <
typename T>
703 *(T *)
target = *(
const T *)source;
706 template <
typename T>
709 for (
size_t i = 0; i < numElements; ++i)
710 ((T *)
target)[i] = ((
const T *)source)[i];
715 template <
typename T>
730 template <
typename T>
743 source._setBuffer(
nullptr);
744 source._setCapacity(0);
755 template <
typename T>
764 template <
typename T>
774 template <
typename KeyT,
typename DataT>
784 template <
typename T>
790 template <
typename T>
793 for (
size_t i = 0; i < numElements; ++i)
797 template <
typename T>
800 for (
size_t i = 0; i < numElements; ++i)
805 template <
typename T>
814 #pragma warning( pop )
#define AGX_DECLARE_POINTER_TYPES(type)
List of callbacks used by the primitive type handling by user code.
void callBool(agx::UInt32 stride, agx::UInt32 padding)
agx::Callback2< agx::UInt32, agx::UInt32 > CallbackType
void callInt16(agx::UInt32 stride, agx::UInt32 padding)
void callInt32(agx::UInt32 stride, agx::UInt32 padding)
void callUInt32(agx::UInt32 stride, agx::UInt32 padding)
void callUInt8(agx::UInt32 stride, agx::UInt32 padding)
CallbackList(CallbackType callbackReal32, CallbackType callbackReal64, CallbackType callbackInt8, CallbackType callbackUInt8, CallbackType callbackInt16, CallbackType callbackUInt16, CallbackType callbackInt32, CallbackType callbackUInt32, CallbackType callbackInt64, CallbackType callbackUInt64, CallbackType callbackBool)
void callUInt16(agx::UInt32 stride, agx::UInt32 padding)
void callReal32(agx::UInt32 stride, agx::UInt32 padding)
void callReal64(agx::UInt32 stride, agx::UInt32 padding)
void callUInt64(agx::UInt32 stride, agx::UInt32 padding)
void callInt8(agx::UInt32 stride, agx::UInt32 padding)
void callInt64(agx::UInt32 stride, agx::UInt32 padding)
Only use as member allocated variable.
Abstract representation of a value.
Templated callback with two arguments.
Inheritance with partial specialization due to bug with ref_ptr containers.
iterator insert(const KeyT &key, const ValueT value)
Insert a key/value pair into the 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.
agx::String fullName() const
#define agxVerifyN(expr, format,...)
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
Contains classes for low level data storage for AGX.
void GenericCopyFunction(void *target, const void *source, size_t numElements)
void GenericTransformFunction(void *targetBuffer, const void *sourceBuffer, size_t numElements)
void AGXCORE_EXPORT Swap3x32Function(void *target, const void *source, size_t numElements)
void AGXCORE_EXPORT registerTransformer(TransformFunction transformer, const Format *targetFormat, const Format *sourceFormat)
Register a format-format transformer.
void AGXCORE_EXPORT Swap32Function(void *target, const void *source, size_t numElements)
void AGXCORE_EXPORT Swap3x64Function(void *target, const void *source, size_t numElements)
bool callDispatch< agx::UInt8 >(CallbackList *callbackList, agx::UInt32 stride, agx::UInt32 padding)
AGXCORE_EXPORT TypeCallerTable __agx_typeCallerTable
void AGXCORE_EXPORT Swap16Function(void *target, const void *source, size_t numElements)
bool callDispatch< agx::Int64 >(CallbackList *callbackList, agx::UInt32 stride, agx::UInt32 padding)
void FormatTdoInitializeElement(T *element, const T *value)
bool callDispatch< agx::Int16 >(CallbackList *callbackList, agx::UInt32 stride, agx::UInt32 padding)
bool callDispatch< agx::Bool >(CallbackList *callbackList, agx::UInt32 stride, agx::UInt32 padding)
bool callDispatch< agx::Int32 >(CallbackList *callbackList, agx::UInt32 stride, agx::UInt32 padding)
bool callDispatch< agx::Int8 >(CallbackList *callbackList, agx::UInt32 stride, agx::UInt32 padding)
AGXCORE_EXPORT Type * getType(const agx::String &name)
void AGXCORE_EXPORT Swap2x64Function(void *target, const void *source, size_t numElements)
bool callDispatch(CallbackList *, agx::UInt32, agx::UInt32)
TransformFunction AGXCORE_EXPORT getTransformer(const Format *targetFormat, const Format *sourceFormat)
Get a specific transformer.
void AGXCORE_EXPORT Swap8Function(void *target, const void *source, size_t numElements)
Standard swap functions.
bool callDispatch< agx::UInt32 >(CallbackList *callbackList, agx::UInt32 stride, agx::UInt32 padding)
bool callDispatch< agx::UInt64 >(CallbackList *callbackList, agx::UInt32 stride, agx::UInt32 padding)
bool callDispatch< agx::Real64 >(CallbackList *callbackList, agx::UInt32 stride, agx::UInt32 padding)
void AGXCORE_EXPORT Swap8x64Function(void *target, const void *source, size_t numElements)
bool callDispatch< agx::UInt16 >(CallbackList *callbackList, agx::UInt32 stride, agx::UInt32 padding)
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
void AGXCORE_EXPORT Swap6x64Function(void *target, const void *source, size_t numElements)
void AGXCORE_EXPORT Swap6x32Function(void *target, const void *source, size_t numElements)
bool callDispatch< agx::Real32 >(CallbackList *callbackList, agx::UInt32 stride, agx::UInt32 padding)
void AGXCORE_EXPORT Swap2x32Function(void *target, const void *source, size_t numElements)
void AGXCORE_EXPORT Swap4x64Function(void *target, const void *source, size_t numElements)
void(* TransformFunction)(void *target, const void *source, size_t numElements)
void AGXCORE_EXPORT Swap64Function(void *target, const void *source, size_t numElements)
void AGXCORE_EXPORT Swap4x32Function(void *target, const void *source, size_t numElements)
void AGXCORE_EXPORT Swap8x32Function(void *target, const void *source, size_t numElements)
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
void swap(agx::Name &lhs, agx::Name &rhs)