39 #if !defined(TAWARA_PRIM_ELEMENT_H_)
40 #define TAWARA_PRIM_ELEMENT_H_
43 #include <boost/operators.hpp>
77 public boost::equality_comparable<PrimitiveElement<T> >
88 value_(value), has_default_(false)
101 value_(value), default_(default_value), has_default_(true)
120 virtual void id(uint32_t
id)
134 virtual T
value()
const {
return value_; }
138 operator T()
const {
return value_; }
147 default_ = default_value;
156 has_default_ =
false;
165 {
return value_ == default_ && has_default_; }
181 return value_ == rhs.
value_;
189 #endif // TAWARA_PRIM_ELEMENT_H_
virtual bool is_default() const
Check if this element is at the default value.
virtual uint32_t id() const
Get the element's ID.
virtual PrimitiveElement & operator=(T const &rhs)
Value assignment operator.
virtual T value() const
Get the value.
An invalid Element ID was provided.
virtual bool has_default() const
Check if a default value is set.
uint32_t id() const
Get the element's ID.
virtual void set_default(T default_value)
Set the default value.
friend bool operator==(PrimitiveElement< T > const &lhs, PrimitiveElement< T > const &rhs)
Equality operator.
virtual bool equal_(PrimitiveElement< T > const &rhs)
virtual T remove_default()
Remove the default value.
virtual T get_default() const
Get the default value.
boost::error_info< struct tag_id, ids::ID > err_id
An Element ID.
virtual void value(T value)
Set the value.
virtual void id(uint32_t id)
Set the element's ID.
The Element interface, a basic interface to an element object.
PrimitiveElement(uint32_t id, T value)
Create a new element with no default.
The primitive data element interface.
PrimitiveElement(uint32_t id, T value, T default_value)
Create a signed integer element with a default value.