Skip to content

Instantly share code, notes, and snippets.

@fpersson
Created September 15, 2012 09:16
Show Gist options
  • Save fpersson/3727078 to your computer and use it in GitHub Desktop.
Save fpersson/3727078 to your computer and use it in GitHub Desktop.
Boost statechart simple test
cmake_minimum_required (VERSION 2.8)
project(demo)
find_package(Boost 1.4.2)
include_directories(${Boost_INCLUDE_DIR})
set(CORELIBS ${Boost_LIBRARIES})
add_executable(demo ${CORELIBS} main.cpp)
target_link_libraries(demo ${CORELIBS})
#include <string>
#include <iostream>
#include <vector>
#include <boost/statechart/state_machine.hpp>
#include <boost/statechart/simple_state.hpp>
class Greeting;
class Machine : public boost::statechart::state_machine< Machine, Greeting > {};
class Greeting : public boost::statechart::simple_state< Greeting, Machine >{
public:
Greeting(){std::cout << "Hello, world!" << std::endl;}
~Greeting(){std::cout << "Bye...." << std::endl;}
};
int main(){
Machine myMachine;
myMachine.initiate();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment