Boost C++ Libraries

PrevUpHomeNext

Class template value_visitor_invoker

boost::log::value_visitor_invoker — Generic attribute value visitor invoker.

Synopsis

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

template<typename T, typename FallbackPolicyT> 
class value_visitor_invoker : private FallbackPolicyT {
public:
  // types
  typedef T                 value_type;       // Attribute value types. 
  typedef FallbackPolicyT   fallback_policy;  // Fallback policy. 
  typedef visitation_result result_type;      // Function object result type. 

  // construct/copy/destruct
  value_visitor_invoker() = default;
  value_visitor_invoker(value_visitor_invoker const &);
  template<typename U> explicit value_visitor_invoker(U const &);

  // public member functions
  template<typename VisitorT> 
    result_type operator()(attribute_value const &, VisitorT) const;
  template<typename VisitorT> 
    result_type operator()(attribute_name const &, 
                           attribute_value_set const &, VisitorT) const;
  template<typename VisitorT> 
    result_type operator()(attribute_name const &, record const &, VisitorT) const;
  template<typename VisitorT> 
    result_type operator()(attribute_name const &, record_view const &, 
                           VisitorT) const;
  fallback_policy const & get_fallback_policy() const;
};

Description

Attribute value invoker is a functional object that attempts to find and extract the stored attribute value from the attribute value view or a log record. The extracted value is passed to an unary function object (the visitor) provided by user.

The invoker can be specialized on one or several attribute value types that should be specified in the second template argument.

value_visitor_invoker public construct/copy/destruct

  1. value_visitor_invoker() = default;

    Default constructor

  2. value_visitor_invoker(value_visitor_invoker const & that);

    Copy constructor

  3. template<typename U> explicit value_visitor_invoker(U const & arg);

    Initializing constructor

    Parameters:

    arg

    Fallback policy argument

value_visitor_invoker public member functions

  1. template<typename VisitorT> 
      result_type operator()(attribute_value const & attr, VisitorT visitor) const;

    Visitation operator. Attempts to acquire the stored value of one of the supported types. If acquisition succeeds, the value is passed to visitor.

    Parameters:

    attr

    An attribute value to apply the visitor to.

    visitor

    A receiving function object to pass the attribute value to.

    Returns:

    The result of visitation.

  2. template<typename VisitorT> 
      result_type operator()(attribute_name const & name, 
                             attribute_value_set const & attrs, VisitorT visitor) const;

    Visitation operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If acquisition succeeds, the value is passed to visitor.

    Parameters:

    attrs

    A set of attribute values in which to look for the specified attribute value.

    name

    Attribute value name.

    visitor

    A receiving function object to pass the attribute value to.

    Returns:

    The result of visitation.

  3. template<typename VisitorT> 
      result_type operator()(attribute_name const & name, record const & rec, 
                             VisitorT visitor) const;

    Visitation operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If acquisition succeeds, the value is passed to visitor.

    Parameters:

    name

    Attribute value name.

    rec

    A log record. The attribute value will be sought among those associated with the record.

    visitor

    A receiving function object to pass the attribute value to.

    Returns:

    The result of visitation.

  4. template<typename VisitorT> 
      result_type operator()(attribute_name const & name, record_view const & rec, 
                             VisitorT visitor) const;

    Visitation operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If acquisition succeeds, the value is passed to visitor.

    Parameters:

    name

    Attribute value name.

    rec

    A log record view. The attribute value will be sought among those associated with the record.

    visitor

    A receiving function object to pass the attribute value to.

    Returns:

    The result of visitation.

  5. fallback_policy const & get_fallback_policy() const;

    Returns:

    Fallback policy


PrevUpHomeNext