OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
ValueDefinition.cpp
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2// $RCSfile: ValueDefinition.cpp,v $
3// ------------------------------------------------------------------------
4// $Revision: 1.1.1.1 $
5// ------------------------------------------------------------------------
6// Copyright: see Copyright.readme
7// ------------------------------------------------------------------------
8//
9// Class: ValueDefinition
10// The abstract base class for all OPAL value definitions.
11//
12// ------------------------------------------------------------------------
13//
14// $Date: 2000/03/27 09:33:35 $
15// $Author: Andreas Adelmann $
16//
17// ------------------------------------------------------------------------
18
21#include "Parser/Statement.h"
23
24
25// Class ValueDefinition
26// ------------------------------------------------------------------------
27
29{}
30
31
32const std::string ValueDefinition::getCategory() const {
33 return "VARIABLE";
34}
35
36
38 return false;
39
40}
41
43 return false;
44}
45
46
48 throw OpalException("ValueDefinition::getBool()",
49 "You cannot get a logical value from \"" +
50 getOpalName() + "\".");
51}
52
53
55 throw OpalException("ValueDefinition::getBoolComponent()",
56 "You cannot get an indexed logical value from \"" +
57 getOpalName() + "\".");
58}
59
60
62 throw OpalException("ValueDefinition::getReal()",
63 "You cannot get a real value from \"" +
64 getOpalName() + "\".");
65}
66
67
69 throw OpalException("ValueDefinition::getReal()",
70 "You cannot get an indexed real value from \"" +
71 getOpalName() + "\".");
72}
73
74
75std::string ValueDefinition::getString() const {
76 throw OpalException("ValueDefinition::getString()",
77 "You cannot get a string value from \"" +
78 getOpalName() + "\".");
79}
80
81
83 throw OpalException("ValueDefinition::getString()",
84 "You cannot get an indexed string value from \"" +
85 getOpalName() + "\".");
86}
87
88
90 return itsAttr[0];
91}
92
93
95 return itsAttr[0];
96}
97
98
100(int size, const char *name, const char *help):
101 Object(size, name, help)
102{}
103
104
106 Object(name, parent)
107{}
const std::string name
A representation of an Object attribute.
Definition: Attribute.h:52
The base class for all OPAL objects.
Definition: Object.h:48
const std::string & getOpalName() const
Return object name.
Definition: Object.cpp:310
std::vector< Attribute > itsAttr
The object attributes.
Definition: Object.h:216
The base class for all OPAL value definitions.
virtual double getReal() const
Return real value.
virtual bool shouldTrace() const
Trace flag.
virtual bool getBool() const
Return logical value.
Attribute & value()
Return the attribute representing the value of the definition.
virtual double getRealComponent(int) const
Return indexed real value.
virtual const std::string getCategory() const
Return the object category as a string.
virtual std::string getStringComponent(int) const
Return indexed string value.
virtual std::string getString() const
Return string value.
virtual bool getBoolComponent(int) const
Return indexed logical value.
virtual ~ValueDefinition()
virtual bool shouldUpdate() const
Update flag.
The base class for all OPAL exceptions.
Definition: OpalException.h:28