Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/statechart/event.hpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.8 KB
Line 
1#ifndef BOOST_STATECHART_EVENT_HPP_INCLUDED
2#define BOOST_STATECHART_EVENT_HPP_INCLUDED
3//////////////////////////////////////////////////////////////////////////////
4// Copyright 2002-2006 Andreas Huber Doenni
5// Distributed under the Boost Software License, Version 1.0. (See accompany-
6// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7//////////////////////////////////////////////////////////////////////////////
8
9
10
11#include <boost/statechart/event_base.hpp>
12#include <boost/statechart/detail/rtti_policy.hpp>
13#include <boost/statechart/detail/memory.hpp>
14
15#include <boost/cast.hpp> // boost::polymorphic_downcast
16
17#include <memory>   // std::allocator
18
19
20
21namespace boost
22{
23namespace statechart
24{
25
26
27
28//////////////////////////////////////////////////////////////////////////////
29template< class MostDerived, class Allocator = std::allocator< void > >
30class event : public detail::rtti_policy::rtti_derived_type<
31  MostDerived, event_base >
32{
33  public:
34    //////////////////////////////////////////////////////////////////////////
35    // Compiler-generated copy constructor and copy assignment operator are
36    // fine
37
38    void * operator new( std::size_t size )
39    {
40      return detail::allocate< MostDerived, Allocator >( size );
41    }
42
43    void operator delete( void * pEvent )
44    {
45      detail::deallocate< MostDerived, Allocator >( pEvent );
46    }
47
48  protected:
49    //////////////////////////////////////////////////////////////////////////
50    event() {}
51    virtual ~event() {}
52
53  private:
54    //////////////////////////////////////////////////////////////////////////
55    virtual intrusive_ptr< const event_base > clone() const
56    {
57      return intrusive_ptr< const event_base >( new MostDerived(
58        *polymorphic_downcast< const MostDerived * >( this ) ) );
59    }
60};
61
62
63
64} // namespace statechart
65} // namespace boost
66
67
68
69#endif
Note: See TracBrowser for help on using the repository browser.