OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
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
21#include <initializer_list>
22#include <list>
23#include <string>
24#include <vector>
26#include "OpalParser/Token.h"
27
28class PlaceRep;
29class RangeRep;
30class TableRowRep;
31
32// Namespace Attributes.
33// ------------------------------------------------------------------------
35// their values.
36// Each exemplar constructor must use these functions to fill in the
37// attribute handlers for all command attributes.
38// This namespace is part of the interface to the class Attribute,
39// used to store object attributes.
40
41namespace Attributes {
42
44 // Initial value undefined.
45 extern Attribute makeBool(const std::string& name, const std::string& help);
46
48 // Initial value defined.
49 extern Attribute 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
61 // Initial value is empty array.
62 extern Attribute makeBoolArray(const std::string& name, const std::string& help);
63
65 extern std::vector<bool> getBoolArray(const Attribute&);
66
68 extern void setBoolArray(Attribute&, const std::vector<bool>&);
69
71 // Initial value is "#S".
72 extern Attribute makePlace(const std::string& name, const std::string& help);
73
75 extern PlaceRep getPlace(const Attribute&);
76
78 extern void setPlace(Attribute&, const PlaceRep&);
79
81 // Initial value is "FULL".
82 extern Attribute makeRange(const std::string& name, const std::string& help);
83
85 extern RangeRep getRange(const Attribute&);
86
88 extern void setRange(Attribute&, const RangeRep&);
89
91 // Initial value is undefined.
92 extern Attribute makeReal(const std::string& name, const std::string& help);
93
95 // Initial value is defined.
96 extern Attribute makeReal(const std::string& name, const std::string& help, double initial);
97
99 extern double getReal(const Attribute& attr);
100
102 extern void setReal(Attribute& attr, double val);
103
105 // Initial value is empty array.
106 extern Attribute makeRealArray(const std::string& name, const std::string& help);
107
109 extern std::vector<double> getRealArray(const Attribute&);
110
112 extern void setRealArray(Attribute&, const std::vector<double>&);
113
115 // Initial value is undefined.
116 extern Attribute makeReference(const std::string& name, const std::string& help);
117
119 // Initial value undefined.
120 extern Attribute makeString(const std::string& name, const std::string& help);
121
123 // Initial value is defined.
124 extern Attribute makeString(
125 const std::string& name, const std::string& help, const std::string& initial);
126
128 extern std::string getString(const Attribute& attr);
129
131 extern void setString(Attribute& attr, const std::string& val);
132
134 // Initial value undefined.
136 const std::string& name, const std::string& help,
137 const std::initializer_list<std::string>& predefinedStrings);
138
140 // Initial value is defined.
142 const std::string& name, const std::string& help,
143 const std::initializer_list<std::string>& predefinedStrings,
144 const std::string& initial);
145
147 extern void setPredefinedString(Attribute& attr, const std::string& val);
148
150 // Initial value undefined.
151 extern Attribute makeUpperCaseString(const std::string& name, const std::string& help);
152
154 // Initial value is defined.
156 const std::string& name, const std::string& help, const std::string& initial);
157
159 extern void setUpperCaseString(Attribute& attr, const std::string& val);
160
162 // Initial value is empty array.
163 extern Attribute makeStringArray(const std::string& name, const std::string& help);
164
166 extern std::vector<std::string> getStringArray(const Attribute&);
167
169 extern void setStringArray(Attribute&, const std::vector<std::string>&);
170
172 // Initial value is empty array.
173 extern Attribute makeUpperCaseStringArray(const std::string& name, const std::string& help);
174
176 extern void setUpperCaseStringArray(Attribute&, const std::vector<std::string>&);
177
179 // Initial value is undefined.
180 extern Attribute makeTableRow(const std::string& name, const std::string& help);
181
183 extern TableRowRep getTableRow(const Attribute&);
184
186 extern void setTableRow(Attribute&, const TableRowRep&);
187
189 // Initial value is empty list.
190 extern Attribute makeTokenList(const std::string& name, const std::string& help);
191
193 extern std::list<Token> getTokenList(const Attribute& attr);
194
196 extern void setTokenList(Attribute& attr, const std::list<Token>&);
197
199 // Initial value is empty array.
200 extern Attribute makeTokenListArray(const std::string& name, const std::string& help);
201
203 extern std::vector<std::list<Token> > getTokenListArray(const Attribute& attr);
204
206 extern void setTokenListArray(Attribute& attr, const std::vector<std::list<Token> >&);
207
208}; // namespace Attributes
209
210#endif // OPAL_Attributes_HH
A representation of an Object attribute.
Definition Attribute.h:52
Representation of a place within a beam line or sequence.
Definition PlaceRep.h:40
Representation of a range within a beam line or sequence.
Definition RangeRep.h:33
Representation of a table row reference.
Definition TableRowRep.h:35
A collection of routines to construct object Attributes and retrieve.
Attribute makePlace(const std::string &name, const std::string &help)
Create a place attribute.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
double getReal(const Attribute &attr)
Return real value.
void setBoolArray(Attribute &attr, const std::vector< bool > &value)
Set logical array value.
void setUpperCaseStringArray(Attribute &attr, const std::vector< std::string > &value)
Set upper case string array value.
Attribute makeUpperCaseStringArray(const std::string &name, const std::string &help)
Make uppercase string array attribute.
void setRealArray(Attribute &attr, const std::vector< double > &value)
Set array value.
void setBool(Attribute &attr, bool val)
Set logical value.
std::list< Token > getTokenList(const Attribute &attr)
Return token list value.
void setTableRow(Attribute &attr, const TableRowRep &rep)
Set table row value.
Attribute makeUpperCaseString(const std::string &name, const std::string &help)
Make uppercase string attribute.
Attribute makeStringArray(const std::string &name, const std::string &help)
Create a string array attribute.
void setUpperCaseString(Attribute &attr, const std::string &val)
Set uppercase string value.
Attribute makePredefinedString(const std::string &name, const std::string &help, const std::initializer_list< std::string > &predefinedStrings)
Make predefined string attribute.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Attribute makeTableRow(const std::string &name, const std::string &help)
Create a table row attribute.
Attribute makeReference(const std::string &name, const std::string &help)
Create a reference attribute.
void setRange(Attribute &attr, const RangeRep &rep)
Set range value.
void setString(Attribute &attr, const std::string &val)
Set string value.
Attribute makeRange(const std::string &name, const std::string &help)
Create a range attribute.
Attribute makeTokenListArray(const std::string &name, const std::string &help)
Make token list attribute.
std::vector< bool > getBoolArray(const Attribute &attr)
Get logical array value.
bool getBool(const Attribute &attr)
Return logical value.
TableRowRep getTableRow(const Attribute &attr)
Get table row value.
Attribute makeTokenList(const std::string &name, const std::string &help)
Make token list attribute.
void setTokenListArray(Attribute &attr, const std::vector< std::list< Token > > &value)
Set token list array value.
void setReal(Attribute &attr, double val)
Set real value.
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
void setStringArray(Attribute &attr, const std::vector< std::string > &value)
Set string array value.
PlaceRep getPlace(const Attribute &attr)
Get place value.
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
std::vector< std::string > getStringArray(const Attribute &attr)
Get string array value.
void setPredefinedString(Attribute &attr, const std::string &val)
Set predefined string value.
std::string getString(const Attribute &attr)
Get string value.
Attribute makeBoolArray(const std::string &name, const std::string &help)
Create a logical array attribute.
std::vector< std::list< Token > > getTokenListArray(const Attribute &attr)
Return token list array value.
void setTokenList(Attribute &attr, const std::list< Token > &val)
Set token list value.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
RangeRep getRange(const Attribute &attr)
Get range value.
void setPlace(Attribute &attr, const PlaceRep &rep)
Set place value.