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 basic_direct_mapping

boost::log::sinks::basic_direct_mapping — Straightforward mapping.

Synopsis

// In header: <boost/log/sinks/attribute_mapping.hpp>

template<typename MappedT, typename AttributeValueT = int> 
class basic_direct_mapping :
  public boost::log::sinks::basic_mapping< MappedT >
{
public:
  // types
  typedef AttributeValueT        attribute_value_type;  // Attribute contained value type. 
  typedef base_type::mapped_type mapped_type;           // Mapped value type. 

  // public member functions
  explicit basic_direct_mapping(attribute_name const &, mapped_type const &);
  mapped_type operator()(record_view const &) const;
};

Description

This type of mapping assumes that attribute with a particular name always provides values that map directly onto the native values. The mapping simply returns the extracted attribute value converted to the native value.

basic_direct_mapping public member functions

  1. explicit basic_direct_mapping(attribute_name const & name, 
                                  mapped_type const & default_value);

    Constructor

    Parameters:

    name

    Attribute name

    default_value

    The default native value that is returned if the attribute value is not found

  2. mapped_type operator()(record_view const & rec) const;

    Extraction operator

    Parameters:

    rec

    A log record to extract value from

    Returns:

    An extracted attribute value


PrevUpHomeNext