- Aldebaran documentation |
- C++ Libraries |
- index

libqi-api 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dynamicobject.hpp
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_DYNAMICOBJECT_HPP_
8 #define _QI_TYPE_DYNAMICOBJECT_HPP_
9
10 #include <qi/anyobject.hpp>
11 #include <qi/property.hpp>
12 #include <qi/objectuid.hpp>
13 #include <boost/optional.hpp>
14
15 #ifdef _MSC_VER
16 # pragma warning( push )
17 # pragma warning( disable: 4251 )
18 #endif
19
20 namespace qi
21 {
22
23 class DynamicObjectPrivate;
24
36 class QI_API DynamicObject {
37 public:
38 DynamicObject();
39
40 virtual ~DynamicObject();
41
43 virtual void setMetaObject(const MetaObject& mo);
44
45
46 MetaObject &metaObject();
47
48 void setMethod(unsigned int id, AnyFunction callable, MetaCallType threadingModel = MetaCallType_Auto);
49 void setSignal(unsigned int id, SignalBase* signal);
50 void setProperty(unsigned int id, PropertyBase* property);
51
52 const AnyFunction& method(unsigned int id) const;
53 SignalBase* signal(unsigned int id) const;
54 PropertyBase* property(unsigned int) const;
55
56 boost::optional<ObjectUid> uid() const;
57 void setUid(boost::optional<ObjectUid> newUid);
58
59 virtual qi::Future<AnyReference> metaCall(AnyObject context, unsigned int method, const GenericFunctionParameters& params, MetaCallType callType = MetaCallType_Auto, Signature returnSignature=Signature());
60 virtual void metaPost(AnyObject context, unsigned int event, const GenericFunctionParameters& params);
62 virtual qi::Future<SignalLink> metaConnect(unsigned int event, const SignalSubscriber& subscriber);
64 virtual qi::Future<void> metaDisconnect(SignalLink linkId);
65 virtual qi::Future<AnyValue> metaProperty(AnyObject context, unsigned int id);
66 virtual qi::Future<void> metaSetProperty(AnyObject context, unsigned int id, AnyValue val);
67
68 void setThreadingModel(ObjectThreadingModel model);
69 ObjectThreadingModel threadingModel() const;
70 // internal use, call once to update with Manageable methods and signals
71 void setManageable(Manageable* m);
72 // C4251
73 boost::shared_ptr<DynamicObjectPrivate> _p;
74 };
75
77 QI_API AnyObject makeDynamicAnyObject(DynamicObject *obj,
78 bool destroyObject = true,
79 const boost::optional<ObjectUid>& uid = {},
80 boost::function<void (GenericObject*)> onDelete = boost::function<void (GenericObject*)>());
81
82 QI_API AnyObject makeDynamicSharedAnyObjectImpl(DynamicObject* obj, boost::shared_ptr<Empty> other);
83
87 template<typename T>
88 inline AnyObject makeDynamicSharedAnyObject(DynamicObject *obj, boost::shared_ptr<T> other)
89 {
90 return makeDynamicSharedAnyObjectImpl(obj, boost::shared_ptr<Empty>(other, 0));
91 }
92
93
94 QI_API ObjectTypeInterface* getDynamicTypeInterface();
95 }
96
97 #ifdef _MSC_VER
98 # pragma warning( pop )
99 #endif
100
101 #endif // _QITYPE_DYNAMICOBJECT_HPP_
qi::AnyValue
Definition: anyvalue.hpp:19
qi::GenericFunctionParameters
Definition: anyfunction.hpp:266
QI_API
#define QI_API
Definition: api.hpp:33
qi::PropertyBase
Definition: property.hpp:30
objectuid.hpp
qi::metaCall
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())
qi::Future
Definition: executioncontext.hpp:20
qi::DynamicObject::_p
boost::shared_ptr< DynamicObjectPrivate > _p
Definition: dynamicobject.hpp:73
qi::AnyFunction
Definition: anyfunction.hpp:149
qi::Signature
Definition: signature.hpp:66
qi::makeDynamicSharedAnyObjectImpl
AnyObject makeDynamicSharedAnyObjectImpl(DynamicObject *obj, boost::shared_ptr< Empty > other)
qi::Manageable
Definition: manageable.hpp:123
qi::MetaCallType_Auto
Honor the default behavior.
Definition: typeobject.hpp:26
property.hpp
qi::SignalBase
Definition: signal.hpp:42
qi::makeDynamicSharedAnyObject
AnyObject makeDynamicSharedAnyObject(DynamicObject *obj, boost::shared_ptr< T > other)
Definition: dynamicobject.hpp:88
qi::MetaCallType
MetaCallType
Definition: typeobject.hpp:24
qi::DynamicObject
Definition: dynamicobject.hpp:36
qi::Object< Empty >
qi::AnyObject
Object< Empty > AnyObject
Definition: anyobject.hpp:21
qi::getDynamicTypeInterface
ObjectTypeInterface * getDynamicTypeInterface()
qi::makeDynamicAnyObject
AnyObject makeDynamicAnyObject(DynamicObject *obj, bool destroyObject=true, const boost::optional< ObjectUid > &uid={}, boost::function< void(GenericObject *)> onDelete=boost::function< void(GenericObject *)>())
Make an AnyObject of DynamicObject kind from a DynamicObject.
qi::SignalLink
qi::uint64_t SignalLink
Definition: signal.hpp:36
anyobject.hpp
qi::ObjectThreadingModel
ObjectThreadingModel
Possible thread models for an object.
Definition: manageable.hpp:33
qi::log::context
int context()
Get log context.
qi::MetaObject
Description of the signals and methods accessible on an ObjectTypeInterface.
Definition: metaobject.hpp:25