Giter VIP home page Giter VIP logo

fsm's Introduction

FSM - C++ Template-based Finite State Machine

Copyright Gerhard Reitmayr 2007-2012

This small header file fsm.h provides a simple state machine implementation based on C++ template programming. It supports handling incoming events and entry/exit calls for each state. It does not support hierarchical state machines, tracing, explicit start/stop states etc.

It's aim is to be usable with minimal overhead in the client code. Thus, there is no need to declare and implement hierarchies of state classes or construct tables of state transitions and functions to call. The example in lightswitch.cpp shows a simple usage example of a light switch that only receives a single kind of event.

fsm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fsm's Issues

Visual Studio 2015 compiling error???

fsm.h was unable to compiled caused by "template" keyword error:

1>f:\projectarea\googletest\gtestharness\fsm.h(38): error C2059: syntax error: 'template'
1> f:\projectarea\googletest\gtestharness\fsm.h(124): note: see reference to function template instantiation 'int SwitchTemplate::work<StateMachine<LightSwitch,STATELIST>::CallEventNoData>(int,CONTEXT &)' being compiled
1> with
1> [
1> STATELIST=LightSwitch::StateList,
1> CONTEXT=StateMachine<LightSwitch,LightSwitch::StateList>::CallEventNoData
1> ]
1> f:\projectarea\googletest\gtestharness\fsm.h(124): note: see reference to function template instantiation 'int SwitchTemplate::work<StateMachine<LightSwitch,STATELIST>::CallEventNoData>(int,CONTEXT &)' being compiled
1> with
1> [
1> STATELIST=LightSwitch::StateList,
1> CONTEXT=StateMachine<LightSwitch,LightSwitch::StateList>::CallEventNoData
1> ]
1> f:\projectarea\googletest\gtestharness\fsm.h(122): note: while compiling class template member function 'void StateMachine<LightSwitch,LightSwitch::StateList>::work(void)'
1> f:\projectarea\googletest\gtestharness\fsm_test.cpp(34): note: see reference to function template instantiation 'void StateMachine<LightSwitch,LightSwitch::StateList>::work(void)' being compiled
1> f:\projectarea\googletest\gtestharness\fsm_test.cpp(32): note: see reference to class template instantiation 'StateMachine<LightSwitch,LightSwitch::StateList>' being compiled
1>f:\projectarea\googletest\gtestharness\fsm.h(38): error C2951: template declarations are only permitted at global, namespace, or class scope

Thanks
Lu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.