Skip to content

Commit

Permalink
general: Format code using clang-format
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Davis <[email protected]>
  • Loading branch information
christopher-davis-afs committed Dec 5, 2023
1 parent b31d5f9 commit 0daf48f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
9 changes: 5 additions & 4 deletions examples/light_switch/fsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ struct Context {
void set_brightness(int value);
};

enum class Event {
enum class Event
{
PRESSED_ON,
PRESSED_OFF,
ENTER_MOTION_MODE,
Expand All @@ -19,10 +20,10 @@ enum class Event {
};

#ifdef HEAP_FREE_MODE
using BufferType = fsm::buffer::SwapBuffer<24, 16, 2>;
using FSM = fsm::FSM<Event, int, BufferType>;
using BufferType = fsm::buffer::SwapBuffer<24, 16, 2>;
using FSM = fsm::FSM<Event, int, BufferType>;
#else
using FSM = fsm::FSM<Event, int>;
using FSM = fsm::FSM<Event, int>;
#endif

using SimpleState = fsm::states::StateWithContext<FSM::SimpleStateType, Context>;
Expand Down
3 changes: 2 additions & 1 deletion include/fsm/_impl/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ struct is_base_state_of {
static const bool value = std::is_base_of<BaseType, DerivedStateType>::value;
};

enum class FeedResultState {
enum class FeedResultState
{
TRANSITION,
UNHANDLED_EVENT,
INTERNAL_ERROR,
Expand Down
8 changes: 5 additions & 3 deletions include/fsm/_impl/state_allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ template <typename SwapAllocatorBufferType> class StateAllocator;

class DynamicStateAllocator {
public:
enum class InternalState {
enum class InternalState
{
READY_FOR_CREATION,
FAILED_MULTIPLE_SIMPLE_CREATE,
FAILED_MULTIPLE_COMPOUND_CREATE,
Expand Down Expand Up @@ -50,7 +51,7 @@ class DynamicStateAllocator {
return true;
}

template <typename SimpleStateType> auto pull_simple_state() {
template <typename SimpleStateType> auto pull_simple_state() {
auto retval = reinterpret_cast<SimpleStateType*>(simple_state);
if (retval) {
simple_state = nullptr;
Expand Down Expand Up @@ -95,7 +96,8 @@ class DynamicStateAllocator {

template <typename SwapBufferType> class StateAllocator {
public:
enum class InternalState {
enum class InternalState
{
READY_FOR_CREATION,
FAILED_COMPOUND_OVERFLOW,
FAILED_MULTIPLE_SIMPLE_CREATE,
Expand Down
3 changes: 2 additions & 1 deletion include/fsm/fsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
namespace fsm {

// FIXME (aw): we should treat internal unhandled events as errors because this doesn't make sense by design!
enum class HandleEventResult {
enum class HandleEventResult
{
SUCCESS,
UNHANDLED,
INTERNAL_ERROR,
Expand Down
3 changes: 2 additions & 1 deletion include/fsm/states.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ template <typename SwapBufferType> class StateAllocator;

class HandleEventResult {
private:
enum class InternalState {
enum class InternalState
{
NEW_STATE,
HANDLED_INTERNALY,
ALLOCATION_ERROR,
Expand Down

0 comments on commit 0daf48f

Please sign in to comment.