OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
BoolConstant.cpp
Go to the documentation of this file.
1//
2// Class BoolConstant
3// The BOOL CONSTANT definition.
4//
5// Copyright (c) 2000 - 2021, 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//
19
21#include "Utilities/Options.h"
22
23#include <iostream>
24
27 1, "BOOL_CONSTANT",
28 "The \"BOOL CONSTANT\" statement defines a global "
29 "logical constant:\n"
30 "\tBOOL CONSTANT <name> = <Bool-expression>;\n") {
31 itsAttr[0] = Attributes::makeBool("VALUE", "The constant value");
32
34}
35
36BoolConstant::BoolConstant(const std::string& name, BoolConstant* parent)
37 : ValueDefinition(name, parent) {}
38
40
41bool BoolConstant::canReplaceBy(Object*) { return false; }
42
43BoolConstant* BoolConstant::clone(const std::string& name) { return new BoolConstant(name, this); }
44
46
47void BoolConstant::print(std::ostream& os) const {
48 os << "BOOL CONST " << getOpalName() << '=' << itsAttr[0] << ';';
49 os << std::endl;
50}
51
52void BoolConstant::printValue(std::ostream& os) const { os << itsAttr[0]; }
virtual ~BoolConstant()
virtual void print(std::ostream &) const
Print the constant.
BoolConstant()
Exemplar constructor.
virtual bool canReplaceBy(Object *object)
Test if object can be replaced.
virtual BoolConstant * clone(const std::string &name)
Make clone.
virtual bool getBool() const
Return value.
virtual void printValue(std::ostream &os) const
Print its value.
The base class for all OPAL objects.
Definition Object.h:45
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
Definition Object.cpp:169
const std::string & getOpalName() const
Return object name.
Definition Object.cpp:267
std::vector< Attribute > itsAttr
The object attributes.
Definition Object.h:210
The base class for all OPAL value definitions.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
bool getBool(const Attribute &attr)
Return logical value.