Created
September 15, 2012 09:16
-
-
Save fpersson/3727078 to your computer and use it in GitHub Desktop.
Boost statechart simple test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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