# SoftBank Robotics documentation What's new in NAOqi 2.8?

# 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

Global Classes

- class qi::DynamicObjectBuilder

  Functions (class qi::DynamicObjectBuilder)

  qi::DynamicObjectBuilder::advertiseMethod

  qi::DynamicObjectBuilder::advertiseProperty

  qi::DynamicObjectBuilder::xAdvertiseMethod

  qi::DynamicObjectBuilder::advertiseFactory

  qi::DynamicObjectBuilder::~DynamicObjectBuilder

  qi::DynamicObjectBuilder::object

  qi::DynamicObjectBuilder::advertiseSignal

  qi::DynamicObjectBuilder::xAdvertiseProperty

  qi::DynamicObjectBuilder::setDescription

  qi::DynamicObjectBuilder::markProperty

  qi::DynamicObjectBuilder::DynamicObjectBuilder

  qi::DynamicObjectBuilder::xAdvertiseSignal

  qi::DynamicObjectBuilder::advertiseSignalF

  qi::DynamicObjectBuilder::setThreadingModel

## 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

#### Introduction

`More...`

- Inherits: `boost::noncopyable`
- Inherited by: `qi::ModuleBuilder`

#### Public Functions

``DynamicObjectBuilder``()
``DynamicObjectBuilder``(DynamicObject* dynobject, bool deleteOnDestroy)
``~DynamicObjectBuilder``()
template<typename OBJECT_TYPE, typename METHOD_TYPE>
unsigned int ``advertiseMethod``(const std::string& name, OBJECT_TYPE object, METHOD_TYPE method, const std::string& desc, MetaCallType threadingModel)
template<typename FUNCTION_TYPE>
unsigned int ``advertiseMethod``(const std::string& name, FUNCTION_TYPE function, const std::string& desc, MetaCallType threadingModel)
template<typename OBJECT_TYPE, typename METHOD_TYPE>
unsigned int ``advertiseMethod``(MetaMethodBuilder& builder, OBJECT_TYPE object, METHOD_TYPE method, MetaCallType threadingModel)
template<typename FUNCTION_TYPE>
unsigned int ``advertiseMethod``(MetaMethodBuilder& builder, FUNCTION_TYPE function, MetaCallType threadingModel)
template<typename T, typename... Args>
unsigned int ``advertiseFactory``(const std::string& name)
template<typename... Args>
unsigned int ``advertiseSignal``(const std::string& name)
template<typename T>
unsigned int ``advertiseSignalF``(const std::string& name)
unsigned int ``advertiseSignal``(const std::string& name, qi::SignalBase* signal)
template<typename T>
unsigned int ``advertiseProperty``(const std::string& name)
unsigned int ``advertiseProperty``(const std::string& name, qi::PropertyBase* sig)
void ``setThreadingModel``(ObjectThreadingModel model)
unsigned int ``xAdvertiseMethod``(const Signature& sigret, const std::string& name, const Signature& signature, AnyFunction func, const std::string& desc, MetaCallType threadingModel)
unsigned int ``xAdvertiseMethod``(MetaMethodBuilder& builder, AnyFunction func, MetaCallType threadingModel)
unsigned int ``xAdvertiseSignal``(const std::string& name, const Signature& signature, bool isSignalProperty)
unsigned int ``xAdvertiseProperty``(const std::string& name, const Signature& sig, int id)
void ``setDescription``(const std::string& desc)
qi::AnyObject ``object``(boost::function<void(GenericObject*)> onDelete)
template<typename T>
qi::AnyObject ``object``(boost::shared_ptr<T> other)
void ``markProperty``(unsigned int ev, unsigned int getter, unsigned int setter)

#### 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.

void `qi::DynamicObjectBuilder::``setThreadingModel`(ObjectThreadingModel model)

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, bool isSignalProperty = false)

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>
qi::AnyObject `qi::DynamicObjectBuilder::``object`(boost::shared_ptr<T> other)

  Return an AnyObject that shares life type with other.

void `qi::DynamicObjectBuilder::``markProperty`(unsigned int ev, unsigned int getter, unsigned int setter)

Glossary Site map Index Support Contact Legal Notices