libqi-api  2.4.3.28
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
object.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 _QI_TYPE_DETAIL_OBJECT_HXX_
8 #define _QI_TYPE_DETAIL_OBJECT_HXX_
9 
10 #include <boost/mpl/if.hpp>
11 
12 #include <qi/future.hpp>
14 #include <qi/type/typeobject.hpp>
17 #include <qi/type/metasignal.hpp>
18 #include <qi/type/metamethod.hpp>
19 #include <qi/type/metaobject.hpp>
20 
21 // Visual defines interface...
22 #ifdef interface
23 #undef interface
24 #endif
25 
26 namespace qi {
27 
28 class Empty {};
29 
33 #define genCall(n, ATYPEDECL, ATYPES, ADECL, AUSE, comma) \
34 template<typename T comma ATYPEDECL> \
35 Object<T> constructObject(ADECL) \
36 { \
37  return Object<T>(new T(AUSE)); \
38 }
40 #undef genCall
41 
42 namespace detail {
43 
44  typedef std::map<TypeInfo, boost::function<AnyReference(AnyObject)> >
47 
48  /* On ubuntu (and maybe other platforms), the linking is done by default with
49  * --as-needed.
50  * Proxy libraries constist only of static initialization functions which add
51  * the proxy factories to the global maps, thus there is no direct dependency
52  * between the program and the library (no function call whatsoever) and the
53  * dependency gets dropped by the linker.
54  * This class is specialized when including interfaces which have proxies
55  * and the function is defined in the .so to force a dependency.
56  */
57  template <typename T>
59  {
60  bool dummyCall() { return true; }
61  };
62 
63  // bounce to a genericobject obtained by (O*)this->asAnyObject()
64  /* Everything need to be const:
65  * anyobj.call bounces to anyobj.asObject().call, and the
66  * second would work on const object
67  */
68  template<typename O> class GenericObjectBounce
69  {
70  public:
71  const MetaObject &metaObject() const { return go()->metaObject(); }
72  inline qi::Future<AnyReference> metaCall(unsigned int method, const GenericFunctionParameters& params, MetaCallType callType = MetaCallType_Auto, Signature returnSignature=Signature()) const
73  {
74  return go()->metaCall(method, params, callType, returnSignature);
75  }
76  inline int findMethod(const std::string& name, const GenericFunctionParameters& parameters) const
77  {
78  return go()->findMethod(name, parameters);
79  }
80  inline qi::Future<AnyReference> metaCall(const std::string &nameWithOptionalSignature, const GenericFunctionParameters& params, MetaCallType callType = MetaCallType_Auto, Signature returnSignature=Signature()) const
81  {
82  return go()->metaCall(nameWithOptionalSignature, params, callType, returnSignature);
83  }
84  inline void metaPost(unsigned int event, const GenericFunctionParameters& params) const
85  {
86  return go()->metaPost(event, params);
87  }
88  inline void metaPost(const std::string &nameWithOptionalSignature, const GenericFunctionParameters &in) const
89  {
90  return go()->metaPost(nameWithOptionalSignature, in);
91  }
92  inline void post(const std::string& eventName,
101  {
102  return go()->post(eventName, p1, p2, p3, p4, p5, p6, p7, p8);
103  }
104  template <typename FUNCTOR_TYPE>
105  inline qi::FutureSync<SignalLink> connect(const std::string& eventName, FUNCTOR_TYPE callback,
106  MetaCallType threadingModel = MetaCallType_Auto) const
107  {
108  return go()->connect(eventName, callback, threadingModel);
109  }
110  inline qi::FutureSync<SignalLink> connect(const std::string &name, const SignalSubscriber& functor) const
111  {
112  return go()->connect(name, functor);
113  }
114  inline qi::FutureSync<SignalLink> connect(unsigned int signal, const SignalSubscriber& subscriber) const
115  {
116  return go()->connect(signal, subscriber);
117  }
118  // Cannot inline here, AnyObject not fully declared
119  qi::FutureSync<SignalLink> connect(unsigned int signal, AnyObject target, unsigned int slot) const;
121  {
122  return go()->disconnect(linkId);
123  }
124  template<typename T>
125  inline qi::FutureSync<T> property(const std::string& name) const
126  {
127  return go()->template property<T>(name);
128  }
129  template<typename T>
130  inline qi::FutureSync<void> setProperty(const std::string& name, const T& val) const
131  {
132  return go()->setProperty(name, val);
133  }
134  inline qi::FutureSync<AnyValue> property(unsigned int id) const
135  {
136  return go()->property(id);
137  }
138  inline qi::FutureSync<void> setProperty(unsigned int id, const AnyValue &val) const
139  {
140  return go()->setProperty(id, val);
141  }
143  {
144  return go()->executionContext().get();
145  }
146  inline bool isStatsEnabled() const
147  {
148  return go()->isStatsEnabled();
149  }
150  inline void enableStats(bool enable) const
151  {
152  return go()->enableStats(enable);
153  }
154  inline ObjectStatistics stats() const
155  {
156  return go()->stats();
157  }
158  inline void clearStats() const
159  {
160  return go()->clearStats();
161  }
162  inline bool isTraceEnabled() const
163  {
164  return go()->isTraceEnabled();
165  }
166  inline void enableTrace(bool enable)
167  {
168  return go()->enableTrace(enable);
169  }
170  inline void forceExecutionContext(boost::shared_ptr<qi::ExecutionContext> ec)
171  {
172  return go()->forceExecutionContext(ec);
173  }
174  #define genCall(n, ATYPEDECL, ATYPES, ADECL, AUSE, comma) \
175  template<typename R> qi::Future<R> async( \
176  const std::string& methodName comma \
177  QI_GEN_ARGSDECLSAMETYPE(n, qi::AutoAnyReference)) const { \
178  return go()->template async<R>(methodName comma AUSE); \
179  } \
180  template<typename R> R call( \
181  const std::string& methodName comma \
182  QI_GEN_ARGSDECLSAMETYPE(n, qi::AutoAnyReference)) const { \
183  return go()->template call<R>(methodName comma AUSE); \
184  }
185  QI_GEN(genCall)
186  #undef genCall
187 
188  private:
189  inline GenericObject* go() const
190  {
191  GenericObject* g = static_cast<const O*>(this)->asGenericObject();
192  if (!g)
193  throw std::runtime_error("This object is null");
194  return g;
195  }
196  };
197 
198 }
199 
210 template<typename T> class Object :
211  public detail::GenericObjectBounce<Object<T> >
212 {
213  // see qi::Future constructors below
214  struct None {
216  };
217 public:
218  Object();
219 
220  template<typename U> Object(const Object<U>& o);
221  template<typename U> void operator=(const Object<U>& o);
222  // Templates above do not replace default ctor or copy operator
223  Object(const Object& o);
224  void operator=(const Object& o);
225  // Disable the ctor taking future if T is Empty, as it would conflict with
226  // We use None to disable it. The method must be instantiable because when we
227  // export the class under windows, all functions are instanciated
228  // Future cast operator
229  typedef typename boost::mpl::if_<typename boost::is_same<T, Empty>::type, None, Object<Empty> >::type MaybeAnyObject;
230  Object(const qi::Future<MaybeAnyObject>& fobj);
232 
234 
240  Object(GenericObject* go);
241  Object(T* ptr);
242  Object(GenericObject* go, boost::function<void(GenericObject*)> deleter);
243  Object(T* ptr, boost::function<void(T*)> deleter);
245 
247  template<typename U> Object(GenericObject* go, boost::shared_ptr<U> other);
248  template<typename U> Object(boost::shared_ptr<U> other);
249  bool operator <(const Object& b) const;
250  template<typename U> bool operator !=(const Object<U>& b) const;
251  template<typename U> bool operator ==(const Object<U>& b) const;
252  operator bool() const;
253  operator Object<Empty>() const;
254 
255  boost::shared_ptr<T> asSharedPtr();
256 
257  T& asT();
258  const T& asT() const;
259  T* operator ->();
260  const T* operator->() const;
261 
262  T& operator *();
263  const T& operator *() const;
264  bool unique() const;
266  void reset();
267  unsigned use_count() const { return _obj.use_count();}
268 
270  // Check or obtain T interface, or throw
271  void checkT();
272  // no-op deletor callback
274  template<typename U>
275  static void keepReference(GenericObject* obj, boost::shared_ptr<U> ptr) {qiLogDebug("qi.object") << "AnyObject ptr holder deleter"; delete obj;}
276  static void noDeleteT(T*) {qiLogDebug("qi.object") << "AnyObject noop T deleter";}
277  static void noDelete(GenericObject*) {qiLogDebug("qi.object") << "AnyObject noop deleter";}
278  // deletor callback that deletes only the GenericObject and not the content
279  static void deleteGenericObjectOnly(GenericObject* obj) { qiLogDebug("qi.object") << "AnyObject GO deleter"; delete obj;}
280  template<typename U>
281  static void deleteGenericObjectOnlyAndKeep(GenericObject* obj, U) { qiLogDebug("qi.object") << "AnyObject GO-keep deleter";delete obj;}
282  static void deleteCustomDeleter(GenericObject* obj, boost::function<void(T*)> deleter)
283  {
284  qiLogDebug("qi.object") << "custom deleter";
285  deleter((T*)obj->value);
286  delete obj;
287  }
289 private:
290  friend class GenericObject;
291 
292  template <typename> friend class Object;
293  template <typename> friend class WeakObject;
294 
296  {
297  init(obj);
298  }
299 
300  void init(detail::ManagedObjectPtr obj);
301 
302  static void deleteObject(GenericObject* obj)
303  {
304  qiLogDebug("qi.object") << "deleteObject " << obj << " "
305  << obj->value << " " << obj->type->infoString();
306  obj->type->destroy(obj->value);
307  delete obj;
308  }
309 
310  /* Do not change this, Object<T> must be binary-equivalent to
311  * ManagedObjectPtr.
312  */
314 };
315 
316 template<typename T> class WeakObject
317 {
318 public:
320  template<typename U> WeakObject(const Object<U>& o)
321  : _ptr(o._obj) {}
322  Object<T> lock() { return Object<T>(_ptr.lock());}
323  boost::weak_ptr<GenericObject> _ptr;
324 };
326 
327 template<typename T> inline ObjectTypeInterface* Object<T>::interface()
328 {
329  TypeInterface* type = typeOf<T>();
330  if (type->kind() != TypeKind_Object)
331  {
332  std::stringstream err;
333  err << "Object<T> can only be used on registered object types. ("
334  << type->infoString() << ")(" << type->kind() << ')';
335  throw std::runtime_error(err.str());
336  }
337  ObjectTypeInterface* otype = static_cast<ObjectTypeInterface*>(type);
338  return otype;
339 }
340 
341 template<typename T> inline Object<T>::Object() {}
342 
343 template<typename T>
344 template<typename U>
345 inline Object<T>::Object(const Object<U>& o)
346 {
347  static bool unused = qi::detail::ForceProxyInclusion<T>().dummyCall();
348  (void)unused;
349 
350  /* An Object<T> created by convert may be in fact an object that does
351  * not implement the T interface.
352  * Checking and converting on first access to T& is not enough:
353  * Object<Iface> o = obj.call("fetchOne"); // this one might be incorrect
354  * someVector.push_back(o); // pushes the incorrect one
355  * o->someIfaceOperation(); // will upgrade o, but not the one in someVector
356  *
357  * So we check as early as we can, in all copy pathes, and back-propagate
358  * the upgrade to the source of the copy
359  */
360  const_cast<Object<U>&>(o).checkT();
361  init(o._obj);
362 }
363 template<typename T>
364 template<typename U>
365 inline void Object<T>::operator=(const Object<U>& o)
366 {
367  static bool unused = qi::detail::ForceProxyInclusion<T>().dummyCall();
368  (void)unused;
369 
370  const_cast<Object<U>&>(o).checkT();
371  init(o._obj);
372 }
373 template<typename T> inline Object<T>::Object(const Object<T>& o)
374 {
375  const_cast<Object<T>&>(o).checkT();
376  init(o._obj);
377 }
378 template<typename T>inline void Object<T>::operator=(const Object<T>& o)
379 {
380  const_cast<Object<T>&>(o).checkT();
381  init(o._obj);
382 }
383 template<typename T> inline Object<T>::Object(GenericObject* go)
384 {
385  init(detail::ManagedObjectPtr(go, &deleteObject));
386 }
387 template<typename T> inline Object<T>::Object(GenericObject* go, boost::function<void(GenericObject*)> deleter)
388 {
389  init(detail::ManagedObjectPtr(go, deleter));
390 }
391 template<typename T> template<typename U> Object<T>::Object(GenericObject* go, boost::shared_ptr<U> other)
392 {
393  init(detail::ManagedObjectPtr(other, go));
394  // Notify the shared_from_this of GenericObject
395  _obj->_internal_accept_owner(&other, go);
396 }
397 namespace detail
398 {
399  template<typename T, typename U> ManagedObjectPtr fromSharedPtr(Object<T>& dst, boost::shared_ptr<U>& other, boost::false_type)
400  {
401  ObjectTypeInterface* otype = dst.interface();
402  T* ptr = static_cast<T*>(other.get());
403  return ManagedObjectPtr(new GenericObject(otype, ptr),
404  boost::bind(&Object<T>::template keepReference<U>, _1, other));
405  }
406  template<typename U> ManagedObjectPtr fromSharedPtr(AnyObject& dst, boost::shared_ptr<U>& other, boost::true_type)
407  {
408  return Object<U>(other).managedObjectPtr();
409  }
410 }
411 
412 template<typename T> template<typename U> Object<T>::Object(boost::shared_ptr<U> other)
413 { // bounce depending on T==Empty
414  _obj = detail::fromSharedPtr(*this, other, typename boost::is_same<T, Empty>::type());
415 }
416 
417 template<typename T> inline Object<T>::Object(T* ptr)
418 {
419  ObjectTypeInterface* otype = interface();
420  _obj = detail::ManagedObjectPtr(new GenericObject(otype, ptr), &deleteObject);
421 }
422 template<typename T> inline Object<T>::Object(T* ptr, boost::function<void(T*)> deleter)
423 {
424  ObjectTypeInterface* otype = interface();
425  if (deleter)
426  _obj = detail::ManagedObjectPtr(new GenericObject(otype, ptr),
428  else
429  _obj = detail::ManagedObjectPtr(new GenericObject(otype, ptr), &deleteObject);
430 }
431 template<typename T> inline Object<T>::Object(const qi::Future<MaybeAnyObject>& fobj)
432 {
433  static bool unused = qi::detail::ForceProxyInclusion<T>().dummyCall();
434  (void)unused;
435 
436  init(fobj.value()._obj);
437 }
438 template<typename T> inline Object<T>::Object(const qi::FutureSync<MaybeAnyObject>& fobj)
439 {
440  static bool unused = qi::detail::ForceProxyInclusion<T>().dummyCall();
441  (void)unused;
442 
443  init(fobj.value()._obj);
444 }
445 
446 template<typename T> inline boost::shared_ptr<T> Object<T>::asSharedPtr()
447 {
448  checkT();
449  return boost::shared_ptr<T>(&asT(), boost::bind(&keepManagedObjectPtr, _obj));
450 }
451 
452 template<typename T> inline void Object<T>::init(detail::ManagedObjectPtr obj)
453 {
454  _obj = obj;
455  if (!boost::is_same<T, Empty>::value && obj)
456  checkT();
457  _obj = obj;
458 }
459 
460 template<typename T> inline bool Object<T>::operator <(const Object& b) const { return _obj < b._obj;}
461 template<typename T> template<typename U> bool Object<T>::operator !=(const Object<U>& b) const
462 {
463  return !(*this ==b);
464 }
465 template<typename T> template<typename U> bool Object<T>::operator ==(const Object<U>& b) const
466 {
467  return asGenericObject() == b.asGenericObject();
468 }
469 template<typename T> Object<T>::operator bool() const { return _obj && _obj->type;}
470 
471 template<typename T> Object<T>::operator Object<Empty>() const { return Object<Empty>(_obj);}
473 template<typename T> void Object<T>::checkT()
474 {
475  if (boost::is_same<T, Empty>::value || !_obj)
476  return;
477  if (_obj->type->info() != typeOf<T>()->info()
478  && _obj->type->inherits(typeOf<T>())==-1)
479  { // No T interface, try upgrading _obj
481  detail::ProxyGeneratorMap::iterator it = map.find(typeOf<T>()->info());
482  if (it != map.end())
483  {
484  qiLogDebug("qitype.anyobject") << "Upgrading Object to specialized proxy.";
485  AnyReference ref = it->second(AnyObject(_obj));
486  _obj = ref.to<detail::ManagedObjectPtr>();
487  ref.destroy();
488  return;
489  }
490  throw std::runtime_error(std::string() + "Object does not have interface " + typeOf<T>()->infoString());
491  }
492 }
493 template<typename T> T& Object<T>::asT()
494 {
495  checkT();
496  return *reinterpret_cast<T*>(_obj->value);
497 }
498 template<typename T> const T& Object<T>::asT() const
499 {
500  const_cast<Object<T>* >(this)->checkT();
501  return *reinterpret_cast<const T*>(_obj->value);
502 }
503 template<typename T> T* Object<T>::operator ->()
504 {
505  return &asT();
506 }
507 template<typename T> const T* Object<T>::operator->() const
508 {
509  return &asT();
510 }
511 template<typename T> T& Object<T>::operator *()
512 {
513  return asT();
514 }
515 template<typename T> const T& Object<T>::operator *() const
516 {
517  return asT();
518 }
519 template<typename T> bool Object<T>::unique() const
520 {
521  return _obj.unique();
522 }
523 template<typename T> GenericObject* Object<T>::asGenericObject() const
524 {
525  return _obj.get();
526 }
527 template<typename T> void Object<T>::reset()
528 {
529  _obj.reset();
530 }
531 
532 namespace detail
533 {
534  template<typename O>
535  inline qi::FutureSync<SignalLink> GenericObjectBounce<O>::connect(unsigned int signal, AnyObject target, unsigned int slot) const
536  {
537  return go()->connect(signal, target, slot);
538  }
539 }
540 
541 /* Pretend that Object<T> is exactly shared_ptr<GenericObject>
542  * Which it is in terms of memory layout.
543  * But as a consequence, convert will happily create Object<T> for any T
544  * without checking it.
545  * Object<T> is handling this through the checkT() method.
546  */
547 template<typename T>
548 class QI_API TypeImpl<Object<T> > :
549  public TypeImpl<boost::shared_ptr<GenericObject> >
550 {
551 };
552 
553 #ifdef _MSC_VER
554 /* Because we use types marked with QI_API and inheriting from Object<Empty>
555  * (through AnyObject), then Object<Empty> functions must be explicitly
556  * exported/imported to avoid link issues with MSVC.
557  */
558 template class QI_API Object<Empty>;
559 #endif
560 
561 }
562 
563 #endif // _QITYPE_DETAILS_GENERICOBJECT_HXX_
boost::shared_ptr< T > asSharedPtr()
Definition: object.hxx:446
GenericObject * asGenericObject() const
Definition: object.hxx:523
T * operator->()
Definition: object.hxx:503
static void noDeleteT(T *)
Definition: object.hxx:276
boost::weak_ptr< GenericObject > _ptr
Definition: object.hxx:323
#define QI_API
Definition: api.hpp:34
qi::Future< AnyReference > metaCall(const std::string &nameWithOptionalSignature, const GenericFunctionParameters &params, MetaCallType callType=MetaCallType_Auto, Signature returnSignature=Signature()) const
Definition: object.hxx:80
qi::FutureSync< void > setProperty(const std::string &name, const T &val) const
Definition: object.hxx:130
qi::FutureSync< void > disconnect(SignalLink linkId) const
Definition: object.hxx:120
qi::FutureSync< SignalLink > connect(const std::string &eventName, FUNCTOR_TYPE callback, MetaCallType threadingModel=MetaCallType_Direct)
qi::FutureSync< AnyValue > property(unsigned int id) const
Definition: object.hxx:134
void enableStats(bool enable)
Set statistics gathering status.
T & asT()
Definition: object.hxx:493
int findMethod(const std::string &name, const GenericFunctionParameters &parameters) const
Definition: object.hxx:76
boost::function< RF > bind(const AF &fun,...)
void enableStats(bool enable) const
Definition: object.hxx:150
#define qiLogDebug(...)
Definition: log.hpp:69
bool unique() const
Definition: object.hxx:519
virtual TypeKind kind()
Definition: type.hxx:96
void checkT()
Check tha value actually has the T interface.
Definition: object.hxx:473
bool operator<(const Object &b) const
Definition: object.hxx:460
qi::FutureSync< SignalLink > connect(unsigned int signal, const SignalSubscriber &subscriber) const
Definition: object.hxx:114
Honor the default behavior.
Definition: typeobject.hpp:21
qi::FutureSync< T > property(const std::string &name) const
Definition: object.hxx:125
boost::mpl::if_< typename boost::is_same< T, Empty >::type, None, Object< Empty > >::type MaybeAnyObject
Definition: object.hxx:229
const ValueType & value(int msecs=FutureTimeout_Infinite) const
Definition: future_fwd.hpp:585
qi::FutureSync< SignalLink > connect(const std::string &eventName, FUNCTOR_TYPE callback, MetaCallType threadingModel=MetaCallType_Auto) const
Definition: object.hxx:105
void enableTrace(bool enable)
Definition: object.hxx:166
bool isStatsEnabled() const
int findMethod(const std::string &name, const GenericFunctionParameters &parameters)
static void deleteGenericObjectOnly(GenericObject *obj)
Definition: object.hxx:279
ManagedObjectPtr fromSharedPtr(Object< T > &dst, boost::shared_ptr< U > &other, boost::false_type)
Definition: object.hxx:399
Object< T > lock()
Definition: object.hxx:322
unsigned use_count() const
Definition: object.hxx:267
void destroy()
Deletes storage.
WeakObject(const Object< U > &o)
Definition: object.hxx:320
boost::shared_ptr< class GenericObject > ManagedObjectPtr
ProxyGeneratorMap & proxyGeneratorMap()
void operator=(const Object< U > &o)
Definition: object.hxx:365
void forceExecutionContext(boost::shared_ptr< qi::ExecutionContext > ec)
Definition: object.hxx:170
T to() const
Convert to anything or throw trying.
qi::FutureSync< void > disconnect(SignalLink linkId)
Disconnect an event link. Returns if disconnection was successful.
bool operator==(const Object< U > &b) const
Definition: object.hxx:465
detail::ManagedObjectPtr managedObjectPtr()
Definition: object.hxx:288
#define genCall(n, ATYPEDECL, ATYPES, ADECL, AUSE, comma)
Definition: object.hxx:174
T & operator*()
Definition: object.hxx:511
const MetaObject & metaObject() const
Definition: object.hxx:71
qi::FutureSync< void > setProperty(const std::string &name, const T &val)
void metaPost(unsigned int event, const GenericFunctionParameters &params) const
Definition: object.hxx:84
ObjectTypeInterface * type
void post(const std::string &eventName, qi::AutoAnyReference p1=qi::AutoAnyReference(), qi::AutoAnyReference p2=qi::AutoAnyReference(), qi::AutoAnyReference p3=qi::AutoAnyReference(), qi::AutoAnyReference p4=qi::AutoAnyReference(), qi::AutoAnyReference p5=qi::AutoAnyReference(), qi::AutoAnyReference p6=qi::AutoAnyReference(), qi::AutoAnyReference p7=qi::AutoAnyReference(), qi::AutoAnyReference p8=qi::AutoAnyReference())
void metaPost(unsigned int event, const GenericFunctionParameters &params)
virtual void destroy(void *)=0
Free all resources of a storage.
void enableTrace(bool enable)
WeakObject< Empty > AnyWeakObject
Definition: object.hxx:325
qi::FutureSync< void > setProperty(unsigned int id, const AnyValue &val) const
Definition: object.hxx:138
static void keepReference(GenericObject *obj, boost::shared_ptr< U > ptr)
Definition: object.hxx:275
qi::FutureSync< T > property(const std::string &name)
MetaCallType
Definition: typeobject.hpp:19
std::map< unsigned int, MethodStatistics > ObjectStatistics
Definition: manageable.hpp:117
const char * infoString()
ObjectTypeInterface * interface()
Definition: object.hxx:327
qi::FutureSync< SignalLink > connect(const std::string &name, const SignalSubscriber &functor) const
Definition: object.hxx:110
boost::shared_ptr< ExecutionContext > executionContext() const
const MetaObject & metaObject()
Object< Empty > AnyObject
Definition: anyobject.hpp:21
static void keepManagedObjectPtr(detail::ManagedObjectPtr ptr)
Definition: object.hxx:273
bool isTraceEnabled() const
static void noDelete(GenericObject *)
Definition: object.hxx:277
ObjectStatistics stats() const
Definition: object.hxx:154
const ValueType & value(int msecs=FutureTimeout_Infinite) const
Return the value associated to a Future.
Definition: future_fwd.hpp:200
bool operator!=(const Object< U > &b) const
Definition: object.hxx:461
void reset()
Definition: object.hxx:527
qi::Future< AnyReference > metaCall(unsigned int method, const GenericFunctionParameters &params, MetaCallType callType=MetaCallType_Auto, Signature returnSignature=Signature()) const
Definition: object.hxx:72
std::map< TypeInfo, boost::function< AnyReference(AnyObject)> > ProxyGeneratorMap
Definition: object.hxx:45
void forceExecutionContext(boost::shared_ptr< ExecutionContext > eventLoop)
Override all ThreadingModel and force dispatch to given event loop.
qi::uint64_t SignalLink
Definition: signal.hpp:33
void clearStats()
Reset all statistical data.
qi::Future< AnyReference > metaCall(unsigned int method, const GenericFunctionParameters &params, MetaCallType callType=MetaCallType_Auto, Signature returnSignature=Signature())
ObjectStatistics stats() const
void post(const std::string &eventName, qi::AutoAnyReference p1=qi::AutoAnyReference(), qi::AutoAnyReference p2=qi::AutoAnyReference(), qi::AutoAnyReference p3=qi::AutoAnyReference(), qi::AutoAnyReference p4=qi::AutoAnyReference(), qi::AutoAnyReference p5=qi::AutoAnyReference(), qi::AutoAnyReference p6=qi::AutoAnyReference(), qi::AutoAnyReference p7=qi::AutoAnyReference(), qi::AutoAnyReference p8=qi::AutoAnyReference()) const
Definition: object.hxx:92
void init(qi::LogLevel verb=qi::LogLevel_Info, qi::LogContext context=qi::LogContextAttr_ShortVerbosity|qi::LogContextAttr_Tid|qi::LogContextAttr_Category, bool synchronous=true)
Initialization of the logging system (could be avoided)
void metaPost(const std::string &nameWithOptionalSignature, const GenericFunctionParameters &in) const
Definition: object.hxx:88
static void deleteCustomDeleter(GenericObject *obj, boost::function< void(T *)> deleter)
Definition: object.hxx:282
ExecutionContext * executionContext() const
Definition: object.hxx:142
#define QI_GEN(f)
Definition: preproc.hpp:476
Description of the signals and methods accessible on an ObjectTypeInterface.
Definition: metaobject.hpp:25
static void deleteGenericObjectOnlyAndKeep(GenericObject *obj, U)
Definition: object.hxx:281