summaryrefslogtreecommitdiffstats
path: root/test/src/test-snippets.cpp
blob: 4b0fafed8cb8186d3c8da9089227679d4e1e49f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
 * This file contains all the snippets in the doxygen documentation.
 *
 * It is not actually a test as such, but makes sure that the snippets will
 * actually compile and do what we claim they do.
 */

#include "uscxml/config.h"
#include "uscxml/Interpreter.h"
#include "uscxml/interpreter/LoggingImpl.h"

using namespace uscxml;

void microstep_snippet() {

	Interpreter scxml = Interpreter::fromURL("https://raw.githubusercontent.com/tklab-tud/uscxml/master/test/w3c/null/test436.scxml");

//! [Performing a microstep]
	InterpreterState state = uscxml::USCXML_UNDEF;
	while((state = scxml.step()) != uscxml::USCXML_FINISHED) {
		switch (state) {
		case USCXML_MICROSTEPPED:
		case USCXML_MACROSTEPPED:
			/* Interpreter performed a microstep */
			break;
		default:
			break;
		}
	}
//! [Performing a microstep]

}

int main(int argc, char** argv) {
    Logger::getDefault().log(USCXML_FATAL) << "Foo!" << " BAR?";
	microstep_snippet();
}