Skip to content

Commit

Permalink
Some cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
dziegel committed Aug 29, 2024
1 parent edbbc63 commit 6a29832
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 26 deletions.
14 changes: 7 additions & 7 deletions examples/activeobject/Fsm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@

namespace example::activeobject
{
Fsm::Transition Fsm::State1Handler(ImplPtr /* impl */, Event event)
static Fsm::Transition State1Handler(Fsm::ImplPtr /* impl */, Fsm::Event event)
{
switch (event->Id())
{
case Go2::kId:
return TransitionTo(kState2);
return Fsm::TransitionTo(Fsm::kState2);
default:
return NoTransition();
return Fsm::NoTransition();
}
}

Fsm::Transition Fsm::State2Handler(ImplPtr impl, Event event)
static Fsm::Transition State2Handler(Fsm::ImplPtr impl, Fsm::Event event)
{
switch (event->Id())
{
case Go1::kId:
if (impl->SomeGuardFunction(event))
{
return TransitionTo(kState1, &Impl::State2ToState1TransitionAction);
return Fsm::TransitionTo(Fsm::kState1, &Fsm::Impl::State2ToState1TransitionAction);
}
return NoTransition();
return Fsm::NoTransition();
default:
return UnhandledEvent();
return Fsm::UnhandledEvent();
}
}

Expand Down
4 changes: 0 additions & 4 deletions examples/activeobject/Fsm.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ public:
static const State kState1;
static const State kState2;

// Handlers
static Transition State1Handler(ImplPtr impl, Event event);
static Transition State2Handler(ImplPtr impl, Event event);

inline void Start()
{
FsmBase::Start(&kState1);
Expand Down
2 changes: 1 addition & 1 deletion examples/activeobject/FsmImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace example::activeobject
{
// Implements Fsm action interface
class FsmImpl : public cpp_active_objects::Hsm<Fsm>, private IFsmImpl
class FsmImpl final : public cpp_active_objects::Hsm<Fsm>, private IFsmImpl
{
public:
FsmImpl();
Expand Down
2 changes: 2 additions & 0 deletions examples/activeobject/IFsmImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ using FsmBase = cpp_event_framework::Statemachine<IFsmImpl, const cpp_event_fram
class IFsmImpl
{
public:
virtual ~IFsmImpl() = default;

virtual void State1Entry() = 0;

virtual void State2ToState1TransitionAction(FsmBase::Event event) = 0;
Expand Down
14 changes: 7 additions & 7 deletions examples/activeobject_embedded/Fsm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@

namespace example::activeobject_embedded
{
Fsm::Transition Fsm::State1Handler(ImplPtr /* impl */, Event event)
static Fsm::Transition State1Handler(Fsm::ImplPtr /* impl */, Fsm::Event event)
{
switch (event->Id())
{
case Go2::kId:
return TransitionTo(kState2);
return Fsm::TransitionTo(Fsm::kState2);
default:
return NoTransition();
return Fsm::NoTransition();
}
}

Fsm::Transition Fsm::State2Handler(ImplPtr impl, Event event)
static Fsm::Transition State2Handler(Fsm::ImplPtr impl, Fsm::Event event)
{
switch (event->Id())
{
case Go1::kId:
if (impl->SomeGuardFunction(event))
{
return TransitionTo(kState1, &Impl::State2ToState1TransitionAction);
return Fsm::TransitionTo(Fsm::kState1, &Fsm::Impl::State2ToState1TransitionAction);
}
return NoTransition();
return Fsm::NoTransition();
default:
return UnhandledEvent();
return Fsm::UnhandledEvent();
}
}

Expand Down
4 changes: 0 additions & 4 deletions examples/activeobject_embedded/Fsm.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ public:
static const State kState1;
static const State kState2;

// Handlers
static Transition State1Handler(ImplPtr impl, Event event);
static Transition State2Handler(ImplPtr impl, Event event);

inline void Start()
{
FsmBase::Start(&kState1);
Expand Down
2 changes: 1 addition & 1 deletion examples/activeobject_embedded/FsmImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace example::activeobject_embedded
{
// Implements Fsm action interface
class FsmImpl : public cpp_active_objects_embedded::Hsm<Fsm>, private IFsmImpl
class FsmImpl final : public cpp_active_objects_embedded::Hsm<Fsm>, private IFsmImpl
{
public:
FsmImpl();
Expand Down
2 changes: 2 additions & 0 deletions examples/activeobject_embedded/IFsmImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ using FsmBase = cpp_event_framework::Statemachine<IFsmImpl, const cpp_event_fram
class IFsmImpl
{
public:
virtual ~IFsmImpl() = default;

virtual void State1Entry() = 0;

virtual void State2ToState1TransitionAction(FsmBase::Event event) = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/interface/FsmImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace example::interface
{
// Implements Fsm action interface
class FsmImpl : private IFsmImpl
class FsmImpl final : private IFsmImpl
{
public:
FsmImpl();
Expand Down
2 changes: 2 additions & 0 deletions examples/interface/IFsmImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ using FsmBase = cpp_event_framework::Statemachine<IFsmImpl, EEvent>;
class IFsmImpl
{
public:
virtual ~IFsmImpl() = default;

virtual void State1Entry() = 0;

virtual void State2ToState1TransitionAction(FsmBase::Event) = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/signals/FsmImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace example::signals
{
// Implements Fsm action interface
class FsmImpl : public IFsmImpl
class FsmImpl final : public IFsmImpl
{
public:
FsmImpl();
Expand Down
2 changes: 2 additions & 0 deletions examples/signals/IFsmImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ using FsmBase = cpp_event_framework::Statemachine<IFsmImpl, const cpp_event_fram
class IFsmImpl
{
public:
virtual ~IFsmImpl() = default;

virtual void State1Entry() = 0;

virtual void State2ToState1TransitionAction(FsmBase::Event event) = 0;
Expand Down

0 comments on commit 6a29832

Please sign in to comment.