libqi-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
typeobject.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_TYPEOBJECT_HPP_
8 #define _QI_TYPE_TYPEOBJECT_HPP_
9 
10 #include <limits>
11 #include <cstdint>
12 
13 #include <qi/type/metaobject.hpp>
14 #include <qi/future.hpp>
15 #include <qi/anyfunction.hpp>
16 #include <qi/os.hpp>
17 #include <qi/objectuid.hpp>
18 
19 namespace qi {
20 
24  enum MetaCallType {
31  };
32  class SignalSubscriber;
33  class Manageable;
34  using SignalLink = qi::uint64_t;
35 
36  /* We will have 2 implementations for 2 classes of C++ class:
37  * - DynamicObject: Use DynamicObjectBuilder
38  * - T: Use ObjectTypeBuilder
39  *
40  * All values of this type (GenericObject) will be handled
41  *
42  *
43  * NOTE: no SignalBase accessor at this point, but the backend is such that it would be possible
44  * but if we do that, virtual emit/connect/disconnect must go away, as they could be bypassed
45  * ->RemoteObject, ALBridge will have to adapt
46  *
47  */
49  {
50  public:
51  virtual const MetaObject& metaObject(void* instance) = 0;
52  virtual ObjectUid uid(void* instance) const = 0;
53  virtual qi::Future<AnyReference> metaCall(void* instance, AnyObject context, unsigned int method, const GenericFunctionParameters& params, MetaCallType callType = MetaCallType_Auto, Signature returnSig = Signature())=0;
54  virtual void metaPost(void* instance, AnyObject context, unsigned int signal, const GenericFunctionParameters& params)=0;
55  virtual qi::Future<SignalLink> connect(void* instance, AnyObject context, unsigned int event, const SignalSubscriber& subscriber)=0;
57  virtual qi::Future<void> disconnect(void* instance, AnyObject context, SignalLink linkId)=0;
59  virtual const std::vector<std::pair<TypeInterface*, std::ptrdiff_t> >& parentTypes() = 0;
60  virtual qi::Future<AnyValue> property(void* instance, AnyObject context, unsigned int id) = 0;
61  virtual qi::Future<void> setProperty(void* instance, AnyObject context, unsigned int id, AnyValue value) = 0;
62  virtual TypeKind kind() { return TypeKind_Object;}
63  static const auto INHERITS_FAILED = PTRDIFF_MAX;
64 
66  std::ptrdiff_t inherits(TypeInterface* other);
67  };
68 
69 }
70 
71 #endif // _QITYPE_TYPEOBJECT_HPP_
#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())
Honor the default behavior.
Definition: typeobject.hpp:26
Force a synchronous call.
Definition: typeobject.hpp:28
MetaCallType
Definition: typeobject.hpp:24
#define PTRDIFF_MAX
Definition: os.hpp:56
TypeKind
Definition: fwd.hpp:54
virtual TypeKind kind()
Definition: typeobject.hpp:62
qi::uint64_t SignalLink
Definition: signal.hpp:36
Force an asynchronous call in an other thread.
Definition: typeobject.hpp:30
uint64_t uint64_t
Definition: types.hpp:66
int context()
Get log context.
Description of the signals and methods accessible on an ObjectTypeInterface.
Definition: metaobject.hpp:25