Boost C++ Libraries

PrevUpHomeNext

Class template attribute_value_extractor

boost::log::attribute_value_extractor — Generic attribute value extractor.

Synopsis

// In header: <boost/log/utility/attribute_value_extractor.hpp>

template<typename CharT, typename T> 
class attribute_value_extractor {
public:
  // types
  typedef base_type::string_type                   string_type;       // String type. 
  typedef bool                                     result_type;       // Function object result type. 
  typedef CharT                                    char_type;         // Character type. 
  typedef basic_attribute_values_view< char_type > values_view_type;  // Attribute values view type. 

  // construct/copy/destruct
  explicit attribute_value_extractor(string_type const &);

  // public member functions
  template<typename ReceiverT> 
    result_type operator()(values_view_type const &, ReceiverT &) const;
};

Description

Attribute value extractor is a functional object that attempts to extract the stored attribute value from the attribute value wrapper object. The extracted value is passed to an unary functional object (the receiver) provided by user.

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

attribute_value_extractor public construct/copy/destruct

  1. explicit attribute_value_extractor(string_type const & name);

    Constructor

    Parameters:
    name

    Attribute name to be extracted on invokation

attribute_value_extractor public member functions

  1. template<typename ReceiverT> 
      result_type operator()(values_view_type const & attrs, ReceiverT & receiver) const;

    Extraction operator. Looks for an attribute value with the name specified on construction and tries to acquire the stored value of one of the supported types. If extraction succeeds, the extracted value is passed to receiver.

    Parameters:
    attrs

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

    receiver

    A receiving functional object to pass the extracted value to.

    Returns:

    true if extraction succeeded, false otherwise


PrevUpHomeNext