Interface cast: Given an Intercube, retrive the an interface object which is stored there.
More...
#include <elementary/memcore/Interface.hpp>
|
|
| interface_cast (const Intercube &IC) |
| | Construct a temporary interface_cast<> object.
|
|
template<class IntercubeType> |
| | interface_cast (const WeakPtr< IntercubeType > &IT) |
| | Construct an interface_cast<> object from a pointer to some arbitrary class which is convertible to an Intercube.
|
|
| operator RefPtr< InterfaceType > () const |
| | Conversion operator to reference pointer of interface implementation.
|
| InterfaceType & | operator() () const |
| | Provide an interface object for the requested type, returning an existing one or creating a new one.
|
| template<class ... InitType> |
| InterfaceType & | operator() (InitType... args) const |
| | Provide an interface object for the requested type, returning an existing one or creating a new one with the given parameter as constructor argument.
|
|
|
static RefPtr< InterfaceType > | findInterface (const Intercube &IC) |
| | Static member function alternative.
|
template<class InterfaceType>
class MemCore::interface_cast< InterfaceType >
Interface cast: Given an Intercube, retrive the an interface object which is stored there.
Example:
{
int i;
};
int InterfaceExample()
{
return 0;
}
A container that holds many Interfaces.
Definition Interface.hpp:151
void addInterface(const RefPtr< InterfaceBase > &I) const
Add an interface class object.
Definition Interface.cpp:97
RefPtr< InterfaceBase > getInterface(const type_info &t)
Retrieve an interface object from a certain type.
Definition Interface.cpp:151
Interface template.
Definition Interface.hpp:74
interface_cast(const Intercube &IC)
Construct a temporary interface_cast<> object.
Definition Interface.hpp:486
StrongPtr< Object, ObjectBase > RefPtr
Convenience template typedef to use RefPtr instead of StrongPtr.
Definition RefPtr.hpp:776
Definition InterfaceExample.cpp:15
- Note
- interface_cast<> is implemented via an temporary C++ object. Make sure that the lifetime of this object is shorted than the Intercube object for which it is used, otherwise an invalid reference is used. This should be quite safe if never an object of type interface_cast<> is created explicitly.
◆ InterfaceDomain_t
template<class InterfaceType>
The domain type, i.e.
a possible base class of the given interface type, which is used to look up a certain interface. The returned interface may be an implementation of the InterfaceDomain_t.
◆ operator()() [1/2]
template<class InterfaceType>
Provide an interface object for the requested type, returning an existing one or creating a new one.
Definition OmegaPtrCheck.cpp:14
- Warning
- The Intercube object may be modified hereby!
◆ operator()() [2/2]
template<class InterfaceType>
template<class ... InitType>
Provide an interface object for the requested type, returning an existing one or creating a new one with the given parameter as constructor argument.
- Warning
- The Intercube object may be modified hereby!