25 template<
typename C>
static one test(
typename C::interface_type*);
26 template<
typename C>
static two test(...);
29 enum { value =
sizeof(test<T>(
nullptr)) ==
sizeof(
char) };
33using is_interface_helper = std::is_same<T, typename T::interface_type>;
36template<
typename T,
typename Enable =
void>
40struct is_interface<T, typename std::enable_if<!has_interface_type<T>::value>::type> : std::false_type
40struct is_interface<T, typename std::enable_if<!has_interface_type<T>::value>::type> : std::false_type {
…};
45struct is_interface<T, typename std::enable_if<has_interface_type<T>::value && !is_interface_helper<T>::value>::type> : std::false_type
45struct is_interface<T, typename std::enable_if<has_interface_type<T>::value && !is_interface_helper<T>::value>::type> : std::false_type {
…};
50struct is_interface<T, typename std::enable_if<has_interface_type<T>::value && is_interface_helper<T>::value>::type> : std::true_type
50struct is_interface<T, typename std::enable_if<has_interface_type<T>::value && is_interface_helper<T>::value>::type> : std::true_type {
…};
62 template <
typename C>
static two test(...);
65 enum { value =
sizeof(test<T>(
static_cast<tResult(T::*)(
const char*,
void*&)
>(
nullptr))) ==
sizeof(
char) };
69template<
typename BaseClass,
typename Enable =
void>
78 inline tResult GetInterfaceStatic(
const char* ,
void*& )
83 inline tResult GetInterfaceStatic(
const char* ,
const void*& )
const
89 enum { dispatch =
false };
94template<
typename BaseClass>
95struct base_dispatcher<BaseClass, typename std::enable_if<!is_interface<BaseClass>::value && !has_get_interface<BaseClass>::value>::type> :
99 using BaseClass::BaseClass;
103 inline tResult GetInterfaceStatic(
const char* ,
void*& )
108 inline tResult GetInterfaceStatic(
const char* ,
const void*& )
const
95struct base_dispatcher<BaseClass, typename std::enable_if<!is_interface<BaseClass>::value && !has_get_interface<BaseClass>::value>::type> : {
…};
116template <
typename BaseClass>
117struct base_dispatcher<BaseClass, typename std::enable_if<!is_interface<BaseClass>::value && has_get_interface<BaseClass>::value>::type> :
121 using BaseClass::BaseClass;
125 inline tResult GetInterfaceStatic(
const char* i_strIID,
void*& o_pInterface)
127 return BaseClass::GetInterface(i_strIID, o_pInterface);
130 inline tResult GetInterfaceStatic(
const char* i_strIID,
const void*& o_pInterface)
const
132 return BaseClass::GetInterface(i_strIID, o_pInterface);
117struct base_dispatcher<BaseClass, typename std::enable_if<!is_interface<BaseClass>::value && has_get_interface<BaseClass>::value>::type> : {
…};
137template <
typename Interface>
138struct base_dispatcher<Interface, typename std::enable_if<is_interface<Interface>::value>::type>:
142 using Interface::Interface;
146 inline tResult GetInterfaceStatic(
const char* i_strIID,
void*& o_pInterface)
150 o_pInterface =
static_cast<Interface*
>(
this);
157 inline tResult GetInterfaceStatic(
const char* i_strIID,
const void*& o_pInterface)
const
161 o_pInterface =
static_cast<const Interface*
>(
this);
138struct base_dispatcher<Interface, typename std::enable_if<is_interface<Interface>::value>::type>: {
…};
171template <
typename Base,
typename NextBase>
179 tResult GetInterface(
const char* i_strIID,
void*& o_pInterface)
189 tResult GetInterface(
const char* i_strIID,
const void*& o_pInterface)
const
201 #pragma GCC diagnostic push
202 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
210 #pragma GCC diagnostic pop
216template <
typename Base,
typename NextBase>
227template<
typename Base,
typename ...Interfaces>
233 tResult GetInterface(
const char* i_strIID,
void*& o_pInterface)
242 tResult GetInterface(
const char* i_strIID,
const void*& o_pInterface)
const
253 #pragma GCC diagnostic push
254 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
262 #pragma GCC diagnostic pop
267template <
typename ...Bases>
273template <
typename Base,
typename NextBase>
274using derive_from_type =
typename std::conditional<std::is_same<NextBase, object_without_iobject<>>::value,
276 typename std::conditional<std::is_base_of<Base, NextBase>::value,
278 typename std::conditional<std::is_base_of<ucom::ant::IObject, Base>::value,
285template <
typename Base,
typename NextBase>
293template <
typename ...Bases>
299template <
typename Base,
typename NextBase,
typename ...Bases>
301 std::conditional<!std::is_same<NextBase, Base>::value &&
302 std::is_base_of<NextBase, Base>::value,
304 parent_follows_child<Base, Bases...>>::type
309template <
typename Base,
typename ...Bases>
310class object_without_iobject<Base, Bases...>:
311 public derive_from<Base, object_without_iobject<Bases...>>
314 object_without_iobject()
317 "One or more of the template parameters are in the wrong order. "
318 "Make sure that derived classes are specified after their parents.");
310class object_without_iobject<Base, Bases...>: {
…};
394template <
typename ...Bases>
413 #pragma GCC diagnostic push
414 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
422 #pragma GCC diagnostic pop
427template<
typename Base,
typename... Bases>
428using object_base_type_helper =
429 typename std::conditional<std::is_base_of<object<>, Base>::value,
430 detail::derive_from<Base, detail::object_without_iobject<Bases...>>,
431 detail::derive_from<Base,
object<Bases...>>>::type;
434template<
typename Base,
typename... Bases>
435class object<Base, Bases...> :
public object_base_type_helper<Base, Bases...>
438 using object_base_type_helper<Base, Bases...>::object_base_type_helper;
443 "One or more of the template parameters are in the wrong order. "
444 "Make sure that derived classes are specified after their parents.");
435class object<Base, Bases...> :
public object_base_type_helper<Base, Bases...> {
…};
#define UCOM_RESOLVE(...)
Resolve a path to a base class which is inherited multiple times.
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
#define IS_OK(s)
Check if result is OK.
Base class for every interface type within the uCOM.
static tResult Get(Provider *i_pObj, const char *i_strIID, VoidType *&o_pInterface)
This template checks if the first base implements the requested interface, otherwise checks the next ...
This template checks if the first base implements the requested interface, otherwise checks the next ...
void Destroy() const
Possibly required override of IObject::Destroy() while destructor is still non-virtual.
This template checks if the first base implements the requested interface, otherwise checks the next ...
void Destroy() const
Possibly required override of IObject::Destroy() while destructor is still non-virtual.
template that checks whether a type has an accessible (protected or public) GetInterface method.
template that checks whether a type has an accessible interface_type property.
This template is used to prevent an ambiguous base of ucom::ant::IObject.
Use this template if you want to implement an ucom::ant::IObject based Interface and/or subclass an e...
void Destroy() const override
Switch from non-virtual destructor to virtual destructor.
tResult GetInterface(const char *i_strIID, const void *&o_pInterface) const override
Provides const correct interface querying.
tResult GetInterface(const char *i_strIID, void *&o_pInterface) override
Query interfaces on an object.
Namespace for all internally used uCOM functionality implemented.
typename std::conditional< std::is_same< NextBase, object_without_iobject<> >::value, expose_additional_interfaces< Base >, typename std::conditional< std::is_base_of< Base, NextBase >::value, expose_additional_interfaces< NextBase, Base >, typename std::conditional< std::is_base_of< ucom::ant::IObject, Base >::value, derive_from_with_hierarchy< Base, NextBase >, derive_from_without_hierarchy< Base, NextBase > >::type >::type >::type derive_from_type
this intermediate type is used to keep binary compatibility
Namespace for all functionality provided since v3.2.
Namespace for the ADTF uCOM3 SDK.
const char * get_iid()
Alias bringing the latest version of get_iid() into scope.
Namespace for entire ADTF SDK.
template that checks whether a type is an interface with an IID.
this template checks if parent interfaces are not specified before their children