Template Class ValueIface

Inheritance Relationships

Base Type

Class Documentation

template<typename T, typename Format>
class uconfig::ValueIface : public uconfig::Interface<Format>

Interface for raw values.

Used to interface uconfig::Vector elements.

tparam T

Type of the value.

tparam Format

Format this interface interacts with.

Public Functions

ValueIface(const std::string &variable_path, T *value)

Constructor.

Note

Does not own value, should not outlive it.

Parameters
  • [in] variable_path – Path to the variable in terms of Format.

  • [in] value – Pointer to the value to wrap.

ValueIface(const ValueIface<T, Format>&) = default

Copy constructor.

ValueIface<T, Format> &operator=(const ValueIface<T, Format>&) = default

Copy assignment.

ValueIface(ValueIface<T, Format>&&) noexcept = default

Move constructor.

ValueIface<T, Format> &operator=(ValueIface<T, Format>&&) noexcept = default

Move assignment.

virtual ~ValueIface() = default

Destructor.

virtual bool Parse(const format_type &parser, const source_type *source, bool throw_on_fail = true) override

Parse referenced value from source using parser.

Parameters
  • [in] parser – Parser instance to use.

  • [in] source – Source to parse from.

  • [in] throw_on_fail – Will throw an uconfig::ParseError is failed to parse. Default true.

Throws

uconfig::ParseError – Thrown if throw_on_fail.

Returns

true if value has been parsed, false otherwise.

virtual void Emit(const format_type &emitter, dest_type *dest, bool throw_on_fail = true) override

Emit referenced value to destination using emitter.

Parameters
  • [in] emitter – Emitter instance to use.

  • [in] dest – Destination to emit into.

  • [in] throw_on_fail – Not used. Always throws if failed to emit.

Throws

uconfig::EmitError – Thrown if failed.

virtual const std::string &Path() const noexcept override

Get path of the wrapped value.

virtual bool Initialized() const noexcept override

Check if wrapped value has all mandatory values set.

virtual bool Optional() const noexcept override

Check if wrapped value declared as optional.