7 #ifndef _QITYPE_DETAIL_OBJECTTYPEBUILDER_HXX_
8 #define _QITYPE_DETAIL_OBJECTTYPEBUILDER_HXX_
10 #include <boost/function_types/is_member_function_pointer.hpp>
11 #include <boost/mpl/front.hpp>
22 return (static_cast<T*>(instance)->*member)();
26 typename boost::enable_if<boost::is_base_of<Actor, T>,
AnyFunction>::type
33 typename boost::disable_if<boost::is_base_of<Actor, T>,
AnyFunction>::type
50 if (std::is_base_of<Actor, T>::value)
56 template <
typename FUNCTION_TYPE>
58 FUNCTION_TYPE
function,
71 template <
typename FUNCTION_TYPE>
73 FUNCTION_TYPE
function,
88 typename boost::remove_reference<U>::type>(), offset);
97 T* ptr =
reinterpret_cast<T*
>(0x10000);
99 std::ptrdiff_t offset =
reinterpret_cast<intptr_t
>(pptr) - reinterpret_cast<intptr_t>(ptr);
101 <<
", U(" <<
qi::typeIdRuntime(pptr).name() <<
")= " << pptr <<
", T-U= " << offset;
102 return ObjectTypeBuilderBase::inherits<U>(offset);
112 using ArgsType =
typename boost::function_types::parameter_types<F>::type;
113 using DecoratedClassType =
typename boost::mpl::front<ArgsType>::type;
114 using ClassType =
typename boost::remove_reference<DecoratedClassType>::type;
115 builder.template inherits<ClassType>();
119 template <
typename T>
120 template <
typename FUNCTION_TYPE>
126 detail::checkRegisterParent<FUNCTION_TYPE>(
128 typename boost::function_types::is_member_function_pointer<FUNCTION_TYPE >::type());
134 template <
typename T>
135 template <
typename FUNCTION_TYPE>
141 detail::checkRegisterParent<FUNCTION_TYPE>(
143 typename boost::function_types::is_member_function_pointer<FUNCTION_TYPE >::type());
149 template <
typename T>
163 typename boost::enable_if<typename detail::Accessor<A>::is_accessor,
SignalBase*>::type
166 using class_type =
typename detail::Accessor<A>::class_type;
167 return &detail::Accessor<A>::access((class_type*)instance, acc);
171 typename boost::enable_if<typename detail::Accessor<A>::is_accessor, PropertyBase*>::type
174 using class_type =
typename detail::Accessor<A>::class_type;
175 return &detail::Accessor<A>::access((class_type*)instance, acc);
183 using FunctionType =
typename detail::Accessor<A>::value_type::FunctionType;
188 template <
typename A>
193 using PropertyType =
typename detail::Accessor<A>::value_type::PropertyType;
211 static const char* interfaceMarker =
"_interface_";
212 static const auto interfaceMarkerLength = strlen(interfaceMarker);
226 static const unsigned value = 2;
233 static const unsigned value = 1;
237 static const unsigned value = 0;
247 std::string n =
name;
248 if (n.size() > interfaceMarkerLength && n.substr(0, interfaceMarkerLength) == interfaceMarker)
249 n = name.substr(interfaceMarkerLength);
254 std::string n =
name;
255 if (n.size() > interfaceMarkerLength && n.substr(0, interfaceMarkerLength) == interfaceMarker)
256 n = name.substr(interfaceMarkerLength);
261 return advertise(builder, name, accessor,
286 #endif // _QITYPE_DETAIL_OBJECTTYPEBUILDER_HXX_
unsigned int xAdvertiseProperty(const std::string &name, const qi::Signature &signature, PropertyMemberGetter getter, int id=-1)
void buildFor(bool autoRegister=true)
Declare the class type for which this StaticBuilder is.
qi::Strand * callWithVoid(qi::Strand *(T::*member)() const, void *instance)
bool registerType(const TypeIndex &typeId, TypeInterface *type)
Runtime Type factory setter.
#define qiLogCategory(Cat)
void xBuildFor(TypeInterface *type, bool autoRegister, qi::AnyFunction strandAccessor)
boost::function< SignalBase *(void *)> SignalMemberGetter
AnyObject object(T *ptr, boost::function< void(GenericObject *)> onDestroy=boost::function< void(GenericObject *)>())
unsigned int advertiseMethod(const std::string &name, FUNCTION_TYPE function, MetaCallType threadingModel=MetaCallType_Auto, int id=-1)
virtual void registerType()
Register type to typeOf<T>, to avoid both TypeImpl<T> and type() being present.
ObjectTypeBuilderBase & advertise(const std::string &name, T element)
unsigned int advertiseId(const std::string &name, T element)
Object is thread safe, multiple calls can occur in different threads in parallel. ...
AnyObject object(void *ptr, boost::function< void(GenericObject *)> onDestroy=boost::function< void(GenericObject *)>())
TypeIndex typeIdRuntime(const T &val)
void checkRegisterParent(ObjectTypeBuilder< T > &, boost::false_type)
boost::function< PropertyBase *(void *)> PropertyMemberGetter
void inherits(std::ptrdiff_t offset)
unsigned int advertiseSignal(const std::string &eventName, A accessor, int id=-1, bool isSignalProperty=false)
void setThreadingModel(ObjectThreadingModel model)
boost::enable_if< typename detail::Accessor< A >::is_accessor, SignalBase * >::type signalAccess(A acc, void *instance)
unsigned int xAdvertiseSignal(const std::string &name, const qi::Signature &signature, SignalMemberGetter getter, int id=-1, bool isSignalProperty=false)
static AnyFunction from(F &&func)
Object is not thread safe, all method calls must occur in the same thread.
unsigned int advertiseMethod(const std::string &name, FUNCTION_TYPE function, MetaCallType threadingModel=MetaCallType_Auto, int id=-1)
unsigned int advertiseProperty(const std::string &propertyName, A accessor)
unsigned int advertiseBounce(ObjectTypeBuilderBase *builder, const std::string &name, A accessor, boost::true_type)
unsigned int advertise(ObjectTypeBuilderBase *builder, const std::string &name, A accessor, Dummy< 0 >)
boost::enable_if< boost::is_base_of< Actor, T >, AnyFunction >::type getStrandAccessor()
boost::enable_if< typename detail::Accessor< A >::is_accessor, PropertyBase * >::type propertyAccess(A acc, void *instance)
std::enable_if< std::is_function< RF >::value, boost::function< RF > >::type bind(AF &&fun, Arg0 &&arg0, Args &&...args)
unsigned int xAdvertiseMethod(MetaMethodBuilder &builder, AnyFunction func, MetaCallType threadingModel=MetaCallType_Auto, int id=-1)