23 #include <boost/algorithm/string/join.hpp>
28 std::multimap<std::string,
35 RCObject(), itsName(
name), itsHelp(help), itsDefault(def),
36 is_deferred(false), is_readonly(false)
46 "Internal error: should not call this method.");
55 "Attribute \"" +
itsName +
"\" has no default value.");
74 "You cannot assign to a component of \"" +
itsName +
75 "\" which is not a vector value.");
99 const std::string& defaultValue)
101 std::string validValues =
" Valid values are " + boost::algorithm::join(predefinedValues,
", ") +
".";
102 if (defaultValue !=
"_HAS_NO_DEFAULT_") {
103 validValues +=
" Its default is " + defaultValue +
".";
105 std::string* help =
const_cast<std::string*
>(&
itsHelp);
106 *help += validValues;
110 std::multimap<OwnerType, std::string> possibleOwners;
115 for (
auto it = its.first; it != its.second; ++ it) {
116 auto owner = it->second;
118 possibleOwners.insert(std::make_pair(owner.first, owner.second));
122 return possibleOwners;
127 const std::string &
name) {
boost::function< boost::tuple< double, bool >arguments_t)> type
A representation of an Object attribute.
Abstract base class for attribute values of different types.
Abstract base class for attribute parsers.
void setDeferred(bool)
Set or reset defer flag.
const std::string itsHelp
Help text.
virtual AttributeBase * getDefault() const
Return default value.
bool isDeferred() const
Return defer flag.
static void addAttributeOwner(const std::string &owner, const OwnerType &type, const std::string &name)
bool is_deferred
Defer flag.
Pointer< AttributeBase > itsDefault
Default value.
void setReadOnly(bool)
Set or reset read-only flag.
static std::multimap< std::string, std::pair< OwnerType, std::string > > attributeOwnerDictionary_s
virtual const std::string & getName() const
Return attribute name.
const std::string itsName
Attribute name.
virtual const std::string & getHelp() const
Return help string.
virtual void parseComponent(Attribute &a, Statement &s, bool eval, int i) const
Parse component value.
virtual ~AttributeHandler()
bool isReadOnly() const
Return read-only flag.
static std::multimap< OwnerType, std::string > getOwner(const std::string &att)
virtual AttributeHandler * clone() const
Make clone.
bool is_readonly
Read-only flag.
void setPredefinedValues(const std::set< std::string > &, const std::string &)
Add predefined strings values to the help.
bool isValid() const
Test for validity.
Abstract base class for reference counted objects.
Interface for statements.
The base class for all OPAL exceptions.