syBR::Game::PluginDescriptor Class Reference

Base plugin descriptor class. More...

#include <Plugin.hpp>

Inheritance diagram for syBR::Game::PluginDescriptor:

syBR::InputOIS::PluginDescriptor

List of all members.

Public Member Functions

 PluginDescriptor (const std::string &name, Plugin::Type type)
 Constructor.
virtual ~PluginDescriptor ()
 Destructor.
const std::string & getName () const
 Get plugin name.
const Plugin::Type getType () const
 Get plugin type.
Plugincreate (Core::Logger *pLogger) const
 Create an instance of the plugin.
void release (Plugin *pInstance, Core::Logger *pLogger) const
 Release an instance of the plugin.

Protected Member Functions

virtual PlugincreateInstance (Core::Logger *pLogger) const =0
 Create an instance of the plugin.
virtual void releaseInstance (Plugin *pInstance, Core::Logger *pLogger) const =0
 Release an instance of the plugin.

Private Attributes

Core::Loggerm_pLogger
 Pointer to the logger to be used.
std::string m_name
 Name of the plugin.
Plugin::Type m_type
 Type of the plugin.
std::vector< Plugin * > m_vPluginInstances
 List of created plugin instances.


Detailed Description

Base plugin descriptor class.

Constructor & Destructor Documentation

syBR::Game::PluginDescriptor::PluginDescriptor ( const std::string &  name,
Plugin::Type  type 
)

Constructor.

Initialize name and type of the plugin

Parameters:
name Name of the plugin
type Type of the plugin

syBR::Game::PluginDescriptor::~PluginDescriptor (  )  [virtual]

Destructor.

Reimplemented in syBR::InputOIS::PluginDescriptor.


Member Function Documentation

const std::string & syBR::Game::PluginDescriptor::getName (  )  const

Get plugin name.

Returns:
Name of the plugin

const Plugin::Type syBR::Game::PluginDescriptor::getType (  )  const

Get plugin type.

Returns:
Type of the plugin

Plugin * syBR::Game::PluginDescriptor::create ( Core::Logger pLogger  )  const

Create an instance of the plugin.

Create a new instance of the plugin and keep track of it.

Parameters:
pLogger Pointer to the instance of the logger to use
Returns:
One of these:
  • Pointer to a newly created instance of the plugin in case of success
  • NULL otherwise
See also:
createInstance()

void syBR::Game::PluginDescriptor::release ( Plugin pInstance,
Core::Logger pLogger 
) const

Release an instance of the plugin.

Check if the instance has been created by this plugin descriptor and then release it if it is the case.

Parameters:
pInstance Instance of the plugin to release
pLogger Pointer to the instance of the logger to use
See also:
releaseInstance()

virtual Plugin* syBR::Game::PluginDescriptor::createInstance ( Core::Logger pLogger  )  const [protected, pure virtual]

Create an instance of the plugin.

The create() function will take care of keeping a copy of the created instance of the plugin. This function must be overridden to create an instance of a subclass of Plugin().

Parameters:
pLogger Pointer to the instance of the logger to use
Returns:
Created instance of the plugin

Implemented in syBR::InputOIS::PluginDescriptor.

virtual void syBR::Game::PluginDescriptor::releaseInstance ( Plugin pInstance,
Core::Logger pLogger 
) const [protected, pure virtual]

Release an instance of the plugin.

The release() function will take care of verifying that pInstance is a valid instance of the plugin. This function must be overridden to delete an instance of a subclass of Plugin().

Parameters:
pInstance Instance of the plugin to release
pLogger Pointer to the instance of the logger to use

Implemented in syBR::InputOIS::PluginDescriptor.


Member Data Documentation

Core::Logger* syBR::Game::PluginDescriptor::m_pLogger [private]

Pointer to the logger to be used.

std::string syBR::Game::PluginDescriptor::m_name [private]

Name of the plugin.

Plugin::Type syBR::Game::PluginDescriptor::m_type [private]

Type of the plugin.

std::vector<Plugin *> syBR::Game::PluginDescriptor::m_vPluginInstances [mutable, private]

List of created plugin instances.


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

Copyright © 2008 by Sebastien Frippiat
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:33 2008