Class ArgList
Defined in File arg.hpp
-
class ArgList
Vector-like container for holding the arguments.
Public Functions
- ArgList() = default
-
inline explicit ArgList(std::initializer_list<Arg> args)
Construct a new ArgList object.
- Parameters
args – The arguments as an initializer list.
- ~ArgList() = default
-
inline size_t size() const
Get the number of arguments.
- Returns
The number of arguments.
-
inline std::vector<Arg>::iterator begin()
Return an iterator to the beginning.
- Returns
The iterator to the first element.
-
inline std::vector<Arg>::iterator end()
Return an iterator to the end.
- Returns
The iterator to the element following the last element.
-
inline std::vector<Arg>::const_iterator begin() const
Return a const iterator to the beginning.
- Returns
The const iterator to the first element.
-
inline std::vector<Arg>::const_iterator end() const
Return a const iterator to the end.
- Returns
The const iterator to the element following the last element.
- inline void clear()
Erase all elements from the container.
-
inline std::vector<Arg> &args()
Get the vector of arguments.
- Returns
The reference to the vector of arguments.
-
template<typename typeT>
inline typeT as() Get the value of the argument as a specific type.
This method takes a type as a template parameter and returns the value of the argument as that type. Only the first item in the argument list is taken into account.
If the cast fails, an error message is logged and a default value for the type is returned.
Example:
bool is_rdma = from_config("aja.rdma").as<bool>();
- Template Parameters
- Returns
typeT – The type to cast the argument to.
The value of the argument as the specified type.
-
inline void add(const Arg &arg)
Add an argument to the list.
- Parameters
arg – The argument to add.
-
inline void add(Arg &&arg)
Add an argument to the list.
- Parameters
arg – The argument to add.
-
inline void add(const ArgList &arg)
Add an argument list to the list.
- Parameters
arg – The argument list to add.
-
inline void add(ArgList &&arg)
Add an argument list to the list.
- Parameters
arg – The argument list to add.
-
inline const std::string &name() const
Get the name of the argument list.
- Returns
The name of the argument list.
-
YAML::Node to_yaml_node() const
Get a YAML representation of the argument list.
- Returns
YAML node including the name, and arguments of the argument list.
-
std::string description() const
Get a description of the argument list.
See also- Returns
YAML string.