qi::DynamicObjectBuilder¶
This builder works similarly to the qi::ObjectTypeBuilder
, but does not
register types to the type system (there is no type in a C++ sense). It can
only create type-erased objects from what has been advertised.
Summary¶
class qi::DynamicObjectBuilder
Functions (class qi::DynamicObjectBuilder)
-
qi::DynamicObjectBuilder::advertiseMethod
qi::DynamicObjectBuilder::advertiseProperty
qi::DynamicObjectBuilder::xAdvertiseMethod
qi::DynamicObjectBuilder::advertiseFactory
qi::DynamicObjectBuilder::~DynamicObjectBuilder
qi::DynamicObjectBuilder::advertiseSignal
qi::DynamicObjectBuilder::xAdvertiseProperty
qi::DynamicObjectBuilder::setDescription
qi::DynamicObjectBuilder::markProperty
qi::DynamicObjectBuilder::object
qi::DynamicObjectBuilder::DynamicObjectBuilder
qi::DynamicObjectBuilder::xAdvertiseSignal
Global Classes
Detailed Description¶
To build a dynamic object, advertise all its members in the builder and call
object()
to make an object of this type.
#include <qi/type/dynamicobjectbuilder.hpp>
void myfunc()
{
std::cout << "Hello world\n";
}
// initialize the builder
qi::DynamicObjectBuilder builder;
builder.advertiseMethod("myMethod", &myfunc);
builder.advertiseSignal<int>("signal");
// build objects
qi::AnyObject obj = builder.object();
obj.call<void>("myMethod");
obj.connect("signal", &myhandler);
obj.post("signal", 12);
Reference¶
qi::DynamicObjectBuilder Class Reference¶
Public Functions¶
-
()DynamicObjectBuilder
-
(DynamicObject* dynobject, bool deleteOnDestroy)DynamicObjectBuilder
-
()~DynamicObjectBuilder
- template<typename OBJECT_TYPE, typename METHOD_TYPE>
-
unsigned int
(const std::string& name, OBJECT_TYPE object, METHOD_TYPE method, const std::string& desc, MetaCallType threadingModel)advertiseMethod
- template<typename FUNCTION_TYPE>
-
unsigned int
(const std::string& name, FUNCTION_TYPE function, const std::string& desc, MetaCallType threadingModel)advertiseMethod
- template<typename OBJECT_TYPE, typename METHOD_TYPE>
-
unsigned int
(MetaMethodBuilder& builder, OBJECT_TYPE object, METHOD_TYPE method, MetaCallType threadingModel)advertiseMethod
- template<typename FUNCTION_TYPE>
-
unsigned int
(MetaMethodBuilder& builder, FUNCTION_TYPE function, MetaCallType threadingModel)advertiseMethod
- template<typename T, typename... Args>
-
unsigned int
(const std::string& name)advertiseFactory
- template<typename... Args>
-
unsigned int
(const std::string& name)advertiseSignal
- template<typename T>
-
unsigned int
(const std::string& name)advertiseSignalF
-
unsigned int
(const std::string& name, qi::SignalBase* signal)advertiseSignal
- template<typename T>
-
unsigned int
(const std::string& name)advertiseProperty
-
unsigned int
(const std::string& name, qi::PropertyBase* sig)advertiseProperty
-
void
(ObjectThreadingModel model)setThreadingModel
-
unsigned int
(const Signature& sigret, const std::string& name, const Signature& signature, AnyFunction func, const std::string& desc, MetaCallType threadingModel)xAdvertiseMethod
-
unsigned int
(MetaMethodBuilder& builder, AnyFunction func, MetaCallType threadingModel)xAdvertiseMethod
-
unsigned int
(const std::string& name, const Signature& signature)xAdvertiseSignal
-
unsigned int
(const std::string& name, const Signature& sig, int id)xAdvertiseProperty
-
void
(const std::string& desc)setDescription
-
qi::AnyObject
(boost::function<void(GenericObject*)> onDelete)object
- template<typename T>
-
qi::AnyObject
(boost::shared_ptr<T> other)object
-
void
(unsigned int ev, unsigned int getter, unsigned int setter)markProperty
Detailed Description¶
Function Documentation¶
-
qi::DynamicObjectBuilder::
DynamicObjectBuilder
()¶
-
qi::DynamicObjectBuilder::
DynamicObjectBuilder
(DynamicObject* dynobject, bool deleteOnDestroy = true)¶
-
qi::DynamicObjectBuilder::
~DynamicObjectBuilder
()¶
- template<typename OBJECT_TYPE, typename METHOD_TYPE>
-
unsigned int
qi::DynamicObjectBuilder::
advertiseMethod
(const std::string& name, OBJECT_TYPE object, METHOD_TYPE method, const std::string& desc = "", MetaCallType threadingModel = MetaCallType_Auto)¶
- template<typename FUNCTION_TYPE>
-
unsigned int
qi::DynamicObjectBuilder::
advertiseMethod
(const std::string& name, FUNCTION_TYPE function, const std::string& desc = "", MetaCallType threadingModel = MetaCallType_Auto)¶
- template<typename OBJECT_TYPE, typename METHOD_TYPE>
-
unsigned int
qi::DynamicObjectBuilder::
advertiseMethod
(MetaMethodBuilder& builder, OBJECT_TYPE object, METHOD_TYPE method, MetaCallType threadingModel = MetaCallType_Auto)¶
- template<typename FUNCTION_TYPE>
-
unsigned int
qi::DynamicObjectBuilder::
advertiseMethod
(MetaMethodBuilder& builder, FUNCTION_TYPE function, MetaCallType threadingModel = MetaCallType_Auto)¶
- template<typename T, typename... Args>
-
unsigned int
qi::DynamicObjectBuilder::
advertiseFactory
(const std::string& name)¶ create a T, wrap in a AnyObject All template parameters are given to the T constructor except the first one
- template<typename... Args>
-
unsigned int
qi::DynamicObjectBuilder::
advertiseSignal
(const std::string& name)¶
- template<typename T>
-
unsigned int
qi::DynamicObjectBuilder::
advertiseSignalF
(const std::string& name)¶ Advertise a signal using a function signature.
-
unsigned int
qi::DynamicObjectBuilder::
advertiseSignal
(const std::string& name, qi::SignalBase* signal)¶
- template<typename T>
-
unsigned int
qi::DynamicObjectBuilder::
advertiseProperty
(const std::string& name)¶
-
unsigned int
qi::DynamicObjectBuilder::
advertiseProperty
(const std::string& name, qi::PropertyBase* sig)¶ Ownership is transferred to the object.
-
unsigned int
qi::DynamicObjectBuilder::
xAdvertiseMethod
(const Signature& sigret, const std::string& name, const Signature& signature, AnyFunction func, const std::string& desc = "", MetaCallType threadingModel = MetaCallType_Auto)¶
-
unsigned int
qi::DynamicObjectBuilder::
xAdvertiseMethod
(MetaMethodBuilder& builder, AnyFunction func, MetaCallType threadingModel = MetaCallType_Auto)¶
-
unsigned int
qi::DynamicObjectBuilder::
xAdvertiseSignal
(const std::string& name, const Signature& signature)¶
-
unsigned int
qi::DynamicObjectBuilder::
xAdvertiseProperty
(const std::string& name, const Signature& sig, int id = -1)¶
-
void
qi::DynamicObjectBuilder::
setDescription
(const std::string& desc)¶
-
qi::AnyObject
qi::DynamicObjectBuilder::
object
(boost::function<void(GenericObject*)> onDelete = boost::function< void(GenericObject *)¶
- template<typename T>
Return an AnyObject that shares life type with other.
-
void
qi::DynamicObjectBuilder::
markProperty
(unsigned int ev, unsigned int getter, unsigned int setter)¶