2009-11-18 18:53:56 +01:00
|
|
|
// module.cpp
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "module.h"
|
|
|
|
|
|
|
|
namespace mongo {
|
|
|
|
|
2009-11-18 23:08:58 +01:00
|
|
|
std::list<Module*> * Module::_all;
|
2009-11-18 18:53:56 +01:00
|
|
|
|
|
|
|
Module::Module( const string& name )
|
|
|
|
: _name( name ) , _options( (string)"Module " + name + " options" ){
|
2009-11-18 23:08:58 +01:00
|
|
|
if ( ! _all )
|
|
|
|
_all = new list<Module*>();
|
|
|
|
_all->push_back( this );
|
2009-11-18 18:53:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Module::~Module(){}
|
|
|
|
|
|
|
|
void Module::addOptions( program_options::options_description& options ){
|
2009-11-18 23:08:58 +01:00
|
|
|
for ( list<Module*>::iterator i=_all->begin(); i!=_all->end(); i++ ){
|
2009-11-18 18:53:56 +01:00
|
|
|
Module* m = *i;
|
|
|
|
options.add( m->_options );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Module::configAll( program_options::variables_map& params ){
|
2009-11-18 23:08:58 +01:00
|
|
|
for ( list<Module*>::iterator i=_all->begin(); i!=_all->end(); i++ ){
|
2009-11-18 18:53:56 +01:00
|
|
|
Module* m = *i;
|
|
|
|
m->config( params );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Module::initAll(){
|
2009-11-18 23:08:58 +01:00
|
|
|
for ( list<Module*>::iterator i=_all->begin(); i!=_all->end(); i++ ){
|
2009-11-18 18:53:56 +01:00
|
|
|
Module* m = *i;
|
|
|
|
m->init();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|