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) };
33 using is_interface_helper = std::is_same<T, typename T::interface_type>;
36 template<
typename T,
typename Enable =
void>
40 struct is_interface<T, typename std::enable_if<!has_interface_type<T>::value>::type> : std::false_type
45 struct is_interface<T, typename std::enable_if<has_interface_type<T>::value && !is_interface_helper<T>::value>::type> : std::false_type
50 struct 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) };
69 template<
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 };
94 template<
typename BaseClass>
95 struct 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
116 template <
typename BaseClass>
117 struct 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);
137 template <
typename Interface>
138 struct 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)
148 if (util::cStringUtil::IsEqual(ucom::get_iid<Interface>(), i_strIID))
150 o_pInterface =
static_cast<Interface*
>(
this);
157 inline tResult GetInterfaceStatic(
const char* i_strIID,
const void*& o_pInterface)
const
159 if (util::cStringUtil::IsEqual(ucom::get_iid<Interface>(), i_strIID))
161 o_pInterface =
static_cast<const Interface*
>(
this);
171 template <
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
207 template <
typename Base,
typename NextBase>
218 template<
typename Base,
typename ...Interfaces>
224 tResult GetInterface(
const char* i_strIID,
void*& o_pInterface)
233 tResult GetInterface(
const char* i_strIID,
const void*& o_pInterface)
const
249 template <
typename ...Bases>
255 template <
typename Base,
typename NextBase>
256 using derive_from_type =
typename std::conditional<std::is_same<NextBase, object_without_iobject<>>::value,
258 typename std::conditional<std::is_base_of<Base, NextBase>::value,
260 typename std::conditional<std::is_base_of<ucom::ant::IObject, Base>::value,
267 template <
typename Base,
typename NextBase>
275 template <
typename ...Bases>
281 template <
typename Base,
typename NextBase,
typename ...Bases>
283 std::conditional<!std::is_same<NextBase, Base>::value &&
284 std::is_base_of<NextBase, Base>::value,
286 parent_follows_child<Base, Bases...>>::type
291 template <
typename Base,
typename ...Bases>
293 public derive_from<Base, object_without_iobject<Bases...>>
299 "One or more of the template parameters are in the wrong order. "
300 "Make sure that derived classes are specified after their parents.");
376 template <
typename ...Bases>
381 virtual ~
object() =
default;
401 template<
typename Base,
typename... Bases>
402 using object_base_type_helper =
403 typename std::conditional<std::is_base_of<object<>, Base>::value,
404 detail::derive_from<Base, detail::object_without_iobject<Bases...>>,
405 detail::derive_from<Base,
object<Bases...>>>::type;
408 template<
typename Base,
typename... Bases>
409 class object<Base, Bases...> :
public object_base_type_helper<Base, Bases...>
412 using object_base_type_helper<Base, Bases...>::object_base_type_helper;
417 "One or more of the template parameters are in the wrong order. "
418 "Make sure that derived classes are specified after their parents.");
#define UCOM_RESOLVE(...)
Resolve a path to a base class which is inherited multiple times.
#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.
A common result class usable as return value throughout.
Base class for every interface type within the uCOM.
static tResult Get(Provider *i_pObj, const char *i_strIID, VoidType *&o_pInterface)
Get the interface with IID i_strIID exposed from i_pObj.
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 ...
This template checks if the first base implements the requested interface, otherwise checks the next ...
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
Destruct and deallocate instantiations of type IObject.
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.
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 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