summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/invoker/umundo
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-01-12 23:49:43 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-01-12 23:49:43 (GMT)
commita116aeb2cf5a84fa03f9814c3884561149029267 (patch)
treebdd7dfc15ec1e38edcc9a7532ffad03fe4f6f823 /src/uscxml/plugins/invoker/umundo
parent6d0622c0bb8f0e52589c82252f2cc1eb847ad9bf (diff)
downloaduscxml-a116aeb2cf5a84fa03f9814c3884561149029267.zip
uscxml-a116aeb2cf5a84fa03f9814c3884561149029267.tar.gz
uscxml-a116aeb2cf5a84fa03f9814c3884561149029267.tar.bz2
Refactored to PIMPL pattern
Diffstat (limited to 'src/uscxml/plugins/invoker/umundo')
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp22
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.h10
2 files changed, 16 insertions, 16 deletions
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
index 9957bfa..3ddc14a 100644
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
+++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
@@ -28,7 +28,7 @@ UmundoInvoker::~UmundoInvoker() {
}
};
-Invoker* UmundoInvoker::create(Interpreter* interpreter) {
+InvokerImpl* UmundoInvoker::create(Interpreter* interpreter) {
UmundoInvoker* invoker = new UmundoInvoker();
invoker->_interpreter = interpreter;
return invoker;
@@ -39,7 +39,7 @@ Data UmundoInvoker::getDataModelVariables() {
return data;
}
-void UmundoInvoker::send(SendRequest& req) {
+void UmundoInvoker::send(const SendRequest& req) {
umundo::Message* msg = new umundo::Message();
if (req.name.length() > 0) {
@@ -50,9 +50,9 @@ void UmundoInvoker::send(SendRequest& req) {
if (req.params.find("type") != req.params.end()) {
// assume JSON in content to transform to protobuf object
- if (req.content.length() > 0 && _interpreter->getDataModel() != NULL) {
+ if (req.content.length() > 0 && _interpreter->getDataModel()) {
std::string type;
- std::multimap<std::string, std::string>::iterator typeIter = req.params.find("type");
+ std::multimap<std::string, std::string>::const_iterator typeIter = req.params.find("type");
if (typeIter != req.params.end())
type = typeIter->second;
const google::protobuf::Message* protoMsg = umundo::PBSerializer::getProto(type);
@@ -61,7 +61,7 @@ void UmundoInvoker::send(SendRequest& req) {
return;
}
try {
- Data data = _interpreter->getDataModel()->getStringAsData(req.content);
+ Data data = _interpreter->getDataModel().getStringAsData(req.content);
google::protobuf::Message* pbMsg = protoMsg->New();
if (!dataToProtobuf(pbMsg, data)) {
LOG(ERROR) << "Cannot create message from JSON - not sending";
@@ -105,11 +105,11 @@ void UmundoInvoker::cancel(const std::string sendId) {
assert(false);
}
-void UmundoInvoker::sendToParent(SendRequest& req) {
+void UmundoInvoker::sendToParent(const SendRequest& req) {
assert(false);
}
-void UmundoInvoker::invoke(InvokeRequest& req) {
+void UmundoInvoker::invoke(const InvokeRequest& req) {
_invokeId = req.invokeid;
std::string domain;
@@ -133,8 +133,8 @@ void UmundoInvoker::invoke(InvokeRequest& req) {
// add type from .proto or .desc files
if (req.params.find("type") != req.params.end()) {
- std::pair<InvokeRequest::params_t::iterator, InvokeRequest::params_t::iterator> typeRange = req.params.equal_range("types");
- for (InvokeRequest::params_t::iterator it = typeRange.first; it != typeRange.second; it++) {
+ std::pair<InvokeRequest::params_t::const_iterator, InvokeRequest::params_t::const_iterator> typeRange = req.params.equal_range("types");
+ for (InvokeRequest::params_t::const_iterator it = typeRange.first; it != typeRange.second; it++) {
URL typeURI(it->second);
if (typeURI.toAbsolute(_interpreter->getBaseURI())) {
std::string filename = typeURI.asLocalFile(".proto");
@@ -147,8 +147,8 @@ void UmundoInvoker::invoke(InvokeRequest& req) {
// add directory with .proto or .desc files
if (req.params.find("types") != req.params.end()) {
- std::pair<InvokeRequest::params_t::iterator, InvokeRequest::params_t::iterator> typeRange = req.params.equal_range("types");
- for (InvokeRequest::params_t::iterator it = typeRange.first; it != typeRange.second; it++) {
+ std::pair<InvokeRequest::params_t::const_iterator, InvokeRequest::params_t::const_iterator> typeRange = req.params.equal_range("types");
+ for (InvokeRequest::params_t::const_iterator it = typeRange.first; it != typeRange.second; it++) {
URL typeURI(it->second);
if (typeURI.toAbsolute(_interpreter->getBaseURI()) && typeURI.scheme().compare("file") == 0) {
umundo::PBSerializer::addProto(typeURI.path());
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
index 09d07bf..1aa37f2 100644
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
+++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
@@ -16,11 +16,11 @@ namespace uscxml {
class Interpreter;
-class UmundoInvoker : public Invoker, public umundo::TypedReceiver, public umundo::ResultSet<umundo::ServiceDescription> {
+class UmundoInvoker : public InvokerImpl, public umundo::TypedReceiver, public umundo::ResultSet<umundo::ServiceDescription> {
public:
UmundoInvoker();
virtual ~UmundoInvoker();
- virtual Invoker* create(Interpreter* interpreter);
+ virtual InvokerImpl* create(Interpreter* interpreter);
virtual std::set<std::string> getNames() {
std::set<std::string> names;
@@ -31,10 +31,10 @@ public:
}
virtual Data getDataModelVariables();
- virtual void send(SendRequest& req);
+ virtual void send(const SendRequest& req);
virtual void cancel(const std::string sendId);
- virtual void invoke(InvokeRequest& req);
- virtual void sendToParent(SendRequest& req);
+ virtual void invoke(const InvokeRequest& req);
+ virtual void sendToParent(const SendRequest& req);
virtual void receive(void* object, umundo::Message* msg);