Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
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 36 of file berryIAdapterFactory.h.

Constructor & Destructor Documentation

◆ ~IAdapterFactory()

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

Definition at line 38 of file berryIAdapterFactory.h.

Member Function Documentation

◆ GetAdapter()

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)
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

◆ GetAdapterList()

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.

Parameters
[out]adaptersthe collection of adapter types

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