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