An entry for a single capability. More...
#include <Capability.h>
Public Types | |
| using | Value = std::variant< bool, int, std::string > |
| A capability can have a bool, int, or string value. More... | |
Public Member Functions | |
| Capability ()=delete | |
| Capability (const std::string_view name, const Capability::Value &value, const std::string_view doc) | |
| const std::string & | getName () const |
| const std::string & | getDoc () const |
| const Capability::Value & | getValue () const |
| bool | getExplicit () const |
| const std::optional< std::set< std::string > > & | queryEnumeration () const |
| const std::set< std::string > & | getEnumeration () const |
| bool | hasEnumeration (const std::string &value) const |
| Capability & | setExplicit () |
| Set the capability to be explicit. More... | |
| Capability & | setEnumeration (const std::set< std::string > &enumeration) |
| Set the enumeration (allowed values) for the capability. More... | |
| void | negateValue () |
| Negate a Capability value. More... | |
| const bool * | queryBoolValue () const |
| const int * | queryIntValue () const |
| const std::string * | queryStringValue () const |
| bool | hasBoolValue () const |
| bool | hasIntValue () const |
| bool | hasStringValue () const |
| bool | getBoolValue () const |
| int | getIntValue () const |
| const std::string & | getStringValue () const |
| std::string | valueToString () const |
| std::string | toString () const |
| std::string | enumerationToString () const |
Private Member Functions | |
| FRIEND_TEST (::CapabilityTest, negateValue) | |
| FRIEND_TEST (::CapabilitiesTest, isInstallationType) | |
Private Attributes | |
| std::string | _name |
| The name of capability. More... | |
| std::string | _doc |
| Description for the capability. More... | |
| Capability::Value | _value |
| The value the capability is set to. More... | |
| bool | _explicit |
| Whether or not this capability must be compared explicitly (not as a boolean check) More... | |
| std::optional< std::set< std::string > > | _enumeration |
| Possible enumeration for the capability, if any (string capabilities only) More... | |
An entry for a single capability.
Definition at line 29 of file Capability.h.
| using Moose::Capability::Value = std::variant<bool, int, std::string> |
A capability can have a bool, int, or string value.
Definition at line 33 of file Capability.h.
|
delete |
| Moose::Capability::Capability | ( | const std::string_view | name, |
| const Capability::Value & | value, | ||
| const std::string_view | doc | ||
| ) |
Definition at line 19 of file Capability.C.
| std::string Moose::Capability::enumerationToString | ( | ) | const |
This is only valid for a capability that has an enumeration.
Definition at line 150 of file Capability.C.
|
private |
|
private |
| bool Moose::Capability::getBoolValue | ( | ) | const |
Will error if the value is not a boolean.
Definition at line 105 of file Capability.C.
|
inline |
| const std::set< std::string > & Moose::Capability::getEnumeration | ( | ) | const |
Will error if the capability does not have an enumeration.
Only string-valued capabilites can have an enumeration.
Definition at line 50 of file Capability.C.
|
inline |
Explicit implies that the capability cannot be compared as a boolean.
Definition at line 60 of file Capability.h.
| int Moose::Capability::getIntValue | ( | ) | const |
Will error if the value is not an integer.
Definition at line 114 of file Capability.C.
|
inline |
Definition at line 43 of file Capability.h.
Referenced by Capability(), enumerationToString(), getEnumeration(), setEnumeration(), setExplicit(), and toString().
| const std::string & Moose::Capability::getStringValue | ( | ) | const |
Will error if the value is not a string.
Definition at line 123 of file Capability.C.
|
inline |
Definition at line 53 of file Capability.h.
|
inline |
Definition at line 130 of file Capability.h.
Referenced by setExplicit().
| bool Moose::Capability::hasEnumeration | ( | const std::string & | value | ) | const |
value.This is only valid for string-valued capabilities.
If the capability has no enumerations, this will always return true.
Definition at line 44 of file Capability.C.
Referenced by setEnumeration().
|
inline |
Definition at line 135 of file Capability.h.
|
inline |
Definition at line 140 of file Capability.h.
|
inline |
Negate a Capability value.
This should only be used by pycapabilities via the TestHarness when it needs to augment capabilities to check on if a check depeneds on a capability or not.
Definition at line 199 of file Capability.h.
|
inline |
Definition at line 117 of file Capability.h.
Referenced by getBoolValue(), and valueToString().
|
inline |
Only string-valued capabilites can have an enumeration.
Definition at line 67 of file Capability.h.
|
inline |
Definition at line 121 of file Capability.h.
Referenced by getIntValue(), and valueToString().
|
inline |
Definition at line 125 of file Capability.h.
Referenced by Capability(), getStringValue(), setEnumeration(), and valueToString().
| Capability & Moose::Capability::setEnumeration | ( | const std::set< std::string > & | enumeration | ) |
Set the enumeration (allowed values) for the capability.
This is only valid for string-valued capabilities.
Definition at line 69 of file Capability.C.
| Capability & Moose::Capability::setExplicit | ( | ) |
Set the capability to be explicit.
Explicit implies that the capability cannot be compared as a boolean.
This is only valid for non-bool valued capabilities.
Definition at line 59 of file Capability.C.
| std::string Moose::Capability::toString | ( | ) | const |
Definition at line 144 of file Capability.C.
Referenced by getBoolValue(), getIntValue(), getStringValue(), and setEnumeration().
| std::string Moose::Capability::valueToString | ( | ) | const |
Definition at line 132 of file Capability.C.
Referenced by toString().
|
private |
Description for the capability.
Definition at line 187 of file Capability.h.
Referenced by getDoc().
|
private |
Possible enumeration for the capability, if any (string capabilities only)
Definition at line 194 of file Capability.h.
Referenced by enumerationToString(), getEnumeration(), hasEnumeration(), negateValue(), queryEnumeration(), and setEnumeration().
|
private |
Whether or not this capability must be compared explicitly (not as a boolean check)
Definition at line 192 of file Capability.h.
Referenced by getExplicit(), negateValue(), and setExplicit().
|
private |
|
private |
The value the capability is set to.
Definition at line 189 of file Capability.h.
Referenced by getValue(), hasBoolValue(), hasIntValue(), hasStringValue(), negateValue(), queryBoolValue(), queryIntValue(), and queryStringValue().
1.8.14