Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/statechart/event.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
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 ////////////////////////////////////////////////////////////////////////////// | |
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 | |
21 namespace boost | |
22 { | |
23 namespace statechart | |
24 { | |
25 | |
26 | |
27 | |
28 ////////////////////////////////////////////////////////////////////////////// | |
29 template< class MostDerived, class Allocator = std::allocator< void > > | |
30 class 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 new( std::size_t, void * p ) | |
44 { | |
45 return p; | |
46 } | |
47 | |
48 void operator delete( void * pEvent ) | |
49 { | |
50 detail::deallocate< MostDerived, Allocator >( pEvent ); | |
51 } | |
52 | |
53 void operator delete( void * pEvent, void * p ) | |
54 { | |
55 } | |
56 | |
57 protected: | |
58 ////////////////////////////////////////////////////////////////////////// | |
59 event() {} | |
60 virtual ~event() {} | |
61 | |
62 private: | |
63 ////////////////////////////////////////////////////////////////////////// | |
64 virtual intrusive_ptr< const event_base > clone() const | |
65 { | |
66 return intrusive_ptr< const event_base >( new MostDerived( | |
67 *polymorphic_downcast< const MostDerived * >( this ) ) ); | |
68 } | |
69 }; | |
70 | |
71 | |
72 | |
73 } // namespace statechart | |
74 } // namespace boost | |
75 | |
76 | |
77 | |
78 #endif |