summaryrefslogtreecommitdiffstats
path: root/src/uscxml/debug
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-04-11 07:58:48 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-04-11 07:58:48 (GMT)
commit71c334bf4e35559496feac3f3cf00b72ceb88812 (patch)
tree859f78af51c8e929559a53d70492035ef3fad862 /src/uscxml/debug
parent5180e4666a314db36a15d953fdfa38af4f285758 (diff)
downloaduscxml-71c334bf4e35559496feac3f3cf00b72ceb88812.zip
uscxml-71c334bf4e35559496feac3f3cf00b72ceb88812.tar.gz
uscxml-71c334bf4e35559496feac3f3cf00b72ceb88812.tar.bz2
More work on promela DM
changed const of Data subscript operator and introduced at(key) and item(index)
Diffstat (limited to 'src/uscxml/debug')
-rw-r--r--src/uscxml/debug/Breakpoint.cpp46
-rw-r--r--src/uscxml/debug/DebugSession.cpp10
-rw-r--r--src/uscxml/debug/DebuggerServlet.cpp66
3 files changed, 61 insertions, 61 deletions
diff --git a/src/uscxml/debug/Breakpoint.cpp b/src/uscxml/debug/Breakpoint.cpp
index df5dd61..0001127 100644
--- a/src/uscxml/debug/Breakpoint.cpp
+++ b/src/uscxml/debug/Breakpoint.cpp
@@ -31,73 +31,73 @@ Breakpoint::Breakpoint(const Data& data) {
if (data.hasKey("when")) {
if (false) {
- } else if (data["when"].atom == "before") {
+ } else if (data.at("when").atom == "before") {
when = BEFORE;
- } else if (data["when"].atom == "after") {
+ } else if (data.at("when").atom == "after") {
when = AFTER;
- } else if (data["when"].atom == "on") {
+ } else if (data.at("when").atom == "on") {
when = ON;
}
}
if (data.hasKey("action")) {
if (false) {
- } else if (data["action"].atom == "enter") {
+ } else if (data.at("action").atom == "enter") {
action = ENTER;
- } else if (data["action"].atom == "exit") {
+ } else if (data.at("action").atom == "exit") {
action = EXIT;
- } else if (data["action"].atom == "invoke") {
+ } else if (data.at("action").atom == "invoke") {
action = INVOKE;
- } else if (data["action"].atom == "cancel") {
+ } else if (data.at("action").atom == "cancel") {
action = UNINVOKE;
}
}
if (data.hasKey("subject")) {
if (false) {
- } else if (data["subject"].atom == "state") {
+ } else if (data.at("subject").atom == "state") {
subject = STATE;
- } else if (data["subject"].atom == "transition") {
+ } else if (data.at("subject").atom == "transition") {
subject = TRANSITION;
- } else if (data["subject"].atom == "stable") {
+ } else if (data.at("subject").atom == "stable") {
subject = STABLE;
- } else if (data["subject"].atom == "microstep") {
+ } else if (data.at("subject").atom == "microstep") {
subject = MICROSTEP;
- } else if (data["subject"].atom == "event") {
+ } else if (data.at("subject").atom == "event") {
subject = EVENT;
- } else if (data["subject"].atom == "invoker") {
+ } else if (data.at("subject").atom == "invoker") {
subject = INVOKER;
- } else if (data["subject"].atom == "executable") {
+ } else if (data.at("subject").atom == "executable") {
subject = EXECUTABLE;
}
}
if (data.hasKey("condition"))
- condition = data["condition"].atom;
+ condition = data.at("condition").atom;
if (data.hasKey("invokeId"))
- invokeId = data["invokeId"].atom;
+ invokeId = data.at("invokeId").atom;
if (data.hasKey("invokeType"))
- invokeType = data["invokeType"].atom;
+ invokeType = data.at("invokeType").atom;
if (data.hasKey("eventName"))
- eventName = data["eventName"].atom;
+ eventName = data.at("eventName").atom;
if (data.hasKey("executableName"))
- executableName = data["executableName"].atom;
+ executableName = data.at("executableName").atom;
if (data.hasKey("executableXPath"))
- executableXPath = data["executableXPath"].atom;
+ executableXPath = data.at("executableXPath").atom;
if (data.hasKey("stateId"))
- stateId = data["stateId"].atom;
+ stateId = data.at("stateId").atom;
if (data.hasKey("transSourceId"))
- transSourceId = data["transSourceId"].atom;
+ transSourceId = data.at("transSourceId").atom;
if (data.hasKey("transTargetId"))
- transTargetId = data["transTargetId"].atom;
+ transTargetId = data.at("transTargetId").atom;
}
diff --git a/src/uscxml/debug/DebugSession.cpp b/src/uscxml/debug/DebugSession.cpp
index 46b414f..e785c84 100644
--- a/src/uscxml/debug/DebugSession.cpp
+++ b/src/uscxml/debug/DebugSession.cpp
@@ -106,9 +106,9 @@ Data DebugSession::debugPrepare(const Data& data) {
_isAttached = false;
if (data.hasKey("xml")) {
- _interpreter = Interpreter::fromXML(data["xml"].atom);
+ _interpreter = Interpreter::fromXML(data.at("xml").atom);
} else if (data.hasKey("url")) {
- _interpreter = Interpreter::fromURI(data["url"].atom);
+ _interpreter = Interpreter::fromURI(data.at("url").atom);
} else {
_interpreter = Interpreter();
}
@@ -119,7 +119,7 @@ Data DebugSession::debugPrepare(const Data& data) {
_debugger->attachSession(_interpreter, shared_from_this());
if (data.hasKey("url")) {
// this allows to resolve relative external reources
- _interpreter.setSourceURI(data["url"].atom);
+ _interpreter.setSourceURI(data.at("url").atom);
}
replyData.compound["status"] = Data("success", Data::VERBATIM);
} else {
@@ -139,7 +139,7 @@ Data DebugSession::debugAttach(const Data& data) {
return replyData;
}
- std::string interpreterId = data["attach"].atom;
+ std::string interpreterId = data.at("attach").atom;
bool interpreterFound = false;
// find interpreter for sessionid
@@ -354,7 +354,7 @@ Data DebugSession::debugEval(const Data& data) {
return replyData;
}
- std::string expr = data["expression"].atom;
+ std::string expr = data.at("expression").atom;
if (!_interpreter) {
replyData.compound["status"] = Data("failure", Data::VERBATIM);
diff --git a/src/uscxml/debug/DebuggerServlet.cpp b/src/uscxml/debug/DebuggerServlet.cpp
index 12783b4..a570263 100644
--- a/src/uscxml/debug/DebuggerServlet.cpp
+++ b/src/uscxml/debug/DebuggerServlet.cpp
@@ -65,22 +65,22 @@ void DebuggerServlet::returnData(const HTTPServer::Request& request, Data replyD
}
bool DebuggerServlet::isCORS(const HTTPServer::Request& request) {
- return (request.data["type"].atom == "options" &&
- request.data["header"].hasKey("Origin") &&
- request.data["header"].hasKey("Access-Control-Request-Method"));
+ return (request.data.at("type").atom == "options" &&
+ request.data.at("header").hasKey("Origin") &&
+ request.data.at("header").hasKey("Access-Control-Request-Method"));
}
void DebuggerServlet::handleCORS(const HTTPServer::Request& request) {
HTTPServer::Reply corsReply(request);
- if (request.data["header"].hasKey("Origin")) {
- corsReply.headers["Access-Control-Allow-Origin"] = request.data["header"]["Origin"].atom;
+ if (request.data.at("header").hasKey("Origin")) {
+ corsReply.headers["Access-Control-Allow-Origin"] = request.data.at("header").at("Origin").atom;
} else {
corsReply.headers["Access-Control-Allow-Origin"] = "*";
}
- if (request.data["header"].hasKey("Access-Control-Request-Method"))
- corsReply.headers["Access-Control-Allow-Methods"] = request.data["header"]["Access-Control-Request-Method"].atom;
- if (request.data["header"].hasKey("Access-Control-Request-Headers"))
- corsReply.headers["Access-Control-Allow-Headers"] = request.data["header"]["Access-Control-Request-Headers"].atom;
+ if (request.data.at("header").hasKey("Access-Control-Request-Method"))
+ corsReply.headers["Access-Control-Allow-Methods"] = request.data.at("header").at("Access-Control-Request-Method").atom;
+ if (request.data.at("header").hasKey("Access-Control-Request-Headers"))
+ corsReply.headers["Access-Control-Allow-Headers"] = request.data.at("header").at("Access-Control-Request-Headers").atom;
// std::cout << "CORS!" << std::endl << request << std::endl;
HTTPServer::reply(corsReply);
@@ -100,20 +100,20 @@ bool DebuggerServlet::httpRecvRequest(const HTTPServer::Request& request) {
Data replyData;
// process request that don't need a session
if (false) {
- } else if (boost::starts_with(request.data["path"].atom, "/debug/connect")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/connect")) {
processConnect(request);
return true;
- } else if (boost::starts_with(request.data["path"].atom, "/debug/sessions")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/sessions")) {
processListSessions(request);
return true;
}
// get session or return error
if (false) {
- } else if (!request.data["content"].hasKey("session")) {
+ } else if (!request.data.at("content").hasKey("session")) {
replyData.compound["status"] = Data("failure", Data::VERBATIM);
replyData.compound["reason"] = Data("No session given", Data::VERBATIM);
- } else if (_sessionForId.find(request.data["content"]["session"].atom) == _sessionForId.end()) {
+ } else if (_sessionForId.find(request.data.at("content").at("session").atom) == _sessionForId.end()) {
replyData.compound["status"] = Data("failure", Data::VERBATIM);
replyData.compound["reason"] = Data("No such session", Data::VERBATIM);
}
@@ -122,46 +122,46 @@ bool DebuggerServlet::httpRecvRequest(const HTTPServer::Request& request) {
return true;
}
- boost::shared_ptr<DebugSession> session = _sessionForId[request.data["content"]["session"].atom];
+ boost::shared_ptr<DebugSession> session = _sessionForId[request.data.at("content").at("session").atom];
if (false) {
- } else if (boost::starts_with(request.data["path"].atom, "/debug/poll")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/poll")) {
// save long-standing client poll
_clientConns[session] = request;
serverPushData(session);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/disconnect")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/disconnect")) {
processDisconnect(request);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/breakpoint/enable/all")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/enable/all")) {
replyData = session->enableAllBreakPoints();
- } else if (boost::starts_with(request.data["path"].atom, "/debug/breakpoint/disable/all")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/disable/all")) {
replyData = session->disableAllBreakPoints();
- } else if (boost::starts_with(request.data["path"].atom, "/debug/breakpoint/skipto")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/skipto")) {
replyData = session->skipToBreakPoint(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/breakpoint/add")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/add")) {
replyData = session->addBreakPoint(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/breakpoint/remove")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/remove")) {
replyData = session->removeBreakPoint(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/breakpoint/enable")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/enable")) {
replyData = session->enableBreakPoint(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/breakpoint/disable")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/breakpoint/disable")) {
replyData = session->disableBreakPoint(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/stop")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/stop")) {
replyData = session->debugStop(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/prepare")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/prepare")) {
replyData = session->debugPrepare(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/attach")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/attach")) {
replyData = session->debugAttach(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/start")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/start")) {
replyData = session->debugStart(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/step")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/step")) {
replyData = session->debugStep(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/pause")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/pause")) {
replyData = session->debugPause(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/resume")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/resume")) {
replyData = session->debugResume(request.data["content"]);
- } else if (boost::starts_with(request.data["path"].atom, "/debug/eval")) {
+ } else if (boost::starts_with(request.data.at("path").atom, "/debug/eval")) {
replyData = session->debugEval(request.data["content"]);
}
@@ -192,13 +192,13 @@ void DebuggerServlet::processDisconnect(const HTTPServer::Request& request) {
Data replyData;
- if (!request.data["content"].hasKey("session")) {
+ if (!request.data.at("content").hasKey("session")) {
replyData.compound["status"] = Data("failure", Data::VERBATIM);
replyData.compound["reason"] = Data("No session given", Data::VERBATIM);
returnData(request, replyData);
}
- std::string sessionId = request.data["content"]["session"].atom;
+ std::string sessionId = request.data.at("content").at("session").atom;
if (_sessionForId.find(sessionId) == _sessionForId.end()) {
replyData.compound["status"] = Data("failure", Data::VERBATIM);