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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class template value_extractor

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

Synopsis

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

template<typename T, typename FallbackPolicyT = fallback_to_none, 
         typename TagT = void> 
class value_extractor : private FallbackPolicyT {
public:
  // construct/copy/destruct
  value_extractor() = default;
  value_extractor(value_extractor const &);
  template<typename U> explicit value_extractor(U const &);

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

Description

Attribute value extractor is a functional object that attempts to find and extract the stored attribute value from the attribute values view or a log record. The extracted value is returned from the extractor.

value_extractor public construct/copy/destruct

  1. value_extractor() = default;

    Default constructor

  2. value_extractor(value_extractor const & that);

    Copy constructor

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

    Constructor

    Parameters:

    arg

    Fallback policy constructor argument

value_extractor public member functions

  1. result_type operator()(attribute_value const & attr) const;

    Extraction operator. Attempts to acquire the stored value of one of the supported types. If extraction succeeds, the extracted value is returned.

    Parameters:

    attr

    The attribute value to extract from.

    Returns:

    The extracted value, if extraction succeeded, an empty value otherwise.

  2. result_type operator()(attribute_name const & name, 
                           attribute_value_set const & attrs) const;

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

    Parameters:

    attrs

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

    name

    Attribute value name.

    Returns:

    The extracted value, if extraction succeeded, an empty value otherwise.

  3. result_type operator()(attribute_name const & name, record const & rec) const;

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

    Parameters:

    name

    Attribute value name.

    rec

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

    Returns:

    The extracted value, if extraction succeeded, an empty value otherwise.

  4. result_type operator()(attribute_name const & name, record_view const & rec) const;

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

    Parameters:

    name

    Attribute value name.

    rec

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

    Returns:

    The extracted value, if extraction succeeded, an empty value otherwise.

  5. fallback_policy const & get_fallback_policy() const;

    Returns:

    Fallback policy


PrevUpHomeNext