1 #ifndef BOOST_STATECHART_EVENT_HPP_INCLUDED
2 #define BOOST_STATECHART_EVENT_HPP_INCLUDED
3 //////////////////////////////////////////////////////////////////////////////
4 // Copyright 2002-2007 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 //////////////////////////////////////////////////////////////////////////////
11 #include <boost/statechart/event_base.hpp>
12 #include <boost/statechart/detail/rtti_policy.hpp>
13 #include <boost/statechart/detail/memory.hpp>
15 #include <boost/polymorphic_cast.hpp> // boost::polymorphic_downcast
17 #include <memory> // std::allocator
28 //////////////////////////////////////////////////////////////////////////////
29 template< class MostDerived, class Allocator = std::allocator< none > >
30 class event : public detail::rtti_policy::rtti_derived_type<
31 MostDerived, event_base >
34 //////////////////////////////////////////////////////////////////////////
35 // Compiler-generated copy constructor and copy assignment operator are
38 void * operator new( std::size_t size )
40 return detail::allocate< MostDerived, Allocator >( size );
43 void * operator new( std::size_t, void * p )
48 void operator delete( void * pEvent )
50 detail::deallocate< MostDerived, Allocator >( pEvent );
53 void operator delete( void * pEvent, void * p )
58 //////////////////////////////////////////////////////////////////////////
63 //////////////////////////////////////////////////////////////////////////
64 virtual intrusive_ptr< const event_base > clone() const
66 return intrusive_ptr< const event_base >( new MostDerived(
67 *polymorphic_downcast< const MostDerived * >( this ) ) );
73 } // namespace statechart