wpl::tool::static_base< Bottom > Struct Template Reference

Base class of all static hierachies. More...

#include <wipal/tool/static_base.hh>

Inheritance diagram for wpl::tool::static_base< Bottom >:
wpl::phy::header< Bottom > wpl::phy::time< Bottom > wpl::phy::timetracker< Bottom > wpl::tool::iterable< Bottom > wpl::tool::iterator< Bottom > wpl::wifi::time_converter< PhyHeaderType, Bottom > wpl::phy::empty_header< Bottom > wpl::phy::empty_time< Bottom > wpl::phy::uint64_time< Bottom > wpl::filter::fast_intersector< InputIterator1, InputIterator2, Bottom > wpl::filter::linear_regression_synchronizer< InputIterator, Bottom > wpl::filter::non_noisy_prism< InputIterator, Bottom > wpl::filter::time_adjuster< InputIterator1, InputIterator2, HeaderType, Bottom > wpl::filter::timetracker< InputIterator, HeaderType, Bottom > wpl::filter::uniquely_identifiable< UniqueId, InputIterator, HeaderType, Bottom > wpl::filter::windowed_merge< HeaderType, InputIterator1, InputIterator2, Bottom > wpl::pkt::stream< Bottom > wpl::tool::list_of_iterables< T, Bottom > wpl::tool::window_maker< InputIterator, WSize, Step, Bottom > wpl::filter::internals::non_noisy_prism_iterator< I, B, Bottom > wpl::tool::internals::filter_iterator< I, P, B, Bottom > wpl::tool::list_of_iterables_iterator< T, B, Bottom > wpl::tool::valued_iterator< Bottom > wpl::tool::window< InputIterator, WSize, Step, Bottom >

List of all members.

Public Types

typedef HIDDEN exact_type

Public Member Functions

Downcast methods

const exact_typeexact () const
exact_typeexact ()
const exact_typeexact_ptr () const
exact_typeexact_ptr ()

Detailed Description

template<class Bottom>
struct wpl::tool::static_base< Bottom >

Base class of all static hierachies.

A static hierarchy is a class hierarchy within which each class knows its exact type thanks to specific template parameters.

E.g.

   static_base<cow> : animal<cow> : mammal<cow> : cow

static_base's main role is to provide the exact() and exact_ptr() methods. These methods allow intermediate classes in the hierarchy to static_cast themselves directly to their exact type. This is perfectly type safe.

E.g.

   template <class Exact>
   void
   animal<Exact>::eat()
   {
     this->exact().eat_impl(); // Delegate eat() to Exact::eat_impl().
   }

In the previous example however, one cannot subclass cow because it has no Exact parametter. Use the bottom class to solve this issue:

   static_base<cow<bottom>> : animal<cow<bottom>> : mammal<cow<bottom>> :
     cow<bottom>

     or

   static_base<highland_cow<bottom>> : animal<highland_cow<bottom>> :
     mammal<highland_cow<bottom>> : cow<highland_cow<bottom>> :
     highland_cow<bottom>

In this example however, cow must provide to mammal either highland_cow<bottom> either cow<bottom>, depending on its template parameter. This is done using the get_exact trait:

   template <class Bottom>
   struct cow:
     public mammal<typename get_exact< Bottom, cow<Bottom> >::return_type>
   {
     // Inherit mammal<cow<bottom>> if Bottom = bottom,
     // inherit mammal<Bottom>, else.

     // ...
   };

For simple cases, we provide the WP_GET_EXACT() and WP_INHERIT() preprocessor macros:

   template <class Bottom>
   struct cow: WP_INHERIT(public mammal, cow<Bottom>)
   {
     typedef WP_GET_EXACT(Bottom, cow<Bottom>) exact_type;

     // ...
   };

Member Typedef Documentation

template<class Bottom>
typedef HIDDEN wpl::tool::static_base< Bottom >::exact_type

Exact type for this template instanciation.

See also:
static_base

Reimplemented in wpl::filter::internals::fast_intersector_iterator< I1, I2, B, Bottom >, wpl::filter::internals::lr_sync_iterator< I, B, Bottom >, wpl::filter::internals::non_noisy_prism_iterator< I, B, Bottom >, wpl::filter::internals::time_adjuster_iterator< InputIterator1, InputIterator2, HeaderType, B, Bottom >, wpl::filter::internals::timetracker_iterator< InputIterator, HeaderType, B, Bottom >, wpl::filter::internals::uniquely_identifiable_iterator< U, I, H, B, Bottom >, wpl::filter::internals::windowed_merge_iterator< HT, I1, I2, B, Bottom >, wpl::pcap::internals::file_iterator< Stream, Bottom >, wpl::pcap::list< Stream, Bottom >, wpl::pkt::stream< Bottom >, wpl::pcap::istream< Bottom >, wpl::pcap::file< Bottom >, wpl::pcap::indexed_file< Bottom >, wpl::avs::header, wpl::phy::empty_time< Bottom >, wpl::phy::empty_header< Bottom >, wpl::phy::time< Bottom >, wpl::phy::uint64_time< Bottom >, wpl::phy::header< Bottom >, wpl::prism::time, wpl::prism::header, wpl::rtap::header, wpl::tool::internals::filter_iterator< I, P, B, Bottom >, wpl::tool::iterable< Bottom >, wpl::tool::iterator< Bottom >, wpl::tool::list_of_iterables_iterator< T, B, Bottom >, wpl::tool::list_of_iterables< T, Bottom >, wpl::tool::valued_iterator< Bottom >, wpl::tool::window< InputIterator, WSize, Step, Bottom >, wpl::wifi::time_converter< PhyHeaderType, Bottom >, wpl::phy::time< prism::time >, wpl::phy::header< rtap::header >, wpl::phy::header< prism::header >, wpl::phy::header< avs::header >, wpl::tool::iterable< HIDDEN >, wpl::tool::iterator< HIDDEN >, wpl::tool::list_of_iterables< Stream, HIDDEN >, wpl::tool::valued_iterator< HIDDEN >, and wpl::wifi::time_converter< HeaderType >.


The documentation for this struct was generated from the following files:

Generated by  doxygen 1.6.2