OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
StringConstant.h
Go to the documentation of this file.
1 //
2 // Class StringConstant
3 // The STRING CONSTANT definition.
4 //
5 // Copyright (c) 2000 - 2023, Paul Scherrer Institut, Villigen PSI, Switzerland
6 // All rights reserved
7 //
8 // This file is part of OPAL.
9 //
10 // OPAL is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17 //
18 #ifndef OPAL_StringConstant_HH
19 #define OPAL_StringConstant_HH
20 
22 
23 
25 
26 public:
29 
30  virtual ~StringConstant();
31 
33  // True, if [b]rhs[/b] is a string constant.
34  virtual bool canReplaceBy(Object* object);
35 
37  virtual StringConstant* clone(const std::string& name);
38 
40  virtual void print(std::ostream&) const;
41 
43  virtual void printValue(std::ostream& os) const;
44 
46  virtual std::string getString() const;
47 
48 private:
49  // Not implemented.
51  void operator=(const StringConstant&);
52 
53  // Clone constructor.
54  StringConstant(const std::string& name, StringConstant* parent);
55  StringConstant(const std::string& name, StringConstant* parent, const std::string& value);
56 };
57 
58 #endif // OPAL_StringConstant_HH
The base class for all OPAL objects.
Definition: Object.h:48
Attribute & value()
Return the attribute representing the value of the definition.
void operator=(const StringConstant &)
virtual StringConstant * clone(const std::string &name)
Make clone.
virtual ~StringConstant()
StringConstant()
Exemplar constructor.
virtual bool canReplaceBy(Object *object)
Test if object can be replaced.
virtual void print(std::ostream &) const
Print the constant.
The base class for all OPAL value definitions.
const std::string name
virtual std::string getString() const
Return value.
virtual void printValue(std::ostream &os) const
Print its value.