Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ToolRegistry Class Reference

#include <ToolRegistry.h>

List of all members.

Public Types

typedef ToolRegistry::dynamicAccess DynamicAccess

Public Methods

void registerTool (const int id, ToolInterface *tool, const bool isDynamicallyLoaded=false, const DynamicAccess *dynamicAccess=0)
void unregisterTool (const int id)
void unregisterAllTools ()
ToolInterfacegetTool (const int id) const
QVector< ToolInterface > * getTools () const

Static Public Methods

ToolRegistry * getInstance ()
void destroyInstance ()

Private Types

typedef QMap< int, RegistryEntryRegistry

Private Methods

 ToolRegistry ()
virtual ~ToolRegistry ()
void deleteEntry (Registry::Iterator it)

Private Attributes

Registry registry


Detailed Description

This class registers all loaded tools, so they can be unloaded when not needed anymore.

Author:
Oliver Knoll
Version:
1.2


Member Typedef Documentation

typedef struct ToolRegistry::dynamicAccess ToolRegistry::DynamicAccess
 

typedef QMap<int,RegistryEntry> ToolRegistry::Registry [private]
 


Constructor & Destructor Documentation

ToolRegistry::ToolRegistry   [private]
 

virtual ToolRegistry::~ToolRegistry   [private, virtual]
 


Member Function Documentation

void ToolRegistry::deleteEntry Registry::Iterator    it [private]
 

void ToolRegistry::destroyInstance   [static]
 

Destroys the instance of this ToolRegistry, if there is one. Also deletes all the registered ToolInterfaces.

ToolRegistry* ToolRegistry::getInstance   [static]
 

This method creates an instance of this ToolRegistry, if necessary, and returns it. Only one instance at a time exists.

Returns:
an instance of this ToolRegistry

ToolInterface* ToolRegistry::getTool const int    id const
 

Returns an instance of ToolInterface with the ID id. The instance is 0 if the tool with ID id was not found in this ToolRegistry.

Parameters:
id  the ID of the ToolInterface which is to be returned
Returns:
the ToolInterface with ID id; may be 0, which means that the id does not denote a registered ToolInterface

QVector<ToolInterface>* ToolRegistry::getTools   const
 

Returns a vector containing references to instances of the registered tools. The returned vector must be deleted after use.

Returns:
a QVector containing all registered ToolInterfaces; must be deleted after use

void ToolRegistry::registerTool const int    id,
ToolInterface   tool,
const bool    isDynamicallyLoaded = false,
const DynamicAccess   dynamicAccess = 0
 

Registers an instance of ToolInterface with ID id. If the tool is loaded from a dynamically loaded library then isDynamicallyLoaded must be set to true and a DynamicAccess must be provided.

Parameters:
id  an ID which identifies the tool to be registered
tool  a pointer to the ToolInterface which is to be registered
isDynamicallyLoaded  set to true if this tool was loaded dynamically, that is from a dynamic library; in this case a DynamicAccess must also be provided; set to false else, in which case the DynamicAccess is ignored, if provided
dynamicAccess  a pointer to the DynamicAccess, which allows to unload dynamically loaded tools
See also:
unregisterTool

void ToolRegistry::unregisterAllTools  
 

Unregisters all registered instances of ToolInterface. The tool instances themselves are deleted if they were allocated from within PointShop, or they are destroyed and the corresponding shared libraries are unloaded if the tools were allocated from a dynamically loaded library, that is, if isDynamicallyLoaded was set to true when registering the tools.

void ToolRegistry::unregisterTool const int    id
 

Unregisters the instance of ToolInterface with ID id. The tool instance itself is deleted if it was allocated from within PointShop, or it is destroyed and the corresponding shared library is unloaded if the tool was allocated from a dynamically loaded library, that is, if isDynamicallyLoaded was set to true when registering this tool.

Parameters:
id  the ID of the ToolInterface to be unregistered
See also:
registerTool


Member Data Documentation

Registry ToolRegistry::registry [private]
 


The documentation for this class was generated from the following file:
Generated on Mon Sep 30 15:55:40 2002 for PointShop by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002