Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Class template attribute_value_impl

boost::log::attributes::attribute_value_impl — Basic attribute value implementation class.

Synopsis

// In header: <boost/log/attributes/attribute_value_impl.hpp>

template<typename T> 
class attribute_value_impl : public attribute_value::impl {
public:
  // types
  typedef T value_type;  // Value type. 

  // construct/copy/destruct
  explicit attribute_value_impl(value_type const &);
  explicit attribute_value_impl(value_type &&) noexcept(boost::is_nothrow_move_constructible< value_type >::value));

  // public member functions
  virtual bool dispatch(type_dispatcher &);
  virtual typeindex::type_index get_type() const;
  value_type const  & get() const;
};

Description

This class can be used as a boilerplate for simple attribute values. The class implements all needed interfaces of attribute values and allows to store a single value of the type specified as a template parameter. The stored value can be dispatched with type dispatching mechanism.

attribute_value_impl public construct/copy/destruct

  1. explicit attribute_value_impl(value_type const & v);

    Constructor with initialization of the stored value

  2. explicit attribute_value_impl(value_type && v) noexcept(boost::is_nothrow_move_constructible< value_type >::value));

    Constructor with initialization of the stored value

attribute_value_impl public member functions

  1. virtual bool dispatch(type_dispatcher & dispatcher);

    Attribute value dispatching method.

    Parameters:

    dispatcher

    The dispatcher that receives the stored value

    Returns:

    true if the value has been dispatched, false otherwise

  2. virtual typeindex::type_index get_type() const;

    Returns:

    The attribute value type

  3. value_type const  & get() const;

    Returns:

    Reference to the contained value.


PrevUpHomeNext