
Greetings; PROBLEM: I have a need to call a 'post_event' from the ctor of a templated state that belongs to a templated machine. BEST SHOT AT SOLUTION SO FAR: ( items #1,#2 & #3 below work fine... item #4, my goal, fails) Request for specific assistance is in item #5 below. Thank you for your time and effort, I know you are very busy and appreciate the help. Regards, Tony Turner acturner01@comcast.net //************************************************************************ (1) I started with the following non-templated version, which works just fine: ... namespace sc = boost::statechart; namespace mpl = boost::mpl; ... // fwd decl struct Start; struct Inst : public sc::state_machine< Inst, Start > {}; struct Start : public sc::state< Start, Inst > { Start(my_context ctx ) : my_base( ctx ) {// do some stuff ...} }; // 'main' routine is.... BOOST_AUTO_TEST_CASE(testMyMachine) { Inst myMachine; myMachine.initiate(); } //************************************************************************ (2) I then templated the machine, with no problems, which is half way to my solution: // fwd decl struct NDIREV_17 {}; struct Start; template< typename I > struct Inst : public sc::state_machine< Inst<I>, Start > {}; struct Start : public sc::state< Start, Inst1<NDIREV_17> > { Start(my_context ctx ) : my_base( ctx ) {} }; // 'main' routine is.... BOOST_AUTO_TEST_CASE(testMyMachine) { Inst<NDIREV_17> myMachine; myMachine.initiate(); } //************************************************************************ (3) I then templated the simple_state<> version, which works just fine. struct NDIREV_17 {}; template< typename I > struct Start; template< typename I > struct Inst : public sc::state_machine< Inst<I>, Start<I> > {}; template< typename I > struct Start : public sc::simple_state< Start<I>, Inst<I> > { }; // same 'main' //************************************************************************ (4) finally, I templated the state<> version, , which has problems. [NOTE: I've referenced line # 3773 below, to sync with output] struct NDIREV_17 {}; template< typename I > struct Start; template< typename I > struct Inst : public sc::state_machine< Inst<I>, Start<I> > {};[ line# 3773 ] template< typename I > struct Start : public sc::state< Start<I>, Inst<I> > { Start<I>(my_context ctx ) : my_base( ctx ) {} }; // same 'main' //************************************************************************ (5) ATTEMPTS TO FIX: a) look @ code in state.hpp ( shown below ) and attempt to replace "my_context" & "my_base" with direct substitutions of "simple_state" and this->set_context.... no luck. REQUEST FOR HELP: Could someone who has successfully templated both the machine<> and the state<> classes possibly give me a hint as to what I might be able to do to fix this bug? Thank you for your time and effort; Tony Turner acturner01@comcast.net //************************************************************************ (6) state.hpp fragment // here is 'state<> fragment from state.hpp template< class MostDerived, class Context, class InnerInitial = mpl::list<>, history_mode historyMode = has_no_history > class state : public simple_state< MostDerived, Context, InnerInitial, historyMode > { typedef simple_state< MostDerived, Context, InnerInitial, historyMode > base_type; protected: ////////////////////////////////////////////////////////////////////////// struct my_context { my_context( typename base_type::context_ptr_type pContext ) : pContext_( pContext ) { } typename base_type::context_ptr_type pContext_; }; typedef state my_base; state( my_context ctx ) { this->set_context( ctx.pContext_ ); } ~state() {} ------------------------------------------------------------ ------------------------------------------------------------ Resulting Error msg: Device.hpp:3774: error: expected `)' before 'ctx' In file included from src/bin/UnitTestDevice.cpp:25: Device.hpp:3774: error: expected `)' before 'ctx' /usr/include/boost/statechart/state.hpp: In static member function 'static typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::inner_context_ptr_type boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::shallow_construct(const typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::context_ptr_type&, typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]': /usr/include/boost/statechart/state.hpp:79: instantiated from 'static void boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::deep_construct(const typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::context_ptr_type&, typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]' /usr/include/boost/statechart/state.hpp:70: instantiated from 'static void boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::initial_deep_construct(typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]' /usr/include/boost/statechart/state_machine.hpp:701: instantiated from 'void boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initial_construct() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' /usr/include/boost/statechart/state_machine.hpp:716: instantiated from 'boost::statechart::result boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initial_construct_function::operator()() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' /usr/include/boost/statechart/null_exception_translator.hpp:33: instantiated from 'boost::statechart::result boost::statechart::null_exception_translator::operator()(Action, ExceptionEventHandler) [with Action = boost::statechart::state_machine<MNavAnts::Inst1<MNavAnts::NDIREV_99>, MNavAnts::Start1<MNavAnts::NDIREV_99>, std::allocator<void>, boost::statechart::null_exception_translator>::initial_construct_function, ExceptionEventHandler = boost::statechart::state_machine<MNavAnts::Inst1<MNavAnts::NDIREV_99>, MNavAnts::Start1<MNavAnts::NDIREV_99>, std::allocator<void>, boost::statechart::null_exception_translator>::exception_event_handler]' /usr/include/boost/statechart/state_machine.hpp:253: instantiated from 'void boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initiate() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' src/bin/UnitTestDevice.cpp:870: instantiated from here /usr/include/boost/statechart/state.hpp:89: error: no matching function for call to 'MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1( boost::statechart::state<MNavAnts::Start1<MNavAnts::NDIREV_99>, MNavAnts::Inst1<MNavAnts::NDIREV_99>, boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, has_no_history>::my_context)' Device.hpp:3773: note: candidates are: MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1() Device.hpp:3773: note: MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1(const MNavAnts::Start1<MNavAnts::NDIREV_99>&) /usr/include/boost/statechart/state.hpp: In static member function 'static typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::inner_context_ptr_type boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::shallow_construct(const typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::context_ptr_type&, typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]': /usr/include/boost/statechart/state.hpp:79: instantiated from 'static void boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::deep_construct(const typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::context_ptr_type&, typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]' /usr/include/boost/statechart/state.hpp:70: instantiated from 'static void boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::initial_deep_construct(typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]' /usr/include/boost/statechart/state_machine.hpp:701: instantiated from 'void boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initial_construct() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' /usr/include/boost/statechart/state_machine.hpp:716: instantiated from 'boost::statechart::result boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initial_construct_function::operator()() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' /usr/include/boost/statechart/null_exception_translator.hpp:33: instantiated from 'boost::statechart::result boost::statechart::null_exception_translator::operator()(Action, ExceptionEventHandler) [with Action = boost::statechart::state_machine<MNavAnts::Inst1<MNavAnts::NDIREV_99>, MNavAnts::Start1<MNavAnts::NDIREV_99>, std::allocator<void>, boost::statechart::null_exception_translator>::initial_construct_function, ExceptionEventHandler = boost::statechart::state_machine<MNavAnts::Inst1<MNavAnts::NDIREV_99>, MNavAnts::Start1<MNavAnts::NDIREV_99>, std::allocator<void>, boost::statechart::null_exception_translator>::exception_event_handler]' /usr/include/boost/statechart/state_machine.hpp:253: instantiated from 'void boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initiate() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' src/bin/UnitTestDevice.cpp:870: instantiated from here /usr/include/boost/statechart/state.hpp:89: error: no matching function for call to 'MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1( boost::statechart::state<MNavAnts::Start1<MNavAnts::NDIREV_99>, MNavAnts::Inst1<MNavAnts::NDIREV_99>, boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, has_no_history>::my_context)' Device.hpp:3773: note: candidates are: MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1() Device.hpp:3773: note: MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1(const MNavAnts::Start1<MNavAnts::NDIREV_99>&)

(4) finally, I templated the state<> version, , which has problems.
[NOTE: I've referenced line # 3773 below, to sync with output]
struct NDIREV_17 {};
template< typename I > struct Start;
template< typename I > struct Inst : public sc::state_machine< Inst<I>, Start<I> > {};[ line# 3773 ]
template< typename I > struct Start : public sc::state< Start<I>, Inst<I> > { Start<I>(my_context ctx ) : my_base( ctx ) {} };
Did you try this way: template<typename I> struct Inst : public sc::state_machine<Inst<I>, mpl::list<Start<I> > >
// same 'main'
//************************************************************************ (5) ATTEMPTS TO FIX:
a) look @ code in state.hpp ( shown below ) and attempt to replace "my_context" & "my_base" with direct substitutions of "simple_state" and this->set_context.... no luck.
REQUEST FOR HELP: Could someone who has successfully templated both the machine<> and the state<> classes possibly give me a hint as to what I might be able to do to fix this bug?
Thank you for your time and effort;
Tony Turner acturner01@comcast.net
//************************************************************************ (6) state.hpp fragment
// here is 'state<> fragment from state.hpp
template< class MostDerived, class Context, class InnerInitial = mpl::list<>, history_mode historyMode = has_no_history > class state : public simple_state< MostDerived, Context, InnerInitial, historyMode > { typedef simple_state< MostDerived, Context, InnerInitial, historyMode > base_type;
protected: ////////////////////////////////////////////////////////////////////////// struct my_context { my_context( typename base_type::context_ptr_type pContext ) : pContext_( pContext ) { }
typename base_type::context_ptr_type pContext_; };
typedef state my_base;
state( my_context ctx ) { this->set_context( ctx.pContext_ ); }
~state() {}
------------------------------------------------------------ ------------------------------------------------------------
Resulting Error msg:
Device.hpp:3774: error: expected `)' before 'ctx' In file included from src/bin/UnitTestDevice.cpp:25: Device.hpp:3774: error: expected `)' before 'ctx' /usr/include/boost/statechart/state.hpp: In static member function 'static typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::inner_context_ptr_type boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::shallow_construct(const typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::context_ptr_type&, typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]': /usr/include/boost/statechart/state.hpp:79: instantiated from 'static void boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::deep_construct(const typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::context_ptr_type&, typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]' /usr/include/boost/statechart/state.hpp:70: instantiated from 'static void boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::initial_deep_construct(typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]' /usr/include/boost/statechart/state_machine.hpp:701: instantiated from 'void boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initial_construct() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' /usr/include/boost/statechart/state_machine.hpp:716: instantiated from 'boost::statechart::result boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initial_construct_function::operator()() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' /usr/include/boost/statechart/null_exception_translator.hpp:33: instantiated from 'boost::statechart::result boost::statechart::null_exception_translator::operator()(Action, ExceptionEventHandler) [with Action = boost::statechart::state_machine<MNavAnts::Inst1<MNavAnts::NDIREV_99>, MNavAnts::Start1<MNavAnts::NDIREV_99>, std::allocator<void>, boost::statechart::null_exception_translator>::initial_construct_function, ExceptionEventHandler = boost::statechart::state_machine<MNavAnts::Inst1<MNavAnts::NDIREV_99>, MNavAnts::Start1<MNavAnts::NDIREV_99>, std::allocator<void>, boost::statechart::null_exception_translator>::exception_event_handler]' /usr/include/boost/statechart/state_machine.hpp:253: instantiated from 'void boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initiate() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' src/bin/UnitTestDevice.cpp:870: instantiated from here /usr/include/boost/statechart/state.hpp:89: error: no matching function for call to 'MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1( boost::statechart::state<MNavAnts::Start1<MNavAnts::NDIREV_99>, MNavAnts::Inst1<MNavAnts::NDIREV_99>, boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, has_no_history>::my_context)' Device.hpp:3773: note: candidates are: MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1() Device.hpp:3773: note: MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1(const MNavAnts::Start1<MNavAnts::NDIREV_99>&) /usr/include/boost/statechart/state.hpp: In static member function 'static typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::inner_context_ptr_type boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::shallow_construct(const typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::context_ptr_type&, typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]': /usr/include/boost/statechart/state.hpp:79: instantiated from 'static void boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::deep_construct(const typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::context_ptr_type&, typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]' /usr/include/boost/statechart/state.hpp:70: instantiated from 'static void boost::statechart::state<MostDerived, Context, InnerInitial, historyMode>::initial_deep_construct(typename boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context_base_type&) [with MostDerived = MNavAnts::Start1<MNavAnts::NDIREV_99>, Context = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]' /usr/include/boost/statechart/state_machine.hpp:701: instantiated from 'void boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initial_construct() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' /usr/include/boost/statechart/state_machine.hpp:716: instantiated from 'boost::statechart::result boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initial_construct_function::operator()() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' /usr/include/boost/statechart/null_exception_translator.hpp:33: instantiated from 'boost::statechart::result boost::statechart::null_exception_translator::operator()(Action, ExceptionEventHandler) [with Action = boost::statechart::state_machine<MNavAnts::Inst1<MNavAnts::NDIREV_99>, MNavAnts::Start1<MNavAnts::NDIREV_99>, std::allocator<void>, boost::statechart::null_exception_translator>::initial_construct_function, ExceptionEventHandler = boost::statechart::state_machine<MNavAnts::Inst1<MNavAnts::NDIREV_99>, MNavAnts::Start1<MNavAnts::NDIREV_99>, std::allocator<void>, boost::statechart::null_exception_translator>::exception_event_handler]' /usr/include/boost/statechart/state_machine.hpp:253: instantiated from 'void boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initiate() [with MostDerived = MNavAnts::Inst1<MNavAnts::NDIREV_99>, InitialState = MNavAnts::Start1<MNavAnts::NDIREV_99>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' src/bin/UnitTestDevice.cpp:870: instantiated from here /usr/include/boost/statechart/state.hpp:89: error: no matching function for call to 'MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1( boost::statechart::state<MNavAnts::Start1<MNavAnts::NDIREV_99>, MNavAnts::Inst1<MNavAnts::NDIREV_99>, boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, has_no_history>::my_context)' Device.hpp:3773: note: candidates are: MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1() Device.hpp:3773: note: MNavAnts::Start1<MNavAnts::NDIREV_99>::Start1(const MNavAnts::Start1<MNavAnts::NDIREV_99>&)
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Igor R <boost.lists <at> gmail.com> writes:
(4) finally, I templated the state<> version, , which has problems.
[NOTE: I've referenced line # 3773 below, to sync with output]
struct NDIREV_17 {};
template< typename I > struct Start;
template< typename I > struct Inst : public sc::state_machine< Inst<I>, Start<I> > {};[ line# 3773 ]
template< typename I > struct Start : public sc::state< Start<I>, Inst<I> > { Start<I>(my_context ctx ) : my_base( ctx ) {} };
Did you try this way: template<typename I> struct Inst : public sc::state_machine<Inst<I>, mpl::list<Start<I> > >
// same 'main'
Thank you for the suggestion. It resulted in the following error msg: /usr/include/boost/statechart/state_machine.hpp:701: error: 'initial_deep_construct' is not a member of 'boost::mpl::list<MNavAnts::Instruction<MNavAnts::NDIREV_17, MNavAnts::Start>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>'

Tony Turner wrote:
template< typename I > struct Start : public sc::state< Start<I>, Inst<I> > { Start<I>(my_context ctx ) : my_base( ctx ) {} };
try this: template< typename I > struct Start : public sc::state< Start<I>, Inst<I> > { Start<I>( typename sc::state< Start<I>, Inst<I> >::my_context ctx ) : my_base( ctx ) {} }; HTH Juraj

Juraj Ivančić <juraj.ivancic <at> gmail.com> writes:
Tony Turner wrote:
template< typename I > struct Start : public sc::state< Start<I>, Inst<I> > { Start<I>(my_context ctx ) : my_base( ctx ) {} };
try this:
template< typename I > struct Start : public sc::state< Start<I>, Inst<I> > { Start<I>( typename sc::state< Start<I>, Inst<I> >::my_context ctx ) : my_base( ctx ) {} };
HTH
Juraj
Thank you for the reply. This change resulted in the following error msg: error: class 'Start' does not have any field named 'my_base' I added the sc::state<... qualification to 'my_base' as well, and received the following error msg: 'initial_deep_construct' is not a member of 'boost::mpl::list<Start<I>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>' Your thoughts? Thank you again, Tony

Tony Turner wrote:
I added the sc::state<... qualification to 'my_base' as well, and received the following error msg:
'initial_deep_construct' is not a member of 'boost::mpl::list<Start<I>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>'
It seems to me that this error is caused by adding mpl::list as suggested by Igor R. Undo this and it should compile. HTH Juraj

Hi Tony [snip problem description] Please prepend the subject of your posts with the library name in square brackets, e.g. [statechart]. This helps all readers to filter posts according to their interests and, at least for statechart, often results in more timely attention from the library author. Were you able to solve your problem? If not, please let me know. Thanks & Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
participants (4)
-
Andreas Huber
-
Igor R
-
Juraj Ivančić
-
Tony Turner