OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
|
Abstract base class for attribute parsers. More...
#include <AttributeHandler.h>
Public Types | |
enum | OwnerType { ELEMENT , COMMAND , SUB_COMMAND , STATEMENT , NONE } |
Public Member Functions | |
AttributeHandler (const std::string &name, const std::string &help, AttributeBase *def) | |
Constructor. More... | |
virtual | ~AttributeHandler () |
virtual AttributeHandler * | clone () const |
Make clone. More... | |
virtual AttributeBase * | getDefault () const |
Return default value. More... | |
virtual const std::string & | getHelp () const |
Return help string. More... | |
virtual const std::string & | getName () const |
Return attribute name. More... | |
virtual const std::string & | getType () const =0 |
Return attribute type. More... | |
virtual void | parse (Attribute &a, Statement &s, bool eval) const =0 |
Parse new value. More... | |
virtual void | parseComponent (Attribute &a, Statement &s, bool eval, int i) const |
Parse component value. More... | |
bool | isDeferred () const |
Return defer flag. More... | |
void | setDeferred (bool) |
Set or reset defer flag. More... | |
bool | isReadOnly () const |
Return read-only flag. More... | |
void | setReadOnly (bool) |
Set or reset read-only flag. More... | |
void | setPredefinedValues (const std::set< std::string > &, const std::string &) |
Add predefined strings values to the help. More... | |
Public Member Functions inherited from RCObject | |
int | addReference () const |
Increment reference count. More... | |
int | removeReference () const |
Decrement the reference count. More... | |
bool | isShared () const |
Test for sharing. More... | |
Static Public Member Functions | |
static std::multimap< OwnerType, std::string > | getOwner (const std::string &att) |
static void | addAttributeOwner (const std::string &owner, const OwnerType &type, const std::string &name) |
Protected Attributes | |
const std::string | itsName |
Attribute name. More... | |
const std::string | itsHelp |
Help text. More... | |
Pointer< AttributeBase > | itsDefault |
Default value. More... | |
bool | is_deferred |
Defer flag. More... | |
bool | is_readonly |
Read-only flag. More... | |
Private Member Functions | |
AttributeHandler () | |
AttributeHandler (const AttributeHandler &) | |
void | operator= (const AttributeHandler &) |
Static Private Attributes | |
static std::multimap< std::string, std::pair< OwnerType, std::string > > | attributeOwnerDictionary_s |
Additional Inherited Members | |
Protected Member Functions inherited from RCObject | |
RCObject () | |
Default constructor. More... | |
RCObject (const RCObject &) | |
Copy constructor. More... | |
virtual | ~RCObject ()=0 |
RCObject & | operator= (const RCObject &right) |
Abstract base class for attribute parsers.
Definition at line 49 of file AttributeHandler.h.
Enumerator | |
---|---|
ELEMENT | |
COMMAND | |
SUB_COMMAND | |
STATEMENT | |
NONE |
Definition at line 118 of file AttributeHandler.h.
AttributeHandler::AttributeHandler | ( | const std::string & | name, |
const std::string & | help, | ||
AttributeBase * | def | ||
) |
Constructor.
Definition at line 33 of file AttributeHandler.cpp.
|
virtual |
Definition at line 40 of file AttributeHandler.cpp.
|
private |
|
private |
|
static |
Definition at line 125 of file AttributeHandler.cpp.
References attributeOwnerDictionary_s, and name.
Referenced by OpalElement::OpalElement(), OpalElement::registerOwnership(), Object::registerOwnership(), and TrackCmd::TrackCmd().
|
virtual |
Make clone.
Definition at line 44 of file AttributeHandler.cpp.
|
virtual |
Return default value.
Definition at line 50 of file AttributeHandler.cpp.
References Pointer< Object >::isValid(), itsDefault, and itsName.
Referenced by Attribute::setDefault().
|
virtual |
Return help string.
Definition at line 60 of file AttributeHandler.cpp.
References itsHelp.
Referenced by Attribute::getHelp().
|
virtual |
Return attribute name.
Definition at line 65 of file AttributeHandler.cpp.
References itsName.
Referenced by Attribute::getName().
|
static |
Definition at line 109 of file AttributeHandler.cpp.
References attributeOwnerDictionary_s.
Referenced by OpalParser::getHint().
|
pure virtual |
Return attribute type.
Implemented in Attributes::Bool, Attributes::BoolArray, Attributes::Place, Attributes::PredefinedString, Attributes::Range, Attributes::Real, Attributes::RealArray, Attributes::Reference, Attributes::String, Attributes::StringArray, Attributes::TableRow, Attributes::TokenList, Attributes::TokenListArray, Attributes::UpperCaseString, and Attributes::UpperCaseStringArray.
Referenced by Attribute::getType().
bool AttributeHandler::isDeferred | ( | ) | const |
Return defer flag.
Definition at line 79 of file AttributeHandler.cpp.
References is_deferred.
Referenced by Attribute::isDeferred(), and Attributes::Real::parse().
bool AttributeHandler::isReadOnly | ( | ) | const |
Return read-only flag.
Definition at line 89 of file AttributeHandler.cpp.
References is_readonly.
Referenced by Attribute::isReadOnly().
|
private |
Parse new value.
Implemented in Attributes::Bool, Attributes::BoolArray, Attributes::Place, Attributes::PredefinedString, Attributes::Range, Attributes::Real, Attributes::RealArray, Attributes::Reference, Attributes::String, Attributes::StringArray, Attributes::TableRow, Attributes::TokenList, Attributes::TokenListArray, Attributes::UpperCaseString, and Attributes::UpperCaseStringArray.
Referenced by Attribute::parse().
|
virtual |
Parse component value.
Reimplemented in Attributes::BoolArray, Attributes::RealArray, Attributes::StringArray, Attributes::TokenListArray, and Attributes::UpperCaseStringArray.
Definition at line 70 of file AttributeHandler.cpp.
References itsName.
Referenced by Attribute::parseComponent().
void AttributeHandler::setDeferred | ( | bool | flag | ) |
Set or reset defer flag.
Definition at line 84 of file AttributeHandler.cpp.
References is_deferred.
Referenced by Attribute::setDeferred().
void AttributeHandler::setPredefinedValues | ( | const std::set< std::string > & | predefinedValues, |
const std::string & | defaultValue | ||
) |
Add predefined strings values to the help.
Definition at line 98 of file AttributeHandler.cpp.
References itsHelp.
Referenced by Attributes::PredefinedString::PredefinedString().
void AttributeHandler::setReadOnly | ( | bool | flag | ) |
Set or reset read-only flag.
Definition at line 94 of file AttributeHandler.cpp.
References is_readonly.
Referenced by Attribute::setReadOnly().
|
staticprivate |
Definition at line 151 of file AttributeHandler.h.
Referenced by addAttributeOwner(), and getOwner().
|
protected |
Defer flag.
Definition at line 139 of file AttributeHandler.h.
Referenced by isDeferred(), Attributes::Bool::parse(), Attributes::BoolArray::parse(), Attributes::RealArray::parse(), and setDeferred().
|
protected |
Read-only flag.
Definition at line 142 of file AttributeHandler.h.
Referenced by isReadOnly(), and setReadOnly().
|
protected |
|
protected |
Help text.
Definition at line 133 of file AttributeHandler.h.
Referenced by getHelp(), and setPredefinedValues().
|
protected |
Attribute name.
Definition at line 130 of file AttributeHandler.h.
Referenced by getDefault(), getName(), and parseComponent().