OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
ValueDefinition.h
Go to the documentation of this file.
1 #ifndef OPAL_ValueDefinition_HH
2 #define OPAL_ValueDefinition_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: ValueDefinition.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: ValueDefinition
13 //
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:33:35 $
17 // $Author: Andreas Adelmann $
18 //
19 // ------------------------------------------------------------------------
20 
21 #include "AbstractObjects/Object.h"
22 
23 
24 // Class ValueDefinition
25 // ------------------------------------------------------------------------
27 // It implements the common behaviour of scalar and vector variables,
28 // it can also be used via dynamic casting to determine whether an object
29 // represents a variable.
30 
31 class ValueDefinition: public Object {
32 
33 public:
34 
35  virtual ~ValueDefinition();
36 
38  // Return the string "VARIABLE".
39  virtual const std::string getCategory() const;
40 
42  // If true, the object's execute() function should be traced.
43  // Always false for value definitions.
44  virtual bool shouldTrace() const;
45 
47  // If true, the data structure should be updated before calling execute().
48  // Always false for value definitions.
49  virtual bool shouldUpdate() const;
50 
51 
53  // The default version throws OpalException.
54  virtual bool getBool() const;
55 
57  // The default version throws OpalException.
58  virtual bool getBoolComponent(int) const;
59 
61  // The default version throws OpalException.
62  virtual double getReal() const;
63 
65  // The default version throws OpalException.
66  virtual double getRealComponent(int) const;
67 
69  // The default version throws OpalException.
70  virtual std::string getString() const;
71 
73  // The default version throws OpalException.
74  virtual std::string getStringComponent(int) const;
75 
77  // Version for non-constant object.
78  Attribute &value();
79 
81  // Version for constant object.
82  const Attribute &value() const;
83 
84 protected:
85 
87  ValueDefinition(int size, const char *name, const char *help);
88 
90  ValueDefinition(const std::string &name, ValueDefinition *parent);
91 
93  // A string representing the value type in OPAL-9 input format:
94  // "BOOL", "REAL", "REAL CONST", "REAL VECTOR", etc.
95  const std::string itsPrefix;
96 
97 private:
98 
99  // Not implemented.
102  void operator=(const ValueDefinition &);
103 };
104 
105 #endif // OPAL_ValueDefinition_HH
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
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.
ValueDefinition(const ValueDefinition &)
virtual std::string getStringComponent(int) const
Return indexed string value.
virtual std::string getString() const
Return string value.
const std::string itsPrefix
The declaration prefix.
void operator=(const ValueDefinition &)
virtual bool getBoolComponent(int) const
Return indexed logical value.
virtual ~ValueDefinition()
virtual bool shouldUpdate() const
Update flag.