OPAL (Object Oriented Parallel Accelerator Library)
2021.1.99
OPAL
|
A representation of an Object attribute. More...
#include <Attribute.h>
Public Member Functions | |
Attribute () | |
Default constructor. More... | |
Attribute (const Attribute &rhs) | |
Copy constructor. More... | |
Attribute (AttributeHandler *h, AttributeBase *b=nullptr) | |
Constructor defining a parser and an optional value. More... | |
~Attribute () | |
const Attribute & | operator= (const Attribute &) |
operator bool () const | |
Test for valid pointer. More... | |
AttributeBase & | getBase () const |
Return reference to polymorphic value. More... | |
bool | isBaseAllocated () const |
std::string | getImage () const |
Return printable representation. More... | |
AttributeHandler & | getHandler () const |
Return a reference to the parser. More... | |
const std::string & | getHelp () const |
Return the help string. More... | |
const std::string & | getName () const |
Return the attribute name. More... | |
const std::string & | getType () const |
Return the attribute type. More... | |
bool | isDeferred () const |
Return [b]deferred[/b] flag. More... | |
void | setDeferred (bool) |
Set read-only flag. More... | |
bool | isExpression () const |
Test for expression. More... | |
bool | isReadOnly () const |
Test for read only. More... | |
void | setReadOnly (bool) |
Set read-only flag. More... | |
void | parse (Statement &stat, bool eval) |
Parse attribute. More... | |
void | parseComponent (Statement &stat, bool eval, int index) |
Parse array component. More... | |
void | set (AttributeBase *newBase) |
Define new value. More... | |
void | setDefault () |
Assign default value. More... | |
void | print (int &len) const |
Print attribute. More... | |
bool | defaultUsed () const |
Private Attributes | |
Pointer< AttributeBase > | base |
Pointer< AttributeHandler > | handler |
bool | isDefault |
A representation of an Object attribute.
Definition at line 52 of file Attribute.h.
Attribute::Attribute | ( | ) |
Default constructor.
Definition at line 34 of file Attribute.cpp.
Attribute::Attribute | ( | const Attribute & | rhs | ) |
Copy constructor.
Definition at line 41 of file Attribute.cpp.
Attribute::Attribute | ( | AttributeHandler * | h, |
AttributeBase * | b = nullptr |
||
) |
Constructor defining a parser and an optional value.
Definition at line 48 of file Attribute.cpp.
Attribute::~Attribute | ( | ) |
Definition at line 55 of file Attribute.cpp.
|
inline |
Definition at line 173 of file Attribute.h.
References isDefault.
AttributeBase & Attribute::getBase | ( | ) | const |
Return reference to polymorphic value.
Definition at line 69 of file Attribute.cpp.
References base.
Referenced by Attributes::getBool(), Attributes::getBoolArray(), Attributes::getPlace(), Attributes::getRange(), Attributes::getReal(), Attributes::getRealArray(), Attributes::getString(), Attributes::getStringArray(), Attributes::getTableRow(), Attributes::getTokenList(), Attributes::getTokenListArray(), operator<<(), Attributes::BoolArray::parseComponent(), Attributes::RealArray::parseComponent(), Attributes::StringArray::parseComponent(), Attributes::TokenListArray::parseComponent(), Attributes::UpperCaseStringArray::parseComponent(), OpalElement::printMultipoleStrength(), Attributes::setBool(), Attributes::setPredefinedString(), Attributes::setReal(), Attributes::setString(), and Attributes::setUpperCaseString().
AttributeHandler & Attribute::getHandler | ( | ) | const |
Return a reference to the parser.
Definition at line 77 of file Attribute.cpp.
References handler.
Referenced by Attributes::getBool(), Attributes::getReal(), Attributes::getRealArray(), Attributes::getString(), Attributes::getStringArray(), Attributes::getTokenList(), Attributes::getTokenListArray(), Attributes::setBool(), Attributes::setBoolArray(), Attributes::setPlace(), Attributes::setPredefinedString(), Attributes::setRange(), Attributes::setReal(), Attributes::setRealArray(), Attributes::setString(), Attributes::setStringArray(), Attributes::setTableRow(), Attributes::setTokenList(), Attributes::setUpperCaseString(), and Attributes::setUpperCaseStringArray().
const std::string & Attribute::getHelp | ( | ) | const |
Return the help string.
Definition at line 82 of file Attribute.cpp.
References AttributeHandler::getHelp(), and handler.
std::string Attribute::getImage | ( | ) | const |
Return printable representation.
Definition at line 87 of file Attribute.cpp.
References base, and AttributeBase::getImage().
Referenced by print(), and OpalElement::printMultipoleStrength().
const std::string & Attribute::getName | ( | ) | const |
Return the attribute name.
Definition at line 92 of file Attribute.cpp.
References AttributeHandler::getName(), and handler.
Referenced by Attributes::getBool(), Attributes::getBoolArray(), Attributes::getPlace(), Attributes::getRange(), Attributes::getReal(), Attributes::getRealArray(), Attributes::getString(), Attributes::getStringArray(), Attributes::getTableRow(), Attributes::getTokenList(), Attributes::getTokenListArray(), print(), OpalTrimCoil::printPolynom(), Attributes::setBool(), Attributes::setBoolArray(), Attributes::setPlace(), Attributes::setPredefinedString(), Attributes::setRange(), Attributes::setReal(), Attributes::setRealArray(), Attributes::setString(), Attributes::setStringArray(), Attributes::setTableRow(), Attributes::setTokenList(), Attributes::setUpperCaseString(), Attributes::setUpperCaseStringArray(), and OpalElement::updateUnknown().
const std::string & Attribute::getType | ( | ) | const |
Return the attribute type.
Definition at line 97 of file Attribute.cpp.
References AttributeHandler::getType(), and handler.
bool Attribute::isBaseAllocated | ( | ) | const |
Definition at line 73 of file Attribute.cpp.
References base.
Referenced by Attributes::getBool(), Attributes::getBoolArray(), Attributes::getPlace(), Attributes::getRange(), Attributes::getReal(), Attributes::getRealArray(), Attributes::getString(), Attributes::getStringArray(), Attributes::getTableRow(), Attributes::getTokenList(), Attributes::getTokenListArray(), Attributes::setBool(), Attributes::setPredefinedString(), Attributes::setReal(), Attributes::setString(), and Attributes::setUpperCaseString().
bool Attribute::isDeferred | ( | ) | const |
Return [b]deferred[/b] flag.
Definition at line 102 of file Attribute.cpp.
References handler, and AttributeHandler::isDeferred().
bool Attribute::isExpression | ( | ) | const |
Test for expression.
Definition at line 112 of file Attribute.cpp.
References base, and AttributeBase::isExpression().
Referenced by print().
bool Attribute::isReadOnly | ( | ) | const |
Test for read only.
Definition at line 117 of file Attribute.cpp.
References handler, and AttributeHandler::isReadOnly().
|
inline |
Test for valid pointer.
Definition at line 169 of file Attribute.h.
Definition at line 59 of file Attribute.cpp.
void Attribute::parse | ( | Statement & | stat, |
bool | eval | ||
) |
Parse attribute.
Definition at line 127 of file Attribute.cpp.
References handler, isDefault, and AttributeHandler::parse().
Referenced by IfStatement::execute(), WhileStatement::execute(), and OpalElement::parse().
void Attribute::parseComponent | ( | Statement & | stat, |
bool | eval, | ||
int | index | ||
) |
Parse array component.
Definition at line 133 of file Attribute.cpp.
References handler, isDefault, and AttributeHandler::parseComponent().
Referenced by OpalElement::parse().
void Attribute::print | ( | int & | len | ) | const |
Print attribute.
Definition at line 151 of file Attribute.cpp.
References endl(), getImage(), getName(), gmsg, isExpression(), and name.
void Attribute::set | ( | AttributeBase * | newBase | ) |
Define new value.
Definition at line 139 of file Attribute.cpp.
References base, and isDefault.
Referenced by Attributes::Bool::parse(), Attributes::BoolArray::parse(), Attributes::Place::parse(), Attributes::Range::parse(), Attributes::Real::parse(), Attributes::RealArray::parse(), Attributes::Reference::parse(), Attributes::String::parse(), Attributes::TableRow::parse(), Attributes::TokenList::parse(), Attributes::BoolArray::parseComponent(), Attributes::RealArray::parseComponent(), Attributes::setBool(), Attributes::setBoolArray(), Attributes::setPlace(), Attributes::setPredefinedString(), Attributes::setRange(), Attributes::setReal(), Attributes::setRealArray(), Attributes::setString(), Attributes::setStringArray(), Attributes::setTableRow(), Attributes::setTokenList(), Attributes::setTokenListArray(), Attributes::setUpperCaseString(), and Attributes::setUpperCaseStringArray().
void Attribute::setDefault | ( | ) |
Assign default value.
Definition at line 145 of file Attribute.cpp.
References base, AttributeHandler::getDefault(), handler, and isDefault.
Referenced by OpalElement::parse().
void Attribute::setDeferred | ( | bool | flag | ) |
Set read-only flag.
Definition at line 107 of file Attribute.cpp.
References handler, and AttributeHandler::setDeferred().
void Attribute::setReadOnly | ( | bool | flag | ) |
Set read-only flag.
Definition at line 122 of file Attribute.cpp.
References handler, and AttributeHandler::setReadOnly().
|
private |
Definition at line 157 of file Attribute.h.
Referenced by getBase(), getImage(), isBaseAllocated(), isExpression(), operator=(), set(), and setDefault().
|
private |
Definition at line 160 of file Attribute.h.
Referenced by getHandler(), getHelp(), getName(), getType(), isDeferred(), isReadOnly(), operator=(), parse(), parseComponent(), setDefault(), setDeferred(), and setReadOnly().
|
private |
Definition at line 162 of file Attribute.h.
Referenced by defaultUsed(), parse(), parseComponent(), set(), and setDefault().