diff options
Diffstat (limited to 'test/src/test-performance.cpp')
-rw-r--r-- | test/src/test-performance.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/src/test-performance.cpp b/test/src/test-performance.cpp index 13fc141..922b1ca 100644 --- a/test/src/test-performance.cpp +++ b/test/src/test-performance.cpp @@ -1,5 +1,6 @@ #include "uscxml/config.h" #include "uscxml/Interpreter.h" +#include "uscxml/plugins/Factory.h" #include "uscxml/debug/Benchmark.h" #include <chrono> @@ -8,6 +9,19 @@ using namespace uscxml; using namespace std::chrono; +class InterpreterCallbacks { +public: + InterpreterCallbacks() {} + void beforeEnterState(const std::string& stateName, std::function<void (const std::string& sessionId)> function) { + _beforeEnterStates.push_back(function); + } + + void operator() { + } + + std::list<std::function<void (const std::string& sessionId)> > _beforeEnterStates; +}; + int main(int argc, char** argv) { if (argc < 2) { std::cout << "Expected filename as first parameter" << std::endl; @@ -16,6 +30,17 @@ int main(int argc, char** argv) { Interpreter interpreter = Interpreter::fromURL(argv[1]); + ActionLanguage al; + al.microStepper = Factory::getInstance()->createMicroStepper("large", (MicroStepCallbacks*)interpreter); + interpreter.setActionLanguage(al); + + InterpreterCallbacks callbacks; + callbacks.beforeEnterState("mark", [](const std::string& sessionId) { + std::cout << "foo"; + }); + + + InterpreterState state; system_clock::time_point start = system_clock::now(); |