#include <cel_datatraits.h>
Static Public Attributes | |
| static const CopyPolicy | copyPolicy = byConstructor |
| static const StoragePolicy | storagePolicy = notToBeStored |
| static const bool | isPOD = false |
CEL_DEFINE_DATATRAITS(YourClass, byMemcpy, byCopyMemory);
Definition at line 76 of file cel_datatraits.h.
const CopyPolicy Celartem::DataTraits< T >::copyPolicy = byConstructor [static] |
copyPolicy determines how to copy the instances of the type; this should be one of the CopyPolicy enumeration.
In general, the values of int, long, ... types are easily copied using std::memcpy since they are simple enough. The types of int, long, double are called 'POD' (Plain Old Data) and if SimpleArray holds the array consist of such types, it should be copied by std::memcpy instead of copy constructors because the graceful C++ oriented copy sequence has very large overhead and it would impact the performance of your code. In such case, copyPolicy should be set to byMemcpy . In the other case, the instances should not be copied using std::memcpy but by copy-constructor, copyPolicy should be byConstructor . The special case, when your structure does not permit use of copy-constructor, you can set copyPolicy to noCopy and you can use SimpleArray with such classes/structs. This scheme is introduced because there're demands of arraying Synchronization objects such as Mutex, Semaphore and Event. The Mutex, Semaphore, Event classes provided in this library have their own DataTraits, which set copyPolicy to noCopy. Although the SimpleArray holds any of such objects can be created normally, they could not be resized since the resize method may require the copy of the instances.
The following types are copied using byMemcpy by default:
Definition at line 121 of file cel_datatraits.h.
const StoragePolicy Celartem::DataTraits< T >::storagePolicy = notToBeStored [static] |
storagePolicy determines how to store the data into the storage. ; this should be one of the StoragePolicy enumeration.
The default is notToBeStored. This does not allow serialization/deserialization of the instances of the type.
For POD types, the default is bySwapCopyBytes.
Definition at line 133 of file cel_datatraits.h.
const bool Celartem::DataTraits< T >::isPOD = false [static] |
isPOD determines whether this type is Plain-Old-Types; POD or not.
The default is false.
Definition at line 140 of file cel_datatraits.h.