OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Attributes.h
Go to the documentation of this file.
1 #ifndef OPAL_Attributes_HH
2 #define OPAL_Attributes_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: Attributes.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Namespace Attributes
13 //
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:33:37 $
17 // $Author: Andreas Adelmann $
18 //
19 // ------------------------------------------------------------------------
20 
22 #include "Parser/Token.h"
23 #include <list>
24 #include <string>
25 #include <vector>
26 
27 class PlaceRep;
28 class RangeRep;
29 class TableRowRep;
30 
31 // Namespace Attributes.
32 // ------------------------------------------------------------------------
34 // their values.
35 // Each exemplar constructor must use these functions to fill in the
36 // attribute handlers for all command attributes.
37 // This namespace is part of the interface to the class Attribute,
38 // used to store object attributes.
39 
40 namespace Attributes {
41 
43  // Initial value undefined.
44  extern Attribute makeBool(const std::string &name, const std::string &help);
45 
47  // Initial value defined.
48  extern Attribute
49  makeBool(const std::string &name, const std::string &help, bool initial);
50 
52  // Evaluate any expression and return value.
53  // If the expression is non-deferred, the value is cached.
54  // Re-evaluation takes place only if a new definition has been read.
55  bool getBool(const Attribute &);
56 
58  extern void setBool(Attribute &, bool);
59 
60 
62  // Initial value is empty array.
63  extern Attribute makeBoolArray(const std::string &name, const std::string &help);
64 
66  extern std::vector<bool> getBoolArray(const Attribute &);
67 
69  extern void setBoolArray(Attribute &, const std::vector<bool> &);
70 
71 
73  // Initial value is "#S".
74  extern Attribute makePlace(const std::string &name, const std::string &help);
75 
77  extern PlaceRep getPlace(const Attribute &);
78 
80  extern void setPlace(Attribute &, const PlaceRep &);
81 
82 
84  // Initial value is "FULL".
85  extern Attribute makeRange(const std::string &name, const std::string &help);
86 
88  extern RangeRep getRange(const Attribute &);
89 
91  extern void setRange(Attribute &, const RangeRep &);
92 
93 
95  // Initial value is undefined.
96  extern Attribute
97  makeReal(const std::string &name, const std::string &help);
98 
100  // Initial value is defined.
101  extern Attribute
102  makeReal(const std::string &name, const std::string &help, double initial);
103 
105  extern double getReal(const Attribute &attr);
106 
108  extern void setReal(Attribute &attr, double val);
109 
110 
112  // Initial value is empty array.
113  extern Attribute makeRealArray(const std::string &name, const std::string &help);
114 
116  extern std::vector<double> getRealArray(const Attribute &);
117 
119  extern void setRealArray(Attribute &, const std::vector<double> &);
120 
121 
123  // Initial value is undefined.
124  extern Attribute makeReference(const std::string &name, const std::string &help);
125 
126 
128  // Initial value undefined.
129  extern Attribute makeString(const std::string &name, const std::string &help);
130 
132  // Initial value is defined.
133  extern Attribute
134  makeString(const std::string &name, const std::string &help, const std::string &initial);
135 
137  extern std::string getString(const Attribute &attr);
138 
140  extern void setString(Attribute &attr, const std::string &val);
141 
142 
144  // Initial value is empty array.
145  extern Attribute makeStringArray(const std::string &name, const std::string &help);
146 
148  extern std::vector<std::string> getStringArray(const Attribute &);
149 
151  extern void setStringArray(Attribute &, const std::vector<std::string> &);
152 
153 
155  // Initial value is undefined.
156  extern Attribute makeTableRow(const std::string &name, const std::string &help);
157 
159  extern TableRowRep getTableRow(const Attribute &);
160 
162  extern void setTableRow(Attribute &, const TableRowRep &);
163 
164 
166  // Initial value is empty list.
167  extern Attribute makeTokenList(const std::string &name, const std::string &help);
168 
170  extern std::list<Token> getTokenList(const Attribute &attr);
171 
173  extern void setTokenList(Attribute &attr, const std::list<Token> &);
174 
175 
177  // Initial value is empty array.
178  extern Attribute makeTokenListArray(const std::string &name, const std::string &help);
179 
181  extern std::vector<std::list<Token> >
182  getTokenListArray(const Attribute &attr);
183 
185  extern void
186  setTokenListArray(Attribute &attr, const std::vector<std::list<Token> > &);
187 
188 };
189 
190 #endif // OPAL_Attributes_HH
void setReal(Attribute &attr, double val)
Set real value.
Definition: Attributes.cpp:236
void setStringArray(Attribute &attr, const std::vector< std::string > &value)
Set string array value.
Definition: Attributes.cpp:423
RangeRep getRange(const Attribute &attr)
Get range value.
Definition: Attributes.cpp:177
void setRange(Attribute &attr, const RangeRep &rep)
Set range value.
Definition: Attributes.cpp:192
void setTokenList(Attribute &attr, const std::list< Token > &val)
Set token list value.
Definition: Attributes.cpp:492
std::list< Token > getTokenList(const Attribute &attr)
Return token list value.
Definition: Attributes.cpp:477
std::vector< bool > getBoolArray(const Attribute &attr)
Get logical array value.
Definition: Attributes.cpp:106
Attribute makeRange(const std::string &name, const std::string &help)
Create a range attribute.
Definition: Attributes.cpp:171
void setString(Attribute &attr, const std::string &val)
Set string value.
Definition: Attributes.cpp:356
Representation of a table row reference.
Definition: TableRowRep.h:36
TableRowRep getTableRow(const Attribute &attr)
Get table row value.
Definition: Attributes.cpp:442
bool getBool(const Attribute &attr)
Return logical value.
Definition: Attributes.cpp:66
PlaceRep getPlace(const Attribute &attr)
Get place value.
Definition: Attributes.cpp:143
Representation of a place within a beam line or sequence.
Definition: PlaceRep.h:41
Attribute makeStringArray(const std::string &name, const std::string &help)
Create a string array attribute.
Definition: Attributes.cpp:373
Attribute makeBoolArray(const std::string &name, const std::string &help)
Create a logical array attribute.
Definition: Attributes.cpp:101
A representation of an Object attribute.
Definition: Attribute.h:55
void setTableRow(Attribute &attr, const TableRowRep &rep)
Set table row value.
Definition: Attributes.cpp:458
std::vector< std::string > getStringArray(const Attribute &attr)
Get string array value.
Definition: Attributes.cpp:378
void setBoolArray(Attribute &attr, const std::vector< bool > &value)
Set logical array value.
Definition: Attributes.cpp:122
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
Definition: Attributes.cpp:258
void setRealArray(Attribute &attr, const std::vector< double > &value)
Set array value.
Definition: Attributes.cpp:273
Representation of a range within a beam line or sequence.
Definition: RangeRep.h:34
void setPlace(Attribute &attr, const PlaceRep &rep)
Set place value.
Definition: Attributes.cpp:158
Attribute makeTableRow(const std::string &name, const std::string &help)
Create a table row attribute.
Definition: Attributes.cpp:437
std::vector< std::list< Token > > getTokenListArray(const Attribute &attr)
Return token list array value.
Definition: Attributes.cpp:510
Attribute makePlace(const std::string &name, const std::string &help)
Create a place attribute.
Definition: Attributes.cpp:137
Attribute makeTokenListArray(const std::string &name, const std::string &help)
Make token list attribute.
Definition: Attributes.cpp:505
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
Definition: Attributes.cpp:56
void setBool(Attribute &attr, bool val)
Set logical value.
Definition: Attributes.cpp:85
const std::string name
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
Definition: Attributes.cpp:253
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:217
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Definition: Attributes.cpp:296
Attribute makeReference(const std::string &name, const std::string &help)
Create a reference attribute.
Definition: Attributes.cpp:288
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Definition: Attributes.cpp:205
void setTokenListArray(Attribute &attr, const std::vector< std::list< Token > > &value)
Set token list array value.
Definition: Attributes.cpp:526
Attribute makeTokenList(const std::string &name, const std::string &help)
Make token list attribute.
Definition: Attributes.cpp:472
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:307