Boost C++ Libraries

PrevUpHomeNext

Class template static_type_dispatcher

boost::log::static_type_dispatcher — A static type dispatcher class.

Synopsis

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

template<typename TypeSequenceT, 
         typename VisitorGenT = mpl::quote1< type_visitor >, 
         typename RootT = type_dispatcher> 
class static_type_dispatcher : public mpl::inherit_linearly::type< TypeSequenceT, mpl::inherit< mpl::_1, mpl::apply_wrap1< VisitorGenT, mpl::_2 > >, RootT >
{
public:
  // types
  typedef TypeSequenceT supported_types;  // Type sequence of the supported types. 

  // construct/copy/destruct
  static_type_dispatcher();
};

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.

Static type dispatchers allow to specify set of supported types at compile time. The class is parametrized with the following template parameters:

  • TypeSequenceT - an MPL type sequence of types that need to be supported by the dispatcher

  • VisitorGenT - an MPL unary metafunction class that will be used to generate concrete visitors. The metafunction will be applied to each type in the TypeSequenceT type sequence.

  • RootT - the ultimate base class of the dispatcher

Users can either derive their classes from the dispatcher and override visit methods for all the supported types, or specify in the VisitorGenT template parameter a custom unary metafunction class that will generate visitors for all supported types (each generated visitor must derive from the appropriate type_visitor instance in this case). Users can also specify a custom base class for the dispatcher in the RootT template parameter (the base class, however, must derive from the type_dispatcher interface).

static_type_dispatcher public construct/copy/destruct

  1. static_type_dispatcher();

    Default constructor. Initializes the dispatcher internals.


PrevUpHomeNext