libqi-api  2.4.3.28
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
staticobjecttype.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Copyright (C) 2012 Aldebaran Robotics
4 ** See COPYING for the license
5 */
6 
7 #ifndef _QI_TYPE_DETAIL_STATICOBJECTTYPE_HPP_
8 #define _QI_TYPE_DETAIL_STATICOBJECTTYPE_HPP_
9 
10 #include <qi/api.hpp>
11 #include <qi/property.hpp>
12 #include <qi/anyvalue.hpp>
14 #include <qi/type/metaobject.hpp>
15 
16 namespace qi
17 {
18 
19 class SignalBase;
20 
21 namespace detail {
22 
23 //type-erased methods and signals accessors for a given type
25 {
27  : classType(0)
28  , threadingModel(ObjectThreadingModel_Default)
29  {}
30 
31  /* One might want this in the ObjectType virtuals, but that would
32  * bypass ObjectTypeInterface::metaCall which would have to be removed.
33  * -> RemoteObject, ALBridge needs to be rewriten.
34  */
35  typedef boost::function<SignalBase* (void*)> SignalGetter;
36  typedef std::map<unsigned int, SignalGetter> SignalGetterMap;
38 
39  typedef boost::function<PropertyBase*(void*)> PropertyGetter;
40  typedef std::map<unsigned int, PropertyGetter> PropertyGetterMap;
42 
43  typedef std::map<
44  unsigned int,
45  std::pair<AnyFunction, MetaCallType>
47 
49 
51  std::vector<std::pair<TypeInterface*, int> > parentTypes;
54 };
55 
56 
65 {
66 public:
67  void initialize(const MetaObject& mo, const ObjectTypeData& data);
68  virtual const TypeInfo& info();
69  virtual const MetaObject& metaObject(void* instance);
70  virtual qi::Future<AnyReference> metaCall(void* instance, AnyObject context, unsigned int method, const GenericFunctionParameters& params, MetaCallType callType, Signature returnSignature);
71  virtual void metaPost(void* instance, AnyObject context, unsigned int signal, const GenericFunctionParameters& params);
72  virtual qi::Future<SignalLink> connect(void* instance, AnyObject context, unsigned int event, const SignalSubscriber& subscriber);
74  virtual qi::Future<void> disconnect(void* instance, AnyObject context, SignalLink linkId);
75  virtual qi::Future<AnyValue> property(void* instance, AnyObject context, unsigned int id);
76  virtual qi::Future<void> setProperty(void* instance, AnyObject context, unsigned int id, AnyValue value);
77 
78  virtual const std::vector<std::pair<TypeInterface*, int> >& parentTypes();
79  virtual void* initializeStorage(void*);
80  virtual void* ptrFromStorage(void**);
81  virtual void* clone(void* inst);
82  virtual void destroy(void*);
83  virtual bool less(void* a, void* b);
84 private:
85  MetaObject _metaObject;
86  ObjectTypeData _data;
87 
88  ExecutionContext* getExecutionContext(void* instance, qi::AnyObject context, MetaCallType methodThreadingModel = MetaCallType_Auto);
89 };
90 
91 }
92 
93 }
94 
95 #endif
PropertyGetterMap propertyGetterMap
void destroy()
Stop and flush the logging system.
#define QI_API
Definition: api.hpp:34
qi::Future< AnyReference > metaCall(ExecutionContext *ec, ObjectThreadingModel objectThreadingModel, MetaCallType methodThreadingModel, MetaCallType callType, AnyObject manageable, unsigned int methodId, AnyFunction func, const GenericFunctionParameters &params, bool noCloneFirst=false, unsigned int callerId=0, qi::os::timeval postTimestamp=qi::os::timeval())
std::map< unsigned int, SignalGetter > SignalGetterMap
Honor the default behavior.
Definition: typeobject.hpp:21
dll import/export and compiler message
std::vector< std::pair< TypeInterface *, int > > parentTypes
boost::function< PropertyBase *(void *)> PropertyGetter
boost::function< SignalBase *(void *)> SignalGetter
ObjectThreadingModel threadingModel
MetaCallType
Definition: typeobject.hpp:19
qi::uint64_t SignalLink
Definition: signal.hpp:33
std::map< unsigned int, std::pair< AnyFunction, MetaCallType > > MethodMap
ObjectThreadingModel
Possible thread models for an object.
Definition: manageable.hpp:30
int context()
Get log context.
Description of the signals and methods accessible on an ObjectTypeInterface.
Definition: metaobject.hpp:25
std::map< unsigned int, PropertyGetter > PropertyGetterMap