示例#1
0
int main (int argc, char **argv)
{
	std::string input;
	std::string file = "./10021.response";
	char buf[1024];

	if (argc > 1)
		file = argv[1];

	FSM fsm;
	fsm.init(file);

	// XXX: integrating into deceptiond framework
	// timeouts can be set via the InputStream obj
	// '>>' tokenizes using \s ;( this should be different using
	// the InputStream
	while(1) {
		std::cin.getline(buf, 1023, '\n');
		if (buf[0] == 0)
			break;
		input = buf;
		fsm.parse(input);
	}

	return 0;
}
示例#2
0
FSM * FSM::create(std::string state, std::function<void()> onEnter)
{
	FSM* fsm = new FSM(state, onEnter);
	if ( fsm && fsm->init())
	{
		fsm->autorelease();
		return fsm;
	}
	else
	{
		CC_SAFE_DELETE(fsm);
		return nullptr;
	}
}