47 #ifndef _MIRA_STLCOLLECTIONS_H_ 48 #define _MIRA_STLCOLLECTIONS_H_ 61 namespace serialization {
79 template<
typename Reflector,
typename Container>
83 typedef typename Container::value_type
type;
85 static void reflect(Reflector& r, Container& c)
88 uint32 count = c.size();
89 static const std::string contextCount = typeName<Container>() +
" ReflectCollectionCount";
93 static const std::string contextItems = typeName<Container>() +
" ReflectCollectionItems";
112 template<
typename Reflector,
typename Container>
116 typedef typename Container::value_type
type;
118 static void reflect(Reflector& r, Container& c)
124 static const std::string contextCount = typeName<Container>() +
" ReflectCollectionCount";
131 static const std::string contextItems = typeName<Container>() +
" ReflectCollectionItems";
137 template<
typename Reflector,
typename Container>
140 typedef typename Container::value_type
type;
142 static void reflect(Reflector& r, Container& c)
146 foreach(
const type&
cv, c)
179 template<
typename Reflector,
typename Container>
182 static void reflect(Reflector& r, Container& c)
185 uint32 count = c.size();
186 static const std::string contextCount = typeName<Container>() +
" ReflectCollectionCount";
190 static const std::string contextItems = typeName<Container>() +
" ReflectReadSetItems";
196 template<
typename Reflector,
typename Container>
199 typedef typename Container::value_type
type;
202 static void reflect(Reflector& r, Container& c, uint32 count)
207 for(uint32
id=0;
id<count; ++id)
219 hint = c.insert(hint, v);
235 template<
typename Reflector,
typename Container>
238 static void reflect(Reflector& r, Container& c)
244 static const std::string contextCount = typeName<Container>() +
" ReflectCollectionCount";
248 static const std::string contextItems = typeName<Container>() +
" ReflectWriteSetItems";
257 template<
typename Derived,
typename key_type,
typename value_type>
270 key_type& nonconstkey =
const_cast<key_type&
>(
mP.first);
272 r.member(
"First", nonconstkey,
"");
277 r.property(
"Second", nonconstv,
"");
280 const value_type&
mP;
284 template<
typename Derived,
typename Container>
286 const typename Container::value_type& p)
288 typedef typename Container::key_type key_type;
289 typedef typename Container::value_type value_type;
295 template<
typename Derived,
typename Container>
309 r.member(
"First", key,
"");
316 r.property(
"Second", it->second,
"");
323 template<
typename Derived,
typename Container>
325 Container& c,
typename Container::iterator& ioHint)
327 typedef typename Container::iterator iterator;
328 typedef typename Container::value_type value_type;
329 typedef typename Container::key_type key_type;
330 typedef typename Container::mapped_type mapped_type;
332 std::string nameId =
"["+
toString(
id)+
"]";
333 std::string itemNameWithId = std::string(itemName)+nameId;
338 template<
typename Reflector,
typename Container>
343 static void reflect(Reflector& r, Container& c)
349 reflectReadMapPair<Reflector, Container>(r,
"item", id, p);
372 template<
typename Reflector,
typename Container>
375 static void reflect(Reflector& r, Container& c)
378 uint32 count = c.size();
379 static const std::string contextCount = typeName<Container>() +
" ReflectCollectionCount";
383 static const std::string contextItems = typeName<Container>() +
" ReflectReadMapItems";
390 template<
typename Reflector,
typename Container>
395 static void reflect(Reflector& r, Container& c, uint32 count)
400 for(uint32
id=0;
id<count; ++id)
422 template<
typename Reflector,
typename Container>
425 static void reflect(Reflector& r, Container& c)
431 static const std::string contextCount = typeName<Container>() +
" ReflectCollectionCount";
435 static const std::string contextItems = typeName<Container>() +
" ReflectWriteMapItems";
This object can use object tracking internally, but the object tracking system's state remains unchan...
Definition: ReflectControlFlags.h:82
Type trait that indicates whether a type is a pointer type or a shared pointer.
Definition: IsPointerOrSharedPointer.h:69
Macro for iterating over all elements in a container.
Provides type trait that indicates whether a type is a pointer type or a shared pointer.
Container::iterator iterator
Definition: StlCollections.h:393
Container::value_type type
Definition: StlCollections.h:199
reflects generic associative containers like map, multimap, hash_map
Definition: StlCollections.h:373
Definition: StlCollections.h:258
static void reflect(Reflector &r, Container &c)
Definition: StlCollections.h:142
void reflect(Derived &r)
Definition: StlCollections.h:264
Reflects generic set containers like set, multiset.
Definition: StlCollections.h:180
void reflectWriteMapPair(Derived &r, const char *itemName, const char *keyName, uint32 id, Container &c, typename Container::iterator &ioHint)
Definition: StlCollections.h:324
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
iterator & mHint
Definition: StlCollections.h:320
Container & mC
Definition: StlCollections.h:319
Container::value_type value_type
Definition: StlCollections.h:300
Deserializes generic set containers like set, multiset.
Definition: StlCollections.h:236
Definition: StlCollections.h:296
static void reflect(Reflector &r, Container &c)
Definition: StlCollections.h:85
static void reflect(Reflector &r, Container &c)
Definition: StlCollections.h:118
static void reflect(Reflector &r, Container &c)
Definition: StlCollections.h:182
Definition: StlCollections.h:339
const value_type & mP
Definition: StlCollections.h:280
static void reflect(Reflector &r, Container &c)
Definition: StlCollections.h:238
Reflects generic sequential containers like vectors, list, deque (Read Only / Serialization) ...
Definition: StlCollections.h:80
static void reflect(Reflector &r, Container &c, uint32 count)
Definition: StlCollections.h:202
std::string toString(const T &value, int precision=-1)
Converts any data type to string (the data type must support the stream << operator).
Definition: ToString.h:256
ReflectCollectionCount and ReflectCollectionItems to be specialized for certain Reflectors.
Container::value_type type
Definition: StlCollections.h:83
Reflects generic sequencial containers like vectors, list, deque (Write Only / Deserialization) ...
Definition: StlCollections.h:113
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
static void reflect(Reflector &r, Container &c)
Definition: StlCollections.h:343
static void reflect(Reflector &r, Container &c, uint32 count)
Definition: StlCollections.h:395
WriteMapPairHelper(Container &c, iterator &hint)
Definition: StlCollections.h:303
ReadMapPairHelper(const value_type &p)
Definition: StlCollections.h:262
Container::key_type key_type
Definition: StlCollections.h:298
Container::value_type value_type
Definition: StlCollections.h:341
Definition: StlCollections.h:197
value_type::second_type mapped_type
Definition: StlCollections.h:260
static void reflect(Reflector &r, Container &c)
Definition: ReflectCollection.h:89
void reflectReadMapPair(Derived &r, const char *itemName, uint32 id, const typename Container::value_type &p)
Definition: StlCollections.h:285
static void reflect(Reflector &r, Container &c)
Definition: StlCollections.h:425
Container::iterator iterator
Definition: StlCollections.h:82
Definition: StlCollections.h:138
Container::iterator iterator
Definition: StlCollections.h:301
Container::iterator iterator
Definition: StlCollections.h:115
#define MIRA_MEMBER_WITH_ID(reflector, name, id, var,...)
Macro that should be used to reflect a member if a manually specified ID is used. ...
Definition: ReflectorInterface.h:1003
void reflect(Derived &r)
Definition: StlCollections.h:306
static void reflect(Reflector &r, Container &c)
Definition: StlCollections.h:375
Container::mapped_type mapped_type
Definition: StlCollections.h:299
Container::iterator iterator
Definition: StlCollections.h:200
Container::value_type type
Definition: StlCollections.h:116
Definition: StlCollections.h:391
reflects generic associative containers like map, multimap, hash_map
Definition: StlCollections.h:423
Container::value_type type
Definition: StlCollections.h:140