9 CMProcessor* CMProcessor::_me = NULL;
18 CMProcessor::CMProcessor(){
21 _mpTypes = ProcessorMgr::instance()->getAvailableProcessorTypes();
23 for( sSet::const_iterator p = _mpTypes.begin() ; p != _mpTypes.end() ; p++ ){
25 Processor* pp = ProcessorMgr::instance()->getProcessor( (*p) );
33 _mpStatus[ (*p) ] =
true;
39 _mpSParameters[ (*p) ] = std::make_shared<StringParameters>();
42 _mProcs[ (*p) ]->setProcessorParameters( _mpSParameters[ (*p) ] );
43 _mProcs[ (*p) ]->updateParameters();
47 _mpSParameters[ (*p) ]->getStringKeys( keys );
50 for(
unsigned i=0; i<keys.
size(); i++ ){
56 if( isParamVec( *p, keys[i] )){
57 tokenize( getParam( (*p), keys[i] )->defaultValue(), values );
60 values.
push_back( getParam( (*p), keys[i] )->defaultValue() );
63 _mpSParameters[ (*p) ]->add(values);
68 _mProcs[ (*p) ] = NULL;
71 _mpStatus[ (*p) ] =
false;
74 _mpDescriptions[ (*p) ] =
"This processor is NOT installed!! Please install it before using it...";
77 _mpSParameters[ (*p) ] = NULL;
83 CMProcessor::~CMProcessor(){}
85 bool CMProcessor::isInstalled(
const string& type ){
86 if( _mpStatus.find( type ) != _mpStatus.end() ){
87 return _mpStatus[ type ];
92 Processor* CMProcessor::getProc(
const string& type ){
93 if( isInstalled( type )){
94 return _mProcs[ type ];
100 if( isInstalled( type )){
101 return _mpSParameters[ type ];
107 if( isInstalled( type )){
111 _mpSParameters[ type ]->getStringKeys( keys );
114 for(
unsigned i=0; i<keys.
size(); i++ ){
117 if( !sp->isParameterSet( keys[i] )){
121 _mpSParameters[ type ]->getStringVals( keys[i], values );
124 sp->add( keys[i], values);
132 if( isParamOpt( type, keys[i] )){
135 sp->add(
"Opt_Params_Set", optParams );
153 if( isInstalled( type )){
154 ProcParamMap::const_iterator p = _mProcs[ type ]->procMap().find( key );
155 if( p != _mProcs[ type ]->procMap().
end() ){
165 const string CMProcessor::getParamD(
const string& type,
const string& key ){
170 return "Sorry, no description for this parameter";
173 const string CMProcessor::getParamT(
const string& type,
const string& key ){
178 return "Undefined!!";
181 int CMProcessor::getParamSetSize(
const string& type,
const string& key ){
189 bool CMProcessor::isParamOpt(
const string& type,
const string& key ){
201 if( par->
type() ==
"StringVec" || par->
type() ==
"FloatVec" || par->
type() ==
"IntVec" ){
212 void CMProcessor::tokenize(
const string str,
StringVec& tokens,
const string& delimiters ){
216 string::size_type pos = str.
find_first_of(delimiters, lastPos);
218 while( string::npos != pos || string::npos != lastPos ){
virtual const std::string type()=0
This singleton class contains an instance of every available marlin processor type.
T find_first_not_of(T...args)
virtual Processor * newProcessor()=0
Return a new instance of the processor.
T find_first_of(T...args)
const std::string & description()
Description of processor.
virtual const std::string & description()
Class that holds a steering variable for a marlin processor - automatically created by Processor::reg...
virtual bool isOptional()
Base class for Marlin processors.