AlgId.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2019, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5  or see $GENIE/LICENSE
6 
7  Author: Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
8  University of Liverpool & STFC Rutherford Appleton Lab - October 20, 2005
9 
10  For the class documentation see the corresponding header file.
11 
12  Important revisions after version 2.0.0 :
13 
14 */
15 //____________________________________________________________________________
16 
17 #include <sstream>
18 
20 
21 using std::ostringstream;
22 
23 using namespace genie;
24 
25 //____________________________________________________________________________
26 namespace genie
27 {
28  ostream & operator << (ostream & stream, const AlgId & algid)
29  {
30  algid.Print(stream);
31  return stream;
32  }
33 }
34 //____________________________________________________________________________
36 {
37  this->Init();
38 }
39 //____________________________________________________________________________
40 AlgId::AlgId(string name, string config)
41 {
42  this->SetId(name,config);
43 }
44 //____________________________________________________________________________
45 AlgId::AlgId(const AlgId & id)
46 {
47  this->Copy(id);
48 }
49 //____________________________________________________________________________
50 AlgId::AlgId(const RgAlg & registry_item)
51 {
52  this->Copy(registry_item);
53 }
54 //____________________________________________________________________________
56 {
57 
58 }
59 //____________________________________________________________________________
60 void AlgId::SetName(string name)
61 {
62  this->SetId(name, this->Config());
63 }
64 //____________________________________________________________________________
66 {
67  this->SetId(this->Name(), config);
68 }
69 //____________________________________________________________________________
70 void AlgId::SetId(string name, string config)
71 {
72  this->fName = name;
73  this->fConfig = config;
74 
75  this->UpdateKey();
76 }
77 //____________________________________________________________________________
78 void AlgId::Copy(const AlgId & id)
79 {
80  this->fName = id.Name();
81  this->fConfig = id.Config();
82 
83  this->UpdateKey();
84 }
85 //____________________________________________________________________________
86 void AlgId::Copy(const RgAlg & registry_item)
87 {
88  this->fName = registry_item.name;
89  this->fConfig = registry_item.config;
90 
91  this->UpdateKey();
92 }
93 //____________________________________________________________________________
94 void AlgId::Print(ostream & stream) const
95 {
96  stream << this->Key();
97 }
98 //____________________________________________________________________________
99 void AlgId::UpdateKey(void)
100 {
101  ostringstream key;
102 
103  key << this->Name();
104  if(this->Config().size() > 0) key << "/" << this->Config();
105 
106  fKey = key.str();
107 }
108 //____________________________________________________________________________
109 void AlgId::Init(void)
110 {
111  this->fName = "";
112  this->fConfig = "";
113  this->fKey = "";
114 }
115 //____________________________________________________________________________
const XML_Char * name
Definition: expat.h:151
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
void SetName(string name)
Definition: AlgId.cxx:60
string fName
Algorithm name (including namespaces)
Definition: AlgId.h:63
string fConfig
Configuration set name.
Definition: AlgId.h:64
Definition: config.py:1
void Print(ostream &stream) const
Definition: AlgId.cxx:94
string Name(void) const
Definition: AlgId.h:45
void SetId(string name, string config="")
Definition: AlgId.cxx:70
void SetConfig(string config)
Definition: AlgId.cxx:65
Algorithm ID (algorithm name + configuration set name)
Definition: AlgId.h:35
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
void Init(void)
Definition: AlgId.cxx:109
string Key(void) const
Definition: AlgId.h:47
void UpdateKey(void)
Definition: AlgId.cxx:99
string config
string Config(void) const
Definition: AlgId.h:46
string fKey
Unique key: namespace::alg_name/alg_config.
Definition: AlgId.h:65
void Copy(const AlgId &id)
Definition: AlgId.cxx:78