libqi-api  release-2.5.3-2016-11-18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
structtypeinterface.hxx
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Copyright (C) 2013 Aldebaran Robotics
4 ** See COPYING for the license
5 */
6 
7 #ifndef _QITYPE_DETAIL_TYPETUPLE_HXX_
8 #define _QITYPE_DETAIL_TYPETUPLE_HXX_
9 
10 #include <boost/type_traits.hpp>
11 #include <boost/utility/enable_if.hpp>
12 #include <qi/type/fwd.hpp>
14 #include <qi/preproc.hpp>
15 
16 namespace qi
17 {
18  namespace detail {
19 
21  std::map<std::string, ::qi::AnyValue>& fields,
22  const std::vector<std::tuple<std::string, TypeInterface*>>& missing,
23  const char** which=0, int whichLength=0);
24 
25  template <typename T>
27  {
28  static bool convertFrom(StructTypeInterface* type,
29  std::map<std::string, qi::AnyValue>& fields,
30  const std::vector<std::tuple<std::string, TypeInterface*>>& missing)
31  {
32  return missing.empty();
33  }
34  static bool convertTo(const std::map<std::string, qi::AnyReference>& dropFields)
35  {
36  return dropFields.empty();
37  }
38  };
39  template <typename T>
41  {
42  static bool convertTo(StructTypeInterface* type,
43  std::map<std::string, ::qi::AnyValue>& fields,
44  const std::vector<std::tuple<std::string, TypeInterface*>>& missing)
45  {
46  return missing.empty();
47  }
48  static bool convertFrom(const std::map<std::string, qi::AnyReference>& dropFields)
49  {
50  return dropFields.empty();
51  }
52  };
53 
54  template <typename T>
56  {
57  static bool convertFrom(StructTypeInterface* type,
58  std::map<std::string, qi::AnyValue>& fields,
59  const std::vector<std::tuple<std::string, TypeInterface*>>& missing,
60  const std::map<std::string, qi::AnyReference>& dropfields)
61  {
64  }
65  static bool convertTo(StructTypeInterface* type,
66  std::map<std::string, ::qi::AnyValue>& fields,
67  const std::vector<std::tuple<std::string, TypeInterface*>>& missing,
68  const std::map<std::string, ::qi::AnyReference>& dropfields)
69  {
72  }
73  };
74 
78 #define QI_TYPE_STRUCT_EXTENSION_ADDED_FIELDS(name, ...) \
79  namespace qi \
80  { \
81  namespace detail \
82  { \
83  template <> \
84  struct StructVersioningDelegateAddFields<name> \
85  { \
86  static bool convertFrom(StructTypeInterface* type, \
87  std::map<std::string, ::qi::AnyValue>& fields, \
88  const std::vector<std::tuple<std::string, TypeInterface*>>& missing) \
89  { \
90  static const char* which[] = {__VA_ARGS__}; \
91  const int count = sizeof(which) / sizeof(char*); \
92  return fillMissingFieldsWithDefaultValues(fields, missing, which, count); \
93  } \
94  static bool convertTo(const std::map<std::string, ::qi::AnyReference>& todrop) \
95  { \
96  static const char* which[] = {__VA_ARGS__}; \
97  const int count = sizeof(which) / sizeof(char*); \
98  for (const auto& field : todrop) \
99  if (std::find(which, which + count, field.first) == which + count) \
100  return false; \
101  return true; \
102  } \
103  }; \
104  } \
105  }
106 
109 #define QI_TYPE_STRUCT_EXTENSION_DROPPED_FIELDS(name, ...) \
110  namespace qi \
111  { \
112  namespace detail \
113  { \
114  template <> \
115  struct StructVersioningDelegateDropFields<name> \
116  { \
117  static bool convertTo(StructTypeInterface* type, \
118  std::map<std::string, ::qi::AnyValue>& fields, \
119  const std::vector<std::tuple<std::string, TypeInterface*>>& missing) \
120  { \
121  static const char* which[] = {__VA_ARGS__}; \
122  const int count = sizeof(which) / sizeof(char*); \
123  return fillMissingFieldsWithDefaultValues(fields, missing, which, count); \
124  } \
125  static bool convertFrom(const std::map<std::string, ::qi::AnyReference>& todrop) \
126  { \
127  static const char* which[] = {__VA_ARGS__}; \
128  const int count = sizeof(which) / sizeof(char*); \
129  for (const auto& field : todrop) \
130  if (std::find(which, which + count, field.first) == which + count) \
131  return false; \
132  return true; \
133  } \
134  }; \
135  } \
136  }
137 
152 #define QI_TYPE_STRUCT_EXTENSION_CONVERT_HANDLERS(name, fromHandler, toHandler) \
153  namespace qi \
154  { \
155  namespace detail \
156  { \
157  template <> \
158  struct StructVersioningDelegate<name> \
159  { \
160  static bool convertFrom(StructTypeInterface* type, \
161  std::map<std::string, ::qi::AnyValue>& fields, \
162  const std::vector<std::tuple<std::string, TypeInterface*>>& missing, \
163  const std::map<std::string, ::qi::AnyReference>& dropfields) \
164  { \
165  return fromHandler(fields, missing, dropfields); \
166  } \
167  static bool convertTo(StructTypeInterface* type, \
168  std::map<std::string, ::qi::AnyValue>& fields, \
169  const std::vector<std::tuple<std::string, TypeInterface*>>& missing, \
170  const std::map<std::string, ::qi::AnyReference>& dropfields) \
171  { \
172  return toHandler(fields, missing, dropfields); \
173  } \
174  }; \
175  } \
176  }
177 
178  //keep only the class name. (remove :: and namespaces)
179  QI_API std::string normalizeClassName(const std::string &name);
180 
181  template<typename T> void setFromStorage(T& ref, void* storage)
182  {
183  ref = *(T*)typeOf<T>()->ptrFromStorage(&storage);
184  }
185 
186  /* Helpers around accessors
187  */
188  template<typename A> TypeInterface* fieldType(A)
189  {
190  static TypeInterface* res = 0;
191  QI_ONCE(res = qi::typeOf<typename detail::Accessor<A>::value_type>());
192  return res;
193  }
194 
195  template<typename C, typename A> void* fieldStorage(C* inst, A accessor)
196  {
197  return fieldType(accessor)->initializeStorage(
198  (void*)&detail::Accessor<A>::access(inst, accessor));
199  }
200 
201  template<typename C, typename A>
202  typename detail::Accessor<A>::value_type&
203  fieldValue(C* instance, A accessor, void** data)
204  {
205  using T = typename detail::Accessor<A>::value_type;
206  return *(T*)fieldType(accessor)->ptrFromStorage(data);
207  }
208  }
209 }
210 
211 #define __QI_TYPE_STRUCT_DECLARE(name, extra) \
212  namespace qi \
213  { \
214  template <> \
215  struct TypeImpl<name> : public ::qi::StructTypeInterface \
216  { \
217  public: \
218  using ClassType = name; \
219  TypeImpl(); \
220  std::vector<::qi::TypeInterface*> memberTypes() override; \
221  std::vector<std::string> elementsName() override; \
222  std::string className() override; \
223  void* get(void* storage, unsigned int index) override; \
224  void set(void** storage, unsigned int index, void* valStorage) override; \
225  virtual bool convertFrom(std::map<std::string, ::qi::AnyValue>& fields, \
226  const std::vector<std::tuple<std::string, TypeInterface*>>& missing, \
227  const std::map<std::string, ::qi::AnyReference>& dropfields) override; \
228  virtual bool convertTo(std::map<std::string, ::qi::AnyValue>& fields, \
229  const std::vector<std::tuple<std::string, TypeInterface*>>& missing, \
230  const std::map<std::string, ::qi::AnyReference>& dropfields) override; \
231  extra using Impl = ::qi::DefaultTypeImplMethods<name, ::qi::TypeByPointerPOD<name>>; \
232  _QI_BOUNCE_TYPE_METHODS(Impl); \
233  }; \
234  }
235 
236 #define __QI_TUPLE_TYPE(_, what, field) res.push_back(::qi::typeOf(ptr->field));
237 #define __QI_TUPLE_GET(_, what, field) if (i == index) return ::qi::typeOf(ptr->field)->initializeStorage(&ptr->field); i++;
238 #define __QI_TUPLE_SET(_, what, field) if (i == index) ::qi::detail::setFromStorage(ptr->field, valueStorage); i++;
239 #define __QI_TUPLE_FIELD_NAME(_, what, field) res.push_back(BOOST_PP_STRINGIZE(QI_DELAY(field)));
240 #define __QI_TYPE_STRUCT_IMPLEMENT(name, inl, onSet, ...) \
241  namespace qi \
242  { \
243  inl TypeImpl<name>::TypeImpl() \
244  { \
245  ::qi::registerStruct(this); \
246  } \
247  inl std::vector<::qi::TypeInterface*> TypeImpl<name>::memberTypes() \
248  { \
249  name* ptr = 0; \
250  std::vector<::qi::TypeInterface*> res; \
251  QI_VAARGS_APPLY(__QI_TUPLE_TYPE, _, __VA_ARGS__); \
252  return res; \
253  } \
254  inl void* TypeImpl<name>::get(void* storage, unsigned int index) \
255  { \
256  unsigned int i = 0; \
257  name* ptr = (name*)ptrFromStorage(&storage); \
258  QI_VAARGS_APPLY(__QI_TUPLE_GET, _, __VA_ARGS__); \
259  return 0; \
260  } \
261  inl void TypeImpl<name>::set(void** storage, unsigned int index, void* valueStorage) \
262  { \
263  unsigned int i = 0; \
264  name* ptr = (name*)ptrFromStorage(storage); \
265  QI_VAARGS_APPLY(__QI_TUPLE_SET, _, __VA_ARGS__); \
266  onSet \
267  } \
268  inl std::vector<std::string> TypeImpl<name>::elementsName() \
269  { \
270  std::vector<std::string> res; \
271  QI_VAARGS_APPLY(__QI_TUPLE_FIELD_NAME, _, __VA_ARGS__); \
272  return res; \
273  } \
274  inl std::string TypeImpl<name>::className() \
275  { \
276  return ::qi::detail::normalizeClassName(BOOST_PP_STRINGIZE(name)); \
277  } \
278  inl bool TypeImpl<name>::convertFrom(std::map<std::string, ::qi::AnyValue>& fields, \
279  const std::vector<std::tuple<std::string, TypeInterface*>>& missing, \
280  const std::map<std::string, ::qi::AnyReference>& dropfields) \
281  { \
282  return ::qi::detail::StructVersioningDelegate<name>::convertFrom(this, fields, missing, dropfields); \
283  } \
284  inl bool TypeImpl<name>::convertTo(std::map<std::string, ::qi::AnyValue>& fields, \
285  const std::vector<std::tuple<std::string, TypeInterface*>>& missing, \
286  const std::map<std::string, ::qi::AnyReference>& dropfields) \
287  { \
288  return ::qi::detail::StructVersioningDelegate<name>::convertTo(this, fields, missing, dropfields); \
289  } \
290  }
291 
293 #define QI_STRUCT_HELPER(name, func) (name, func, FUNC)
294 #define QI_STRUCT_FIELD(name, field) (name, field, FIELD)
296 
297 // construct pointer-to accessor from free-function
298 #define __QI_STRUCT_ACCESS_FUNC(fname, field) &field
299 // construct pointer-to-accessor from member function/field
300 #define __QI_STRUCT_ACCESS_FIELD(fname, field) &ClassType::field
301 
302 // invoke the correct __QI_STRUCT_ACCESS_ macro using type
303 #define __QI_STRUCT_ACCESS_BOUNCE2(name, accessor, type) \
304  QI_CAT(__QI_STRUCT_ACCESS_, type)(name, accessor)
305 
306 // bounce with default value FIELD for argument 3
307 #define __QI_STRUCT_ACCESS_BOUNCE1(x, y) \
308  __QI_STRUCT_ACCESS_BOUNCE2(x, y, FIELD)
309 
310 // arg-count overload, bounce to __QI_STRUCT_ACCESS_BOUNCE<N>
311 #define __QI_STRUCT_ACCESS_BOUNCE(...) \
312  QI_CAT(__QI_STRUCT_ACCESS_BOUNCE, QI_LIST_VASIZE((__VA_ARGS__)))(__VA_ARGS__)
313 
314 // accept (name, accessor, type) and (name, accessor) defaulting type to field
315 #define __QI_STRUCT_ACCESS(tuple) QI_DELAY(__QI_STRUCT_ACCESS_BOUNCE)tuple
316 
317 
318 #define __QI_ATUPLE_TYPE(_, what, field) res.push_back(::qi::detail::fieldType(__QI_STRUCT_ACCESS(field)));
319 #define __QI_ATUPLE_GET(_, what, field) if (i == index) return ::qi::detail::fieldStorage(ptr, __QI_STRUCT_ACCESS(field)); i++;
320 #define __QI_ATUPLE_FIELD_NAME(_, what, field) res.push_back(QI_PAIR_FIRST(field));
321 #define __QI_ATUPLE_FROMDATA(idx, what, field) ::qi::detail::fieldValue(ptr, __QI_STRUCT_ACCESS(field), const_cast<void**>(&data[idx]))
322 #define __QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR_IMPLEMENT(name, inl, onSet, ...) \
323  namespace qi \
324  { \
325  inl TypeImpl<name>::TypeImpl() \
326  { \
327  ::qi::registerStruct(this); \
328  } \
329  inl std::vector<::qi::TypeInterface*> TypeImpl<name>::memberTypes() \
330  { \
331  std::vector<::qi::TypeInterface*> res; \
332  QI_VAARGS_APPLY(__QI_ATUPLE_TYPE, name, __VA_ARGS__); \
333  return res; \
334  } \
335  \
336  inl void* TypeImpl<name>::get(void* storage, unsigned int index) \
337  { \
338  unsigned int i = 0; \
339  name* ptr = (name*)ptrFromStorage(&storage); \
340  QI_VAARGS_APPLY(__QI_ATUPLE_GET, name, __VA_ARGS__); \
341  return 0; \
342  } \
343  \
344  inl void TypeImpl<name>::set(void** storage, unsigned int index, void* valueStorage) \
345  { \
346  throw std::runtime_error("single-field set not implemented"); \
347  } \
348  \
349  inl void TypeImpl<name>::set(void** storage, const std::vector<void*>& data) \
350  { \
351  name* ptr = (name*)ptrFromStorage(storage); \
352  *ptr = name(QI_VAARGS_MAP(__QI_ATUPLE_FROMDATA, name, __VA_ARGS__)); \
353  } \
354  \
355  inl std::vector<std::string> TypeImpl<name>::elementsName() \
356  { \
357  std::vector<std::string> res; \
358  QI_VAARGS_APPLY(__QI_ATUPLE_FIELD_NAME, _, __VA_ARGS__); \
359  return res; \
360  } \
361  inl std::string TypeImpl<name>::className() \
362  \
363  { \
364  return ::qi::detail::normalizeClassName(BOOST_PP_STRINGIZE(name)); \
365  } \
366  inl bool TypeImpl<name>::convertFrom(std::map<std::string, ::qi::AnyValue>& fields, \
367  const std::vector<std::tuple<std::string, TypeInterface*>>& missing, \
368  const std::map<std::string, ::qi::AnyReference>& dropfields) \
369  { \
370  return false; \
371  } \
372  inl bool TypeImpl<name>::convertTo(std::map<std::string, ::qi::AnyValue>& fields, \
373  const std::vector<std::tuple<std::string, TypeInterface*>>& missing, \
374  const std::map<std::string, ::qi::AnyReference>& dropfields) \
375  { \
376  return false; \
377  } \
378  }
379 
381 #define QI_TYPE_STRUCT_PRIVATE_ACCESS(name) \
382 friend class qi::TypeImpl<name>;
383 
393 #define QI_TYPE_STRUCT(name, ...) \
394  QI_TYPE_STRUCT_DECLARE(name) \
395  __QI_TYPE_STRUCT_IMPLEMENT(name, inline, , __VA_ARGS__)
396 
400 #define QI_TYPE_STRUCT_EX(name, onSet, ...) \
401  QI_TYPE_STRUCT_DECLARE(name) \
402  __QI_TYPE_STRUCT_IMPLEMENT(name, inline, onSet, __VA_ARGS__)
403 
404 #define QI_TYPE_STRUCT_IMPLEMENT(name, ...) \
405  __QI_TYPE_STRUCT_IMPLEMENT(name, , , __VA_ARGS__)
406 
429 #define QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR(name, ...) \
430  __QI_TYPE_STRUCT_DECLARE(name, \
431  void set(void** storage, const std::vector<void*>&) override;) \
432  __QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR_IMPLEMENT(name, inline, , __VA_ARGS__)
433 
440 #define QI_TYPE_STRUCT_REGISTER(name, ...) \
441 namespace _qi_ { \
442  QI_TYPE_STRUCT(name, __VA_ARGS__) \
443 } \
444 QI_TYPE_REGISTER_CUSTOM(name, _qi_::qi::TypeImpl<name>)
445 
451 #define QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR_REGISTER(name, ...) \
452 namespace _qi_ { \
453  QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR(name, __VA_ARGS__); \
454 } \
455 QI_TYPE_REGISTER_CUSTOM(name, _qi_::qi::TypeImpl<name>)
456 
464 #define QI_TYPE_STRUCT_BOUNCE(name, bounceTo, conversion) \
465 namespace qi { \
466 template<> class TypeImpl<name>: public ::qi::StructTypeInterfaceBouncer<name, bounceTo> \
467 { \
468 public: \
469  void adaptStorage(void** storage, void** adapted) \
470  { \
471  name* ptr = (name*)ptrFromStorage(storage); \
472  bounceTo * tptr = conversion(ptr); \
473  *adapted = bounceType()->initializeStorage(tptr); \
474  } \
475  std::string className() \
476  { \
477  return ::qi::detail::normalizeClassName(BOOST_PP_STRINGIZE(name)); \
478  } \
479 };}
480 
484 #define QI_TYPE_STRUCT_BOUNCE_REGISTER(name, bounceTo, conversion) \
485 namespace _qi_ { \
486  QI_TYPE_STRUCT_BOUNCE(name, bounceTo, conversion); \
487 } \
488 QI_TYPE_REGISTER_CUSTOM(name, _qi_::qi::TypeImpl<name>)
489 
490 
491 
492 namespace qi {
493  template<typename T, typename TO>
495  {
496  public:
498  {
499  static TypeInterface* result = 0;
500  if (!result)
501  result = typeOf<TO>();
502  return static_cast<StructTypeInterface*>(result);
503  }
504 
505  virtual void adaptStorage(void** storage, void** adapted) = 0;
506 
508  std::vector<TypeInterface*> memberTypes() override
509  {
510  return bounceType()->memberTypes();
511  }
512 
513  void* get(void* storage, unsigned int index) override
514  {
515  void* astorage;
516  adaptStorage(&storage, &astorage);
517  return bounceType()->get(astorage, index);
518  }
519 
520  std::vector<void*> get(void* storage) override
521  {
522  void* astorage;
523  adaptStorage(&storage, &astorage);
524  return bounceType()->get(astorage);
525  }
526 
527  void set(void** storage, const std::vector<void*>& vals) override
528  {
529  void* astorage;
530  adaptStorage(storage, &astorage);
531  bounceType()->set(&astorage, vals);
532  }
533 
534  void set(void** storage, unsigned int index, void* valStorage) override
535  {
536  void* astorage;
537  adaptStorage(storage, &astorage);
538  bounceType()->set(&astorage, index, valStorage);
539  }
540 
541  std::vector<std::string> elementsName() override
542  {
543  return bounceType()->elementsName();
544  }
545 
546  virtual bool convertFrom(std::map<std::string, qi::AnyValue>& fields,
547  const std::vector<std::tuple<std::string, TypeInterface*>>& missing,
548  const std::map<std::string, qi::AnyReference>& dropfields) override
549  {
550  return bounceType()->convertFrom(fields, missing, dropfields);
551  }
552 
553  virtual bool convertTo(std::map<std::string, qi::AnyValue>& fields,
554  const std::vector<std::tuple<std::string, TypeInterface*>>& missing,
555  const std::map<std::string, qi::AnyReference>& dropfields) override
556  {
557  return bounceType()->convertTo(fields, missing, dropfields);
558  }
559 
561  };
562 
563  template<typename F, typename S>
564  class TypeImpl<std::pair<F, S> >: public StructTypeInterface
565  {
566  public:
568  using BackendType = typename std::pair<F, S>;
570  {
571  _memberTypes.push_back(typeOf<F>());
572  _memberTypes.push_back(typeOf<S>());
573  }
574  std::vector<TypeInterface*> _memberTypes;
575 
576  std::vector<TypeInterface*> memberTypes() override { return _memberTypes;}
577  void* get(void* storage, unsigned int index) override
578  {
579  BackendType* ptr = (BackendType*)ptrFromStorage(&storage);
580  // Will work if F or S are references
581  if (!index)
582  return typeOf<F>()->initializeStorage(const_cast<void*>((void*)&ptr->first));
583  else
584  return typeOf<S>()->initializeStorage(const_cast<void*>((void*)&ptr->second));
585  }
586  void set(void** storage, unsigned int index, void* valStorage) override
587  {
588  BackendType* ptr = (BackendType*)ptrFromStorage(storage);
589  const std::vector<TypeInterface*>& types = _memberTypes;
590 
591 
592  // FIXME cheating, we do not go through TypeInterface of S and F for copy
593  // because typeerasure does not expose the interface
594  if (!index)
595  detail::TypeTraitCopy<typename boost::remove_const<F>::type, true>::copy(const_cast<void*>((void*)&ptr->first), types[0]->ptrFromStorage(&valStorage));
596  else
597  detail::TypeTraitCopy<typename boost::remove_const<S>::type, true>::copy(const_cast<void*>((void*)&ptr->second), types[1]->ptrFromStorage(&valStorage));
598  }
599  _QI_BOUNCE_TYPE_METHODS(Methods);
600  };
601 
602 }
603 #endif // _QITYPE_DETAIL_TYPETUPLE_HXX_
virtual void * ptrFromStorage(void **)=0
void set(void **storage, const std::vector< void * > &vals) override
Set all the fields of the struct (copies the values given in the vector)
void setFromStorage(T &ref, void *storage)
#define QI_API
Definition: api.hpp:33
std::vector< TypeInterface * > memberTypes() override
DefaultTypeImplMethods< T, TypeByPointerPOD< T >> Methods
static bool convertFrom(StructTypeInterface *type, std::map< std::string, qi::AnyValue > &fields, const std::vector< std::tuple< std::string, TypeInterface * >> &missing, const std::map< std::string, qi::AnyReference > &dropfields)
static bool convertFrom(const std::map< std::string, qi::AnyReference > &dropFields)
virtual bool convertTo(std::map< std::string, qi::AnyValue > &fields, const std::vector< std::tuple< std::string, TypeInterface * >> &missing, const std::map< std::string, qi::AnyReference > &dropfields) override
virtual bool convertFrom(std::map< std::string,::qi::AnyValue > &fields, const std::vector< std::tuple< std::string, TypeInterface * >> &missing, const std::map< std::string,::qi::AnyReference > &dropfields)
Fill missing fields caused by conversion from a different struct. Return whether fill succeeded...
bool fillMissingFieldsWithDefaultValues(std::map< std::string,::qi::AnyValue > &fields, const std::vector< std::tuple< std::string, TypeInterface * >> &missing, const char **which=0, int whichLength=0)
virtual std::vector< TypeInterface * > memberTypes()=0
detail::Accessor< A >::value_type & fieldValue(C *instance, A accessor, void **data)
std::vector< TypeInterface * > memberTypes() override
#define _QI_BOUNCE_TYPE_METHODS(Bounce)
Implement all methods of Type as bouncers to Bouncer.
Definition: typeimpl.hxx:275
std::vector< TypeInterface * > _memberTypes
void * ptrFromStorage(void **s) override
Definition: typeimpl.hxx:294
static bool convertTo(StructTypeInterface *type, std::map< std::string,::qi::AnyValue > &fields, const std::vector< std::tuple< std::string, TypeInterface * >> &missing, const std::map< std::string,::qi::AnyReference > &dropfields)
#define QI_ONCE(code)
Execute code once, parallel calls are blocked until code finishes.
Definition: atomic.hpp:317
virtual std::vector< void * > get(void *storage)
Get all the fields storages of the struct (not a copy)
virtual std::vector< std::string > elementsName()
Get the names of the fields of the struct.
void set(void **storage, unsigned int index, void *valStorage) override
Set the fields of the struct at index (copies the value given)
void * initializeStorage(void *ptr=0) override
Definition: typeimpl.hxx:294
virtual void adaptStorage(void **storage, void **adapted)=0
StructTypeInterface * bounceType()
TypeInterface * typeOf()
Definition: type.hxx:94
void * fieldStorage(C *inst, A accessor)
TypeInterface * fieldType(A)
virtual void set(void **storage, const std::vector< void * > &)
Set all the fields of the struct (copies the values given in the vector)
void set(void **storage, unsigned int index, void *valStorage) override
Set the fields of the struct at index (copies the value given)
virtual bool convertTo(std::map< std::string,::qi::AnyValue > &fields, const std::vector< std::tuple< std::string, TypeInterface * >> &missing, const std::map< std::string,::qi::AnyReference > &dropfields)
Fill missing fields caused by conversion to a different struct. Return whether fill succeeded...
static bool convertTo(StructTypeInterface *type, std::map< std::string,::qi::AnyValue > &fields, const std::vector< std::tuple< std::string, TypeInterface * >> &missing)
static bool convertFrom(StructTypeInterface *type, std::map< std::string, qi::AnyValue > &fields, const std::vector< std::tuple< std::string, TypeInterface * >> &missing)
std::string normalizeClassName(const std::string &name)
typename std::pair< F, S > BackendType
std::vector< std::string > elementsName() override
Get the names of the fields of the struct.
virtual bool convertFrom(std::map< std::string, qi::AnyValue > &fields, const std::vector< std::tuple< std::string, TypeInterface * >> &missing, const std::map< std::string, qi::AnyReference > &dropfields) override
virtual void * initializeStorage(void *ptr=0)=0
static bool convertTo(const std::map< std::string, qi::AnyReference > &dropFields)