Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berry::IAdapterFactory Struct Referenceabstract

#include <berryIAdapterFactory.h>

Public Member Functions

virtual ~IAdapterFactory ()
 
virtual ObjectGetAdapter (IAdaptable *adaptableObject, const std::string &adapterType)=0
 
virtual void GetAdapterList (std::vector< const std::type_info & > &adapters)=0
 

Detailed Description

An adapter factory defines behavioral extensions for one or more classes that implements the IAdaptable interface. Adapter factories are registered with an adapter manager.

This interface can be used without OSGi running.

Clients may implement this interface.

See also
IAdapterManager
IAdaptable

Definition at line 40 of file berryIAdapterFactory.h.

Constructor & Destructor Documentation

virtual berry::IAdapterFactory::~IAdapterFactory ( )
inlinevirtual

Definition at line 42 of file berryIAdapterFactory.h.

Member Function Documentation

virtual Object* berry::IAdapterFactory::GetAdapter ( IAdaptable adaptableObject,
const std::string &  adapterType 
)
pure virtual

Returns an object which can be cast to the given adapter type and which is associated with the given adaptable object. Returns 0 if no such object can be found.

A typical implementation would look like this:

void* GetAdapter(void* adaptableObject, const std::type_info& adaptableType, const std::string& adapterType) { if (Image* img = CastHelper<Image>(adaptableObject, adaptableType)) { if (adapterType == "berry::IResource") { return new IResource(img->GetPath()); } } return 0; }

Parameters
adaptableObjectthe adaptable object being queried (usually an instance of IAdaptable)
adaptableTypethe type information for the adaptable object
adapterTypethe type of adapter to look up
Returns
a object castable to the given adapter type, or 0 if this adapter factory does not have an adapter of the given type for the given object
virtual void berry::IAdapterFactory::GetAdapterList ( std::vector< const std::type_info & > &  adapters)
pure virtual

Returns the collection of adapter types handled by this factory.

This method is generally used by an adapter manager to discover which adapter types are supported, in advance of dispatching any actual getAdapter requests.

Returns
the collection of adapter types

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