#include <StateMachine.h>
|
virtual void | configureAction (toolbox::Event::Reference e)=0 throw (toolbox::fsm::exception::Exception) |
| transition methods to be implemented by the application More...
|
|
virtual void | enableAction (toolbox::Event::Reference e)=0 throw (toolbox::fsm::exception::Exception) |
|
xoap::MessageReference | fireEvent (xoap::MessageReference msg) throw (xoap::exception::Exception) |
|
virtual void | haltAction (toolbox::Event::Reference e)=0 throw (toolbox::fsm::exception::Exception) |
|
virtual void | nullAction (toolbox::Event::Reference e)=0 throw (toolbox::fsm::exception::Exception) |
|
virtual void | resumeAction (toolbox::Event::Reference e)=0 throw (toolbox::fsm::exception::Exception) |
|
| StateMachine (xdaq::ApplicationStub *s) |
|
virtual void | stopAction (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception) |
|
virtual void | suspendAction (toolbox::Event::Reference e)=0 throw (toolbox::fsm::exception::Exception) |
|
virtual | ~StateMachine () |
|
Definition at line 18 of file StateMachine.h.
StateMachine::StateMachine |
( |
xdaq::ApplicationStub * |
s | ) |
|
Definition at line 15 of file StateMachine.cc.
References dispatch(), failurePage(), fsm_, evf::EPStateMachine::init(), statePage(), webConfigure(), webEnable(), webHalt(), webResume(), webSuspend(), and wsm_.
17 fsm_(getApplicationLogger())
25 wsm_.addStateTransition(
'H',
'R',
"Configure",
this,
27 wsm_.addStateTransition(
'R',
'E',
"Enable",
this,
29 wsm_.addStateTransition(
'E',
'S',
"Suspend",
this,
31 wsm_.addStateTransition(
'S',
'E',
"Resume",
this,
33 wsm_.addStateTransition(
'H',
'H',
"Halt",
this,
35 wsm_.addStateTransition(
'R',
'H',
"Halt",
this,
37 wsm_.addStateTransition(
'E',
'H',
"Halt",
this,
39 wsm_.addStateTransition(
'S',
'H',
"Halt",
this,
42 wsm_.setInitialState(
'H');
void failurePage(xgi::Output *out, xgi::exception::Exception &e)
void webResume(xgi::Input *in)
void statePage(xgi::Output *out)
void webSuspend(xgi::Input *in)
void webEnable(xgi::Input *in)
void webHalt(xgi::Input *in)
void dispatch(xgi::Input *in, xgi::Output *out)
void webConfigure(xgi::Input *in)
virtual dqm::StateMachine::~StateMachine |
( |
| ) |
|
|
inlinevirtual |
void StateMachine::bind |
( |
std::string |
page | ) |
|
|
protected |
virtual void dqm::StateMachine::configureAction |
( |
toolbox::Event::Reference |
e | ) |
|
throw | ( | toolbox::fsm::exception::Exception |
| ) | | |
|
pure virtual |
transition methods to be implemented by the application
void dqm::StateMachine::Default |
( |
xgi::Input * |
in, |
|
|
xgi::Output * |
out |
|
) |
| |
throw | ( | xgi::exception::Exception |
| ) | | |
|
inlineprotected |
void dqm::StateMachine::dispatch |
( |
xgi::Input * |
in, |
|
|
xgi::Output * |
out |
|
) |
| |
throw | ( | xgi::exception::Exception |
| ) | | |
|
inlineprotected |
virtual void dqm::StateMachine::enableAction |
( |
toolbox::Event::Reference |
e | ) |
|
throw | ( | toolbox::fsm::exception::Exception |
| ) | | |
|
pure virtual |
void StateMachine::failurePage |
( |
xgi::Output * |
out, |
|
|
xgi::exception::Exception & |
e |
|
) |
| |
throw | ( | xgi::exception::Exception |
| ) | | |
|
private |
xoap::MessageReference StateMachine::fireEvent |
( |
xoap::MessageReference |
msg | ) |
|
throw | ( | xoap::exception::Exception |
| ) | | |
Definition at line 54 of file StateMachine.cc.
References edmPickEvents::command, edm::hlt::Exception, i, runTheMatrix::msg, and python.Node::node.
57 xoap::SOAPPart
part =
msg->getSOAPPart();
58 xoap::SOAPEnvelope env = part.getEnvelope();
59 xoap::SOAPBody body = env.getBody();
60 DOMNode *
node = body.getDOMNode();
61 DOMNodeList *bodyList = node->getChildNodes();
63 std::string commandName;
65 for (
unsigned int i = 0;
i < bodyList->getLength();
i++)
67 command = bodyList->item(
i);
69 if(command->getNodeType() == DOMNode::ELEMENT_NODE)
71 commandName = xoap::XMLCh2String(command->getLocalName());
72 wsm_.fireEvent(commandName,0,0);
xoap::MessageReference processFSMCommand(const std::string cmdName)
virtual void dqm::StateMachine::haltAction |
( |
toolbox::Event::Reference |
e | ) |
|
throw | ( | toolbox::fsm::exception::Exception |
| ) | | |
|
pure virtual |
virtual void dqm::StateMachine::nullAction |
( |
toolbox::Event::Reference |
e | ) |
|
throw | ( | toolbox::fsm::exception::Exception |
| ) | | |
|
pure virtual |
virtual void dqm::StateMachine::resumeAction |
( |
toolbox::Event::Reference |
e | ) |
|
throw | ( | toolbox::fsm::exception::Exception |
| ) | | |
|
pure virtual |
xdata::String* dqm::StateMachine::stateName |
( |
| ) |
|
|
inlineprotected |
void StateMachine::statePage |
( |
xgi::Output * |
out | ) |
|
throw | ( | xgi::exception::Exception |
| ) | | |
|
private |
Definition at line 83 of file StateMachine.cc.
References cmsCodeRulesChecker::html, i, collect_tpl::input, and dbtoconf::out.
Referenced by StateMachine().
88 std::string url =
"/";
89 url += getApplicationDescriptor()->getURN();
90 std::string purl = url +
"/" +
page_;
92 *
out << cgicc::HTMLDoctype(cgicc::HTMLDoctype::eStrict) << std::endl;
93 *
out <<
cgicc::html().set(
"lang",
"en").set(
"dir",
"ltr") << std::endl;
94 *
out <<
"<head>" << std::endl;
95 *
out <<
"<META HTTP-EQUIV=refresh CONTENT=\"30; URL=";
96 *
out << purl <<
"\">" << std::endl;
97 *
out <<
"<META HTTP-EQUIV=Window-target CONTENT=\"_self\">" << std::endl;
98 *
out <<
"<title> " <<
"fsm" <<
"</title>" << std::endl;
99 *
out <<
"</head>" << std::endl;
100 *
out <<
"<body>" << std::endl;
108 std::set<std::string>::iterator
i;
109 std::set<std::string> possibleInputs =
wsm_.getInputs(
wsm_.getCurrentState());
110 std::set<std::string> allInputs =
wsm_.getInputs();
115 *
out << cgicc::h3(
"Finite State Machine").set(
"style",
"font-family: arial") << std::endl;
116 *
out <<
"<table border cellpadding=10 cellspacing=0>" << std::endl;
117 *
out <<
"<tr>" << std::endl;
118 *
out <<
"<th>" <<
wsm_.getStateName(
wsm_.getCurrentState()) <<
"</th>" << std::endl;
119 *
out <<
"</tr>" << std::endl;
120 *
out <<
"<tr>" << std::endl;
122 for ( i = allInputs.begin(); i != allInputs.end(); i++)
125 *
out << cgicc::form().set(
"method",
"post").set(
"target",
"_self").set(
"action", url).set(
"enctype",
"multipart/form-data") << std::endl;
127 if ( possibleInputs.find(*i) != possibleInputs.end() )
129 *
out <<
cgicc::input().set(
"type",
"submit").set(
"name",
"StateInput").set(
"value", (*i) );
133 *
out <<
cgicc::input() .set(
"type",
"submit").set(
"name",
"StateInput").set(
"value", (*i) ).set(
"disabled",
"true");
136 *
out << cgicc::form();
137 *
out <<
"</td>" << std::endl;
140 *
out <<
"</tr>" << std::endl;
141 *
out <<
"</table>" << std::endl;
virtual void dqm::StateMachine::stopAction |
( |
toolbox::Event::Reference |
e | ) |
|
throw | ( | toolbox::fsm::exception::Exception |
| ) | | |
|
inlinevirtual |
virtual void dqm::StateMachine::suspendAction |
( |
toolbox::Event::Reference |
e | ) |
|
throw | ( | toolbox::fsm::exception::Exception |
| ) | | |
|
pure virtual |
void dqm::StateMachine::webConfigure |
( |
xgi::Input * |
in | ) |
|
throw | ( | xgi::exception::Exception |
| ) | | |
|
inlineprivate |
void dqm::StateMachine::webEnable |
( |
xgi::Input * |
in | ) |
|
throw | ( | xgi::exception::Exception |
| ) | | |
|
inlineprivate |
void dqm::StateMachine::webHalt |
( |
xgi::Input * |
in | ) |
|
throw | ( | xgi::exception::Exception |
| ) | | |
|
inlineprivate |
void dqm::StateMachine::webResume |
( |
xgi::Input * |
in | ) |
|
throw | ( | xgi::exception::Exception |
| ) | | |
|
inlineprivate |
void dqm::StateMachine::webSuspend |
( |
xgi::Input * |
in | ) |
|
throw | ( | xgi::exception::Exception |
| ) | | |
|
inlineprivate |
std::string dqm::StateMachine::page_ |
|
private |
xgi::WSM dqm::StateMachine::wsm_ |
|
private |