47 #ifndef _MIRA_ARRAY_H_ 48 #define _MIRA_ARRAY_H_ 65 namespace serialization {
85 PlainArray(T* iData, uint32 iSize) : data(iData), size(iSize) {}
87 PlainArray(
const PlainArray& other) : data(other.data), size(other.size) {}
89 PlainArray operator=(
const PlainArray& other) {
91 MIRA_THROW(XIO,
"Cannot assign array with different size");
93 for(uint32 i=0; i<size; ++i)
94 data[i]=other.data[i];
98 template<
typename Reflector>
101 typedef PlainArray<T> PlainArray;
106 uint32 getSizeInBytes()
const {
107 return size *
sizeof(value_type);
110 bool empty()
const {
return size==0; }
112 T* begin() {
return data; }
113 T* end() {
return data+size; }
129 Array(T* iData, uint32 iSize) : array(iData, iSize) {}
131 template<
typename Reflector>
134 uint32 count = array.size;
135 typedef Array<T>
Array;
143 template<
typename Reflector>
147 typedef Array<T>
Array;
151 if(array.size!=count)
152 MIRA_THROW(XIO,
"Cannot reflect the collection with " << count <<
153 " items into an array of size " << array.size);
161 bool empty()
const {
return array.empty(); }
163 T* begin() {
return array.begin(); }
164 T* end() {
return array.end(); }
174 template <
typename T>
175 class IsObjectTrackable<serialization::PlainArray<T>> :
public std::false_type {};
177 template <
typename T,
typename SerializerTag>
178 class IsTransparentSerializable<serialization::PlainArray<T>,SerializerTag> :
public std::true_type {};
180 template <
typename T>
181 class IsObjectTrackable<serialization::
Array<T>> :
public std::false_type {};
183 template <
typename T>
184 class IsCollection<serialization::
Array<T>> :
public std::true_type {};
Macro for iterating over all elements in a container.
void reflectWrite(Reflector &r, Buffer< T, Allocator > &c)
Specialization of the non-intrusive reflect for Buffer.
Definition: Buffer.h:581
json_spirit::mArray Array
A representation of an array (vector) in JSON.
Definition: JSON.h:190
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
#define MIRA_SPLIT_REFLECT_MEMBER
Macro that insert a class member reflect() method just splitting reflection into a reflectRead() and ...
Definition: SplitReflect.h:209
Provides type trait that indicates whether a type should be serialized "transparently".
Provides MIRA_SPLIT_REFLECT macros.
Provides type trait that indicates whether pointer/object tracking should be enabled for a certain ty...
#define MIRA_THROW(ex, msg)
Macro for throwing an exception.
Definition: Exception.h:82
ReflectCollectionCount and ReflectCollectionItems to be specialized for certain Reflectors.
Contains the base interface of all Reflectors, Serializers, etc.
static void reflect(Reflector &r, uint32 &ioCount)
Definition: ReflectCollection.h:71
#define MIRA_REFLECT_CALL(ReflectorType, reflector, context, COMMAND)
Whenever a reflection function calls another function that is independently maintained, the call should be marked to the reflector.
Definition: ReflectorMacros.h:109
void reflect(Reflector &r, LogRecord &record)
Non-intrusive reflector for LogRecord.
Definition: LoggingCore.h:137
Provides type trait that indicates whether a type is a collection.
static void reflect(Reflector &r, Container &c)
Definition: ReflectCollection.h:89
void reflectRead(Reflector &r, Buffer< T, Allocator > &c)
Specialization of the non-intrusive reflect for Buffer.
Definition: Buffer.h:565