Marlin  1.17.1
 All Classes Namespaces Functions Variables Enumerations Friends Pages
CMProcessor.h
1 #ifndef CMPROCESSOR_H
2 #define CMPROCESSOR_H
3 
4 #include "marlin/Processor.h"
5 #include "marlin/ProcessorMgr.h"
6 
7 namespace marlin{
8  typedef std::set< std::string > sSet;
9  typedef std::map< std::string, bool > sbMap;
10  typedef std::map< std::string, std::string > ssMap;
11  typedef std::map< std::string, std::shared_ptr<StringParameters> > sSPMap;
12 
21  class CMProcessor{
22 
23  public:
24  // Destructor
25  ~CMProcessor();
26 
28  static CMProcessor* instance() ;
29 
31  Processor* getProc( const std::string& type );
32 
34  ssMap getProcDesc(){ return _mpDescriptions; }
35 
37  std::shared_ptr<StringParameters> getSParams( const std::string& type );
38 
41  std::shared_ptr<StringParameters> mergeParams( const std::string& type, std::shared_ptr<StringParameters> sp );
42 
45  ProcessorParameter* getParam( const std::string& type, const std::string& key );
46 
49  const std::string getParamD( const std::string& type, const std::string& key );
50 
53  const std::string getParamT( const std::string& type, const std::string& key );
54 
57  int getParamSetSize( const std::string& type, const std::string& key );
58 
61  bool isParamVec( const std::string& type, const std::string& key );
62 
65  bool isParamOpt( const std::string& type, const std::string& key );
66 
68  bool isInstalled( const std::string& type );
69 
70  //utility function to tokenize strings
71  void tokenize( const std::string str, StringVec& tokens, const std::string& delimiters = " " );
72 
73  private:
74  // Constructor
75  CMProcessor();
76 
77  static CMProcessor* _me; //singleton instance
78  ProcessorMap _mProcs{}; //processor instances
79  ssMap _mpDescriptions{}; //processor descriptions
80  sbMap _mpStatus{}; //processor status ( INSTALLED=true ; NOT_INSTALLED=false )
81  sSPMap _mpSParameters{}; //processor string parameters
82 
83  sSet _mpTypes{}; //all processor types
84 
85  }; // end class CMProcessor
86 
87 } // end namespace marlin
88 #endif
static CMProcessor * instance()
return the instance of this class
Definition: CMProcessor.cc:11
This singleton class contains an instance of every available marlin processor type.
Definition: CMProcessor.h:21
const std::string getParamT(const std::string &type, const std::string &key)
returns the type of the parameter with the given key for the processor with the given type ...
Definition: CMProcessor.cc:173
ssMap getProcDesc()
returns a map with the processor descriptions
Definition: CMProcessor.h:34
bool isInstalled(const std::string &type)
returns true if the processor with the given type is installed
Definition: CMProcessor.cc:85
ProcessorParameter * getParam(const std::string &type, const std::string &key)
returns the parameter with the given key of the processor with the given type
Definition: CMProcessor.cc:152
Processor * getProc(const std::string &type)
returns the instance of the processor with the given type
Definition: CMProcessor.cc:92
const std::string getParamD(const std::string &type, const std::string &key)
returns the description of the parameter with the given key for the processor with the given type ...
Definition: CMProcessor.cc:165
Class that holds a steering variable for a marlin processor - automatically created by Processor::reg...
Definition: ProcessorParameter.h:27
int getParamSetSize(const std::string &type, const std::string &key)
returns the set_size of the parameter with the given key for the processor with the given type ...
Definition: CMProcessor.cc:181
std::shared_ptr< StringParameters > mergeParams(const std::string &type, std::shared_ptr< StringParameters > sp)
merges the given parameters with the default ones from the processor with the given type ...
Definition: CMProcessor.cc:106
bool isParamOpt(const std::string &type, const std::string &key)
returns true if the parameter with the given key for the processor with the given type is optional ...
Definition: CMProcessor.cc:189
Base class for Marlin processors.
Definition: Processor.h:64
bool isParamVec(const std::string &type, const std::string &key)
returns true if the parameter with the given key for the processor with the given type is a vector ...
Definition: CMProcessor.cc:198
std::shared_ptr< StringParameters > getSParams(const std::string &type)
returns the parameters for the processor of the given type
Definition: CMProcessor.cc:99