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 value_extractor

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

Synopsis

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

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

  // public member functions
  value_extractor() = default;
  value_extractor(value_extractor const &);
  template<typename U> explicit value_extractor(U const &);
  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 member functions

  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

  4. 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.

  5. 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:

    name

    Attribute value name.

    attrs

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

    Returns:

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

  6. 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.

  7. 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.

  8. fallback_policy const & get_fallback_policy() const;

    Returns:

    Fallback policy


PrevUpHomeNext