libqi-api  release-2.5.3-2016-11-18
 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  using SignalGetter = boost::function<SignalBase* (void*)>;
36  using SignalGetterMap = std::map<unsigned int, SignalGetter>;
38 
39  using PropertyGetter = boost::function<PropertyBase*(void*)>;
40  using PropertyGetterMap = std::map<unsigned int, PropertyGetter>;
42 
43  using MethodMap = std::map<unsigned int, std::pair<AnyFunction, MetaCallType>>;
44 
46 
48  std::vector<std::pair<TypeInterface*, int> > parentTypes;
51 };
52 
53 
62 {
63 public:
64  void initialize(const MetaObject& mo, const ObjectTypeData& data);
65  virtual const TypeInfo& info();
66  virtual const MetaObject& metaObject(void* instance);
67  virtual qi::Future<AnyReference> metaCall(void* instance, AnyObject context, unsigned int method, const GenericFunctionParameters& params, MetaCallType callType, Signature returnSignature);
68  virtual void metaPost(void* instance, AnyObject context, unsigned int signal, const GenericFunctionParameters& params);
69  virtual qi::Future<SignalLink> connect(void* instance, AnyObject context, unsigned int event, const SignalSubscriber& subscriber);
71  virtual qi::Future<void> disconnect(void* instance, AnyObject context, SignalLink linkId);
72  virtual qi::Future<AnyValue> property(void* instance, AnyObject context, unsigned int id);
73  virtual qi::Future<void> setProperty(void* instance, AnyObject context, unsigned int id, AnyValue value);
74 
75  virtual const std::vector<std::pair<TypeInterface*, int> >& parentTypes();
76  virtual void* initializeStorage(void*);
77  virtual void* ptrFromStorage(void**);
78  virtual void* clone(void* inst);
79  virtual void destroy(void*);
80  virtual bool less(void* a, void* b);
81 private:
82  MetaObject _metaObject;
83  ObjectTypeData _data;
84 
85  ExecutionContext* getExecutionContext(void* instance, qi::AnyObject context, MetaCallType methodThreadingModel = MetaCallType_Auto);
86 };
87 
88 }
89 
90 }
91 
92 #endif
PropertyGetterMap propertyGetterMap
void destroy()
Stop and flush the logging system.
#define QI_API
Definition: api.hpp:33
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())
boost::function< SignalBase *(void *)> SignalGetter
Honor the default behavior.
Definition: typeobject.hpp:23
dll import/export and compiler message
std::vector< std::pair< TypeInterface *, int > > parentTypes
boost::function< PropertyBase *(void *)> PropertyGetter
std::map< unsigned int, std::pair< AnyFunction, MetaCallType >> MethodMap
ObjectThreadingModel threadingModel
MetaCallType
Definition: typeobject.hpp:21
std::map< unsigned int, PropertyGetter > PropertyGetterMap
std::map< unsigned int, SignalGetter > SignalGetterMap
qi::uint64_t SignalLink
Definition: signal.hpp:35
ObjectThreadingModel
Possible thread models for an object.
Definition: manageable.hpp:33
int context()
Get log context.
Description of the signals and methods accessible on an ObjectTypeInterface.
Definition: metaobject.hpp:25