GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AlgId.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2024, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <c.andreopoulos \at cern.ch>
7  University of Liverpool
8 */
9 //____________________________________________________________________________
10 
11 #include <sstream>
12 
14 
15 using std::ostringstream;
16 
17 using namespace genie;
18 
19 //____________________________________________________________________________
20 namespace genie
21 {
22  ostream & operator << (ostream & stream, const AlgId & algid)
23  {
24  algid.Print(stream);
25  return stream;
26  }
27 }
28 //____________________________________________________________________________
30 {
31  this->Init();
32 }
33 //____________________________________________________________________________
34 AlgId::AlgId(string name, string config)
35 {
36  this->SetId(name,config);
37 }
38 //____________________________________________________________________________
39 AlgId::AlgId(const AlgId & id)
40 {
41  this->Copy(id);
42 }
43 //____________________________________________________________________________
44 AlgId::AlgId(const RgAlg & registry_item)
45 {
46  this->Copy(registry_item);
47 }
48 //____________________________________________________________________________
50 {
51 
52 }
53 //____________________________________________________________________________
54 void AlgId::SetName(string name)
55 {
56  this->SetId(name, this->Config());
57 }
58 //____________________________________________________________________________
59 void AlgId::SetConfig(string config)
60 {
61  this->SetId(this->Name(), config);
62 }
63 //____________________________________________________________________________
64 void AlgId::SetId(string name, string config)
65 {
66  this->fName = name;
67  this->fConfig = config;
68 
69  this->UpdateKey();
70 }
71 //____________________________________________________________________________
72 void AlgId::Copy(const AlgId & id)
73 {
74  this->fName = id.Name();
75  this->fConfig = id.Config();
76 
77  this->UpdateKey();
78 }
79 //____________________________________________________________________________
80 void AlgId::Copy(const RgAlg & registry_item)
81 {
82  this->fName = registry_item.name;
83  this->fConfig = registry_item.config;
84 
85  this->UpdateKey();
86 }
87 //____________________________________________________________________________
88 void AlgId::Print(ostream & stream) const
89 {
90  stream << this->Key();
91 }
92 //____________________________________________________________________________
93 void AlgId::UpdateKey(void)
94 {
95  ostringstream key;
96 
97  key << this->Name();
98  if(this->Config().size() > 0) key << "/" << this->Config();
99 
100  fKey = key.str();
101 }
102 //____________________________________________________________________________
103 void AlgId::Init(void)
104 {
105  this->fName = "";
106  this->fConfig = "";
107  this->fKey = "";
108 }
109 //____________________________________________________________________________
void SetName(string name)
Definition: AlgId.cxx:54
string fName
Algorithm name (including namespaces)
Definition: AlgId.h:62
string fConfig
Configuration set name.
Definition: AlgId.h:63
void Print(ostream &stream) const
Definition: AlgId.cxx:88
string Name(void) const
Definition: AlgId.h:44
void SetId(string name, string config="")
Definition: AlgId.cxx:64
void SetConfig(string config)
Definition: AlgId.cxx:59
Algorithm ID (algorithm name + configuration set name)
Definition: AlgId.h:34
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
void Init(void)
Definition: AlgId.cxx:103
string Key(void) const
Definition: AlgId.h:46
void UpdateKey(void)
Definition: AlgId.cxx:93
string config
string Config(void) const
Definition: AlgId.h:45
string fKey
Unique key: namespace::alg_name/alg_config.
Definition: AlgId.h:64
void Copy(const AlgId &id)
Definition: AlgId.cxx:72