Files
mongo/db/module.cpp

53 lines
1.1 KiB
C++
Raw Normal View History

2009-11-18 12:53:56 -05:00
// module.cpp
#include "stdafx.h"
#include "module.h"
namespace mongo {
std::list<Module*> * Module::_all;
2009-11-18 12:53:56 -05:00
2009-11-25 10:14:08 -05:00
Module::Module( const string& name )
2009-11-18 12:53:56 -05:00
: _name( name ) , _options( (string)"Module " + name + " options" ){
if ( ! _all )
_all = new list<Module*>();
_all->push_back( this );
2009-11-18 12:53:56 -05:00
}
Module::~Module(){}
2009-11-25 10:14:08 -05:00
2009-11-18 12:53:56 -05:00
void Module::addOptions( program_options::options_description& options ){
2009-11-25 10:14:08 -05:00
if ( ! _all ) {
return;
}
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-25 10:14:08 -05:00
if ( ! _all ) {
return;
}
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-25 10:14:08 -05:00
if ( ! _all ) {
return;
}
for ( list<Module*>::iterator i=_all->begin(); i!=_all->end(); i++ ){
2009-11-18 12:53:56 -05:00
Module* m = *i;
m->init();
}
}
}