Public Types | Public Member Functions | Static Public Member Functions

interface_cast< InterfaceType > Class Template Reference

Interface cast: Given an Intercube, retrive the an interface object which is stored there. More...

#include <memcore/Interface.hpp>

List of all members.

Public Types

Public Member Functions

Static Public Member Functions


Detailed Description

template<class InterfaceType>
class interface_cast< InterfaceType >

Interface cast: Given an Intercube, retrive the an interface object which is stored there.

Example:

struct  myInterface : Interface<int> 
{
        int i;
};


int InterfaceExample()
{
Intercube Alpha; 

        Alpha.addInterface( new myInterface() ); 

RefPtr<myInterface> m = Alpha.getInterface( typeid(int) ); 

RefPtr<myInterface> n = interface_cast<myInterface>( Alpha ); 

        return 0;
}
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.
Examples:

ComputeGridStreamLines.cpp, and ComputeMultiStreamLines.cpp.


Member Typedef Documentation

template<class InterfaceType >
typedef InterfaceType::InterfaceDomain_t interface_cast< InterfaceType >::InterfaceDomain_t

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.


The documentation for this class was generated from the following file: