47 std::string
dump()
const;
54 void set(
const T & value,
bool type_check =
true);
60 std::vector<T>
get(
bool type_check =
true,
bool warn_when_values_difffer =
false)
const;
83 std::vector<ControllableItem *>
_items;
91 item->set<T>(value, type_check);
98 std::vector<T> output;
101 std::vector<T> local = item->get<T>(type_check);
102 output.insert(output.end(), local.begin(), local.end());
106 if (warn_when_values_differ &&
_items.size() > 1)
109 const T value0 = output[0];
112 for (T value : output)
116 std::ostringstream oss;
117 oss <<
"The following controlled parameters are being retrieved, but the values differ:\n";
131 bool type = std::all_of(
133 return type && !
empty();
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
An intermediate object for building a "controllable item", where an "item" can refer to multiple inpu...
The ControllableParameter class is simply a set of ControllableItem objects.
virtual ~ControllableParameter()=default
void add(ControllableItem *item)
Adds the supplied item with the other items within this object.
ControllableParameter & operator=(const ControllableParameter &)=delete
friend std::ostream & operator<<(std::ostream &stream, const ControllableParameter &obj)
Allows this to be used with std:: cout.
void set(const T &value, bool type_check=true)
Set the value(s) of the controlled parameters stored in this class.
ControllableParameter()=default
ControllableParameter & operator=(ControllableParameter &&)=delete
std::vector< T > get(bool type_check=true, bool warn_when_values_difffer=false) const
Return a copy of the values of the given type.
std::string dump() const
Return a string that lists the parameters stored by this object.
ControllableParameter(const ControllableParameter &)=delete
bool empty()
Return true if the container is empty.
std::vector< ControllableItem * > _items
Storage for the ControllableItems, these are stored as pointers to avoid copies.
bool check()
Check size() and the type of the stored items, i.e., there must be items with the given type.
void checkExecuteOnType(const ExecFlagType ¤t) const
Check the execute flags.
ControllableParameter(ControllableParameter &&)=default
Class for containing MooseEnum item information.