0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/db/module.cpp

53 lines
1.1 KiB
C++
Raw Normal View History

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