diff --git a/test/ScXmlFsmImpl.cxx b/test/ScXmlFsmImpl.cxx index e8b4aaa..8ed4a28 100644 --- a/test/ScXmlFsmImpl.cxx +++ b/test/ScXmlFsmImpl.cxx @@ -17,7 +17,7 @@ ScXmlFsmImpl::ScXmlFsmImpl() fsm.Implementation()->UnhandledEvent(); }; - fsm_.Init(this, "ScXml", ScXmlTest::kInitialState); + fsm_.Init(this, "ScXml"); } void ScXmlFsmImpl::Test() @@ -27,7 +27,7 @@ void ScXmlFsmImpl::Test() assert(fsm_.CurrentState() == nullptr); // Start FSM. Entry actions of initial states must be called. - fsm_.Start(); + fsm_.Start(ScXmlTest::kInitialState); assert(fsm_.CurrentState() == &ScXmlTest::kState_1State_2); assert(state1_on_entry_called_); state1_on_entry_called_ = false; diff --git a/test/XmiFsm.hxx b/test/XmiFsm.hxx index 9f9f647..fa09d86 100644 --- a/test/XmiFsm.hxx +++ b/test/XmiFsm.hxx @@ -6,7 +6,7 @@ #include #include -class EventPoolAllocator : public cpp_event_framework::PoolAllocator +class EventPoolAllocator : public cpp_event_framework::CustomAllocator { }; diff --git a/test/XmiFsmImpl.cxx b/test/XmiFsmImpl.cxx index 7aa09e7..185245f 100644 --- a/test/XmiFsmImpl.cxx +++ b/test/XmiFsmImpl.cxx @@ -8,9 +8,9 @@ constexpr size_t kPoolSize = 10; XmiFsmImpl::XmiFsmImpl() + : pool_(cpp_event_framework::Pool<>::MakeShared(PoolSizeCalculator::kSptrSize, kPoolSize, "EventPool")) { - auto pool = cpp_event_framework::Pool<>::MakeShared(PoolSizeCalculator::kSptrSize, kPoolSize, "MyPool"); - EventPoolAllocator::SetPool(pool); + EventPoolAllocator::SetAllocator(pool_); fsm_.on_handle_event_ = [](XmiTest::Ref fsm, XmiTest::StateRef state, XmiTest::Event event) { std::cout << fsm << " State " << state << " handle event " << event << '\n'; }; @@ -24,19 +24,19 @@ XmiFsmImpl::XmiFsmImpl() fsm.Implementation()->UnhandledEvent(); }; - fsm_.Init(this, "Xmi", XmiTest::kInitialState); + fsm_.Init(this, "Xmi"); } void XmiFsmImpl::Test() { - assert(EventPoolAllocator::pool->FillLevel() == kPoolSize); + assert(pool_->FillLevel() == kPoolSize); // FSM not started CheckAllFalse(); assert(fsm_.CurrentState() == nullptr); // Start FSM. Entry actions of initial states must be called. - fsm_.Start(); + fsm_.Start(XmiTest::kInitialState); assert(fsm_.CurrentState() == &XmiTest::kState_1State_2); assert(state1_on_entry_called_); state1_on_entry_called_ = false; @@ -145,7 +145,7 @@ void XmiFsmImpl::Test() choice_action2_called_ = false; CheckAllFalse(); - assert(EventPoolAllocator::pool->FillLevel() == kPoolSize); + assert(pool_->FillLevel() == kPoolSize); } void XmiFsmImpl::CheckAllFalse() const diff --git a/test/XmiFsmImpl.hxx b/test/XmiFsmImpl.hxx index e6f4d59..6cfc42a 100644 --- a/test/XmiFsmImpl.hxx +++ b/test/XmiFsmImpl.hxx @@ -11,6 +11,7 @@ public: private: XmiTest fsm_; + cpp_event_framework::Pool<>::SPtr pool_; bool on_unhandled_event_called_ = false; void UnhandledEvent() override;