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 dynamic_type_dispatcher

boost::log::dynamic_type_dispatcher — A dynamic type dispatcher.

Synopsis

// In header: <boost/log/utility/type_dispatch/dynamic_type_dispatcher.hpp>


class dynamic_type_dispatcher : public type_dispatcher {
public:
  // construct/copy/destruct
  dynamic_type_dispatcher();
  dynamic_type_dispatcher(dynamic_type_dispatcher const &);
  dynamic_type_dispatcher& operator=(dynamic_type_dispatcher const &);

  // public member functions
  template<typename T, typename VisitorT> void register_type(VisitorT const &);
  dispatching_map::size_type registered_types_count() const;
};

Description

The type dispatcher can be used to pass objects of arbitrary types from one component to another. With regard to the library, the type dispatcher can be used to extract attribute values.

The dynamic type dispatcher can be initialized in run time and, therefore, can support different types, depending on runtime conditions. Each supported type is associated with a functional object that will be called when an object of the type is dispatched.

dynamic_type_dispatcher public construct/copy/destruct

  1. dynamic_type_dispatcher();

    Default constructor

  2. dynamic_type_dispatcher(dynamic_type_dispatcher const & that);

    Copy constructor

  3. dynamic_type_dispatcher& operator=(dynamic_type_dispatcher const & that);

    Copy assignment

dynamic_type_dispatcher public member functions

  1. template<typename T, typename VisitorT> 
      void register_type(VisitorT const & visitor);

    The method registers a new type

    Parameters:

    visitor

    Function object that will be associated with the type T

  2. dispatching_map::size_type registered_types_count() const;

    The method returns the number of registered types


PrevUpHomeNext