$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r50737 - sandbox/msm/boost/msm
From: christophe.j.henry_at_[hidden]
Date: 2009-01-22 18:23:04
Author: chenry
Date: 2009-01-22 18:23:03 EST (Thu, 22 Jan 2009)
New Revision: 50737
URL: http://svn.boost.org/trac/boost/changeset/50737
Log:
added possibility to make polymorphic states
Text files modified: 
   sandbox/msm/boost/msm/state_machine.hpp |    35 +++++++++++++++++++++++++++++++++++     
   1 files changed, 35 insertions(+), 0 deletions(-)
Modified: sandbox/msm/boost/msm/state_machine.hpp
==============================================================================
--- sandbox/msm/boost/msm/state_machine.hpp	(original)
+++ sandbox/msm/boost/msm/state_machine.hpp	2009-01-22 18:23:03 EST (Thu, 22 Jan 2009)
@@ -110,6 +110,13 @@
     typedef mpl::vector<>       flag_list;
     //default: no deferred events
     typedef mpl::vector<>       deferred_events;
+    // by default are states not polymorphic. Define this symbol to make them polymorphic
+    // for example if you need to use a pointer to a state_base in typeid
+#ifdef POLYMORPHIC_STATES
+    virtual ~state() {}
+#else
+    ~state() {}
+#endif
 };
 
 // flags used internally to handle terminate / interrupt states
@@ -128,6 +135,13 @@
     typedef mpl::vector<boost::msm::TerminateFlag>      flag_list;
     //default: no deferred events
     typedef mpl::vector<>                               deferred_events;
+    // by default are states not polymorphic. Define this symbol to make them polymorphic
+    // for example if you need to use a pointer to a state_base in typeid
+#ifdef POLYMORPHIC_STATES
+    virtual ~terminate_state() {}
+#else
+    ~terminate_state() {}
+#endif
 };
 
 // terminate state simply defines the InterruptedFlag and EndInterruptFlag<EndInterruptEvent> flags
@@ -143,6 +157,13 @@
                                                     flag_list;
     //default: no deferred events
     typedef mpl::vector<>                           deferred_events;
+    // by default are states not polymorphic. Define this symbol to make them polymorphic
+    // for example if you need to use a pointer to a state_base in typeid
+#ifdef POLYMORPHIC_STATES
+    virtual ~interrupt_state() {}
+#else
+    ~interrupt_state() {}
+#endif
 };
 
 // not a state but a bunch of extra typedefs to handle direct entry into a composite state. To be derived from
@@ -178,6 +199,13 @@
     typedef mpl::vector<>       flag_list;
     //default: no deferred events
     typedef mpl::vector<>       deferred_events;
+    // by default are states not polymorphic. Define this symbol to make them polymorphic
+    // for example if you need to use a pointer to a state_base in typeid
+#ifdef POLYMORPHIC_STATES
+    virtual ~entry_pseudo_state() {}
+#else
+    ~entry_pseudo_state() {}
+#endif
 };
 
 // to be derived from. Makes a state an exit (pseudo) state. Actually an almost full-fledged state
@@ -205,6 +233,13 @@
     //default: no deferred events
     typedef mpl::vector<>  deferred_events;
 
+    // by default are states not polymorphic. Define this symbol to make them polymorphic
+    // for example if you need to use a pointer to a state_base in typeid
+#ifdef POLYMORPHIC_STATES
+    virtual ~exit_pseudo_state() {}
+#else
+    ~exit_pseudo_state() {}
+#endif
     // forward event to the higher-level FSM
     template <class ForwardEvent>
     void forward_event(ForwardEvent const& incomingEvent)