47 #ifndef _MIRA_SPLITREFLECT_H_ 48 #define _MIRA_SPLITREFLECT_H_ 51 #include <boost/mpl/eval_if.hpp> 52 #include <boost/mpl/identity.hpp> 60 template <
typename Derived>
61 class ReflectorInterface;
67 template<
typename DerivedReflector,
typename T>
76 static_assert(
sizeof(T)==0,
"You must implement reflectRead() " 77 "if you use the MIRA_SPLIT_REFLECT macro");
80 template<
typename DerivedReflector,
typename T>
89 static_assert(
sizeof(T)==0,
"You must implement reflectWrite() " 90 "if you use the MIRA_SPLIT_REFLECT macro");
93 struct GlobalReflectRead {
94 template<
typename Reflector,
typename T>
96 Reflector& reflector =
static_cast<Reflector&
>(r);
101 struct GlobalReflectWrite {
102 template<
typename Reflector,
typename T>
103 static void invoke(Reflector& r, T& value) {
108 template<
typename GlobalReflectReadOrWrite,
typename Reflector,
typename T>
109 inline void splitReflectInvoke(Reflector& r, T& value)
111 GlobalReflectReadOrWrite::invoke(r, value);
125 template<
typename Reflector,
typename T>
128 Reflector& reflector =
static_cast<Reflector&
>(r);
129 typedef typename boost::mpl::eval_if<
130 typename Reflector::isReadOnly,
131 boost::mpl::identity<GlobalReflectRead>,
132 boost::mpl::identity<GlobalReflectWrite>
137 static const std::string context = typeName<T>() +
" splitReflect";
140 (splitReflectInvoke<rwtype>(reflector, value)));
154 #define MIRA_SPLIT_REFLECT(Type) \ 155 template<typename Reflector> \ 156 void reflect(mira::ReflectorInterface<Reflector>& r, Type& value) \ 158 splitReflect(r, value); \ 161 template<
typename __reflectReadOrWrite,
typename Reflector,
typename Class>
164 __reflectReadOrWrite::invoke(r, This);
169 namespace serialization {
171 template<
typename Reflector>
175 template<
typename Class>
182 template<
typename Class>
188 typedef typename boost::mpl::eval_if<
189 typename Reflector::isReadOnly,
190 boost::mpl::identity<__reflectRead>,
191 boost::mpl::identity<__reflectWrite>
210 template<
typename Reflector,
typename Class>
213 Reflector& reflector =
static_cast<Reflector&
>(r);
220 static const std::string context = typeName<Class>() +
" splitReflectMember";
223 (splitReflectMemberInvoke<rwtype>(reflector, This)));
238 #define MIRA_SPLIT_REFLECT_MEMBER \ 239 template<typename Reflector> \ 240 void reflect(mira::ReflectorInterface<Reflector>& r) \ 242 Reflector& reflector = static_cast<Reflector&>(r); \ 243 typedef typename serialization::SplitReflectMemberHelper<Reflector>::rwtype rwtype; \ 249 typedef typename std::remove_reference<decltype(*this)>::type splitType; \ 251 static const std::string context = typeName<splitType>() + " MIRA_SPLIT_REFLECT_MEMBER"; \ 253 MIRA_REFLECT_CALL(Reflector, reflector, context.c_str(), \ 254 (splitReflectMemberInvoke<rwtype>(reflector, this))); \ void reflectWrite(Reflector &r, Buffer< T, Allocator > &c)
Specialization of the non-intrusive reflect for Buffer.
Definition: Buffer.h:581
static void invoke(Reflector &r, Class *This)
Definition: SplitReflect.h:176
void reflectWrite(Reflector &r)
Implementation of class member reflection.
Definition: Class.h:762
Macros for use with reflectors.
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Class object which supports some kind of class reflection.
Definition: Class.h:97
Get compiler and platform independent typenames.
void splitReflectMember(mira::ReflectorInterface< Reflector > &r, Class *This)
This method is used to split reflection into a reflectRead() and reflectWrite() method.
Definition: SplitReflect.h:211
This is the public interface of all reflectors that are able to visit a class' reflect() method...
Definition: ReflectorInterface.h:111
MIRA_SPLIT_REFLECT_MEMBER void reflectRead(Reflector &r)
Implementation of class member reflection.
#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:115
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
void splitReflectMemberInvoke(Reflector &r, Class *This)
Definition: SplitReflect.h:162
Definition: SplitReflect.h:172
boost::mpl::eval_if< typename Reflector::isReadOnly, boost::mpl::identity< __reflectRead >, boost::mpl::identity< __reflectWrite > >::type rwtype
Definition: SplitReflect.h:192
Definition: SplitReflect.h:181
static void invoke(Reflector &r, Class *This)
Definition: SplitReflect.h:183
void reflectRead(Reflector &r, Buffer< T, Allocator > &c)
Specialization of the non-intrusive reflect for Buffer.
Definition: Buffer.h:565
Definition: SplitReflect.h:174