#include <OMKPluginsLoader.h>
Collaboration diagram for OMK::PluginsLoaderClass:
Public Member Functions | |
virtual | ~PluginsLoaderClass () |
Destructor. | |
void | init (Controller &ctrl) |
The method which does all the stuff. | |
Protected Member Functions | |
PluginsLoaderClass () | |
Contructor. | |
Protected Attributes | |
std::vector< OBT::Plugin * > | _plugins |
The sets of loaded plugins. | |
bool | _isInitiliased |
The flag to know if the work is done. | |
Friends | |
class | OBT::Singleton< PluginsLoaderClass > |
The singleton must be a friend to create it. |
Definition at line 19 of file OMKPluginsLoader.h.
PluginsLoaderClass::~PluginsLoaderClass | ( | ) | [virtual] |
Destructor.
Definition at line 11 of file OMKPluginsLoader.cpp.
References _plugins.
00012 { 00013 for( std::vector< OBT::Plugin* >::iterator i = _plugins.begin() ; 00014 i != _plugins.end() ; 00015 ++i ) 00016 { 00017 delete *i ; 00018 } 00019 }
OMK::PluginsLoaderClass::PluginsLoaderClass | ( | ) | [inline, protected] |
Contructor.
Set the _isInitiliased flag .
Definition at line 32 of file OMKPluginsLoader.h.
00032 : _isInitiliased( false ) {}
void PluginsLoaderClass::init | ( | Controller & | ctrl | ) |
The method which does all the stuff.
See PluginsLoader.
Definition at line 21 of file OMKPluginsLoader.cpp.
References _isInitiliased, _plugins, OMK::ParametersAccessor::get(), OMK::SimulatedObject::getConfigurationParameters(), OMASSERTM, and OMMESSAGE.
00022 { 00023 OMASSERTM( !_isInitiliased, "Cannot be initialised twice !" ) ; 00024 std::vector< std::vector< std::string > > pluginsPrm ; 00025 ParametersAccessor::get( ctrl.getConfigurationParameters(), "Plugins", pluginsPrm, &ctrl ) ; 00026 for( std::vector< std::vector< std::string > >::const_iterator prm = pluginsPrm.begin() ; 00027 prm != pluginsPrm.end() ; 00028 ++prm ) 00029 { 00030 00031 OMASSERTM( 0 < prm->size() && prm->size() <= 3, "Plugins loader\n>>>:-( Unable to read the plugins because there is a syntax error !" ) ; 00032 _plugins.push_back( new OBT::Plugin( (*prm)[0].c_str(), 00033 ( prm->size() < 2 || (*prm)[1].empty() ) ? 0 : (*prm)[1].c_str(), 00034 ( prm->size() < 3 || (*prm)[2].empty() ) ? 0 : (*prm)[2].c_str() ) ) ; 00035 if( _plugins.back()->load() ) 00036 { // Tells which plugin has been loaded 00037 OMMESSAGE( _plugins.back()->getInformation().getPluginName() << " plugin is loaded !" ) ; 00038 } 00039 else 00040 { 00041 // Cannot load => unload for cleaning 00042 delete _plugins.back() ; 00043 _plugins.pop_back() ; 00044 } 00045 } 00046 00047 _isInitiliased = true ; 00048 }
friend class OBT::Singleton< PluginsLoaderClass > [friend] |
std::vector< OBT::Plugin* > OMK::PluginsLoaderClass::_plugins [protected] |
The sets of loaded plugins.
Definition at line 34 of file OMKPluginsLoader.h.
Referenced by init(), and ~PluginsLoaderClass().
bool OMK::PluginsLoaderClass::_isInitiliased [protected] |
The flag to know if the work is done.
Definition at line 36 of file OMKPluginsLoader.h.
Referenced by init().
Documentation generated on Mon Jun 9 11:46:01 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |