summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/invoker/umundo
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/plugins/invoker/umundo')
-rw-r--r--src/uscxml/plugins/invoker/umundo/JSON.pb.cc462
-rw-r--r--src/uscxml/plugins/invoker/umundo/JSON.pb.h361
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp655
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.h94
4 files changed, 0 insertions, 1572 deletions
diff --git a/src/uscxml/plugins/invoker/umundo/JSON.pb.cc b/src/uscxml/plugins/invoker/umundo/JSON.pb.cc
deleted file mode 100644
index 9e245c1..0000000
--- a/src/uscxml/plugins/invoker/umundo/JSON.pb.cc
+++ /dev/null
@@ -1,462 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: JSON.proto
-
-#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
-#include "JSON.pb.h"
-
-#include <algorithm>
-
-#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/once.h>
-#include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/wire_format_lite_inl.h>
-#include <google/protobuf/descriptor.h>
-#include <google/protobuf/generated_message_reflection.h>
-#include <google/protobuf/reflection_ops.h>
-#include <google/protobuf/wire_format.h>
-// @@protoc_insertion_point(includes)
-
-namespace {
-
-const ::google::protobuf::Descriptor* JSONProto_descriptor_ = NULL;
-const ::google::protobuf::internal::GeneratedMessageReflection*
- JSONProto_reflection_ = NULL;
-
-} // namespace
-
-
-void protobuf_AssignDesc_JSON_2eproto() {
- protobuf_AddDesc_JSON_2eproto();
- const ::google::protobuf::FileDescriptor* file =
- ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
- "JSON.proto");
- GOOGLE_CHECK(file != NULL);
- JSONProto_descriptor_ = file->message_type(0);
- static const int JSONProto_offsets_[4] = {
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, compound_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, key_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, atom_),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, verbatim_),
- };
- JSONProto_reflection_ =
- new ::google::protobuf::internal::GeneratedMessageReflection(
- JSONProto_descriptor_,
- JSONProto::default_instance_,
- JSONProto_offsets_,
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, _has_bits_[0]),
- GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(JSONProto, _unknown_fields_),
- -1,
- ::google::protobuf::DescriptorPool::generated_pool(),
- ::google::protobuf::MessageFactory::generated_factory(),
- sizeof(JSONProto));
-}
-
-namespace {
-
-GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
-inline void protobuf_AssignDescriptorsOnce() {
- ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
- &protobuf_AssignDesc_JSON_2eproto);
-}
-
-void protobuf_RegisterTypes(const ::std::string&) {
- protobuf_AssignDescriptorsOnce();
- ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
- JSONProto_descriptor_, &JSONProto::default_instance());
-}
-
-} // namespace
-
-void protobuf_ShutdownFile_JSON_2eproto() {
- delete JSONProto::default_instance_;
- delete JSONProto_reflection_;
-}
-
-void protobuf_AddDesc_JSON_2eproto() {
- static bool already_here = false;
- if (already_here) return;
- already_here = true;
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
- "\n\nJSON.proto\"V\n\tJSONProto\022\034\n\010compound\030\001 "
- "\003(\0132\n.JSONProto\022\013\n\003key\030\002 \001(\t\022\014\n\004atom\030\003 \001"
- "(\t\022\020\n\010verbatim\030\004 \001(\010", 100);
- ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
- "JSON.proto", &protobuf_RegisterTypes);
- JSONProto::default_instance_ = new JSONProto();
- JSONProto::default_instance_->InitAsDefaultInstance();
- ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_JSON_2eproto);
-}
-
-// Force AddDescriptors() to be called at static initialization time.
-struct StaticDescriptorInitializer_JSON_2eproto {
- StaticDescriptorInitializer_JSON_2eproto() {
- protobuf_AddDesc_JSON_2eproto();
- }
-} static_descriptor_initializer_JSON_2eproto_;
-
-// ===================================================================
-
-#ifndef _MSC_VER
-const int JSONProto::kCompoundFieldNumber;
-const int JSONProto::kKeyFieldNumber;
-const int JSONProto::kAtomFieldNumber;
-const int JSONProto::kVerbatimFieldNumber;
-#endif // !_MSC_VER
-
-JSONProto::JSONProto()
- : ::google::protobuf::Message() {
- SharedCtor();
-}
-
-void JSONProto::InitAsDefaultInstance() {
-}
-
-JSONProto::JSONProto(const JSONProto& from)
- : ::google::protobuf::Message() {
- SharedCtor();
- MergeFrom(from);
-}
-
-void JSONProto::SharedCtor() {
- _cached_size_ = 0;
- key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- atom_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- verbatim_ = false;
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-JSONProto::~JSONProto() {
- SharedDtor();
-}
-
-void JSONProto::SharedDtor() {
- if (key_ != &::google::protobuf::internal::kEmptyString) {
- delete key_;
- }
- if (atom_ != &::google::protobuf::internal::kEmptyString) {
- delete atom_;
- }
- if (this != default_instance_) {
- }
-}
-
-void JSONProto::SetCachedSize(int size) const {
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const ::google::protobuf::Descriptor* JSONProto::descriptor() {
- protobuf_AssignDescriptorsOnce();
- return JSONProto_descriptor_;
-}
-
-const JSONProto& JSONProto::default_instance() {
- if (default_instance_ == NULL) protobuf_AddDesc_JSON_2eproto();
- return *default_instance_;
-}
-
-JSONProto* JSONProto::default_instance_ = NULL;
-
-JSONProto* JSONProto::New() const {
- return new JSONProto;
-}
-
-void JSONProto::Clear() {
- if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) {
- if (has_key()) {
- if (key_ != &::google::protobuf::internal::kEmptyString) {
- key_->clear();
- }
- }
- if (has_atom()) {
- if (atom_ != &::google::protobuf::internal::kEmptyString) {
- atom_->clear();
- }
- }
- verbatim_ = false;
- }
- compound_.Clear();
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
- mutable_unknown_fields()->Clear();
-}
-
-bool JSONProto::MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
- ::google::protobuf::uint32 tag;
- while ((tag = input->ReadTag()) != 0) {
- switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
- // repeated .JSONProto compound = 1;
- case 1: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_compound:
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
- input, add_compound()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(10)) goto parse_compound;
- if (input->ExpectTag(18)) goto parse_key;
- break;
- }
-
- // optional string key = 2;
- case 2: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_key:
- DO_(::google::protobuf::internal::WireFormatLite::ReadString(
- input, this->mutable_key()));
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->key().data(), this->key().length(),
- ::google::protobuf::internal::WireFormat::PARSE);
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(26)) goto parse_atom;
- break;
- }
-
- // optional string atom = 3;
- case 3: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_atom:
- DO_(::google::protobuf::internal::WireFormatLite::ReadString(
- input, this->mutable_atom()));
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->atom().data(), this->atom().length(),
- ::google::protobuf::internal::WireFormat::PARSE);
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(32)) goto parse_verbatim;
- break;
- }
-
- // optional bool verbatim = 4;
- case 4: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_verbatim:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
- input, &verbatim_)));
- set_has_verbatim();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectAtEnd()) return true;
- break;
- }
-
- default: {
- handle_uninterpreted:
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
- return true;
- }
- DO_(::google::protobuf::internal::WireFormat::SkipField(
- input, tag, mutable_unknown_fields()));
- break;
- }
- }
- }
- return true;
-#undef DO_
-}
-
-void JSONProto::SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const {
- // repeated .JSONProto compound = 1;
- for (int i = 0; i < this->compound_size(); i++) {
- ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 1, this->compound(i), output);
- }
-
- // optional string key = 2;
- if (has_key()) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->key().data(), this->key().length(),
- ::google::protobuf::internal::WireFormat::SERIALIZE);
- ::google::protobuf::internal::WireFormatLite::WriteString(
- 2, this->key(), output);
- }
-
- // optional string atom = 3;
- if (has_atom()) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->atom().data(), this->atom().length(),
- ::google::protobuf::internal::WireFormat::SERIALIZE);
- ::google::protobuf::internal::WireFormatLite::WriteString(
- 3, this->atom(), output);
- }
-
- // optional bool verbatim = 4;
- if (has_verbatim()) {
- ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->verbatim(), output);
- }
-
- if (!unknown_fields().empty()) {
- ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
- unknown_fields(), output);
- }
-}
-
-::google::protobuf::uint8* JSONProto::SerializeWithCachedSizesToArray(
- ::google::protobuf::uint8* target) const {
- // repeated .JSONProto compound = 1;
- for (int i = 0; i < this->compound_size(); i++) {
- target = ::google::protobuf::internal::WireFormatLite::
- WriteMessageNoVirtualToArray(
- 1, this->compound(i), target);
- }
-
- // optional string key = 2;
- if (has_key()) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->key().data(), this->key().length(),
- ::google::protobuf::internal::WireFormat::SERIALIZE);
- target =
- ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
- 2, this->key(), target);
- }
-
- // optional string atom = 3;
- if (has_atom()) {
- ::google::protobuf::internal::WireFormat::VerifyUTF8String(
- this->atom().data(), this->atom().length(),
- ::google::protobuf::internal::WireFormat::SERIALIZE);
- target =
- ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
- 3, this->atom(), target);
- }
-
- // optional bool verbatim = 4;
- if (has_verbatim()) {
- target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->verbatim(), target);
- }
-
- if (!unknown_fields().empty()) {
- target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
- unknown_fields(), target);
- }
- return target;
-}
-
-int JSONProto::ByteSize() const {
- int total_size = 0;
-
- if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) {
- // optional string key = 2;
- if (has_key()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::StringSize(
- this->key());
- }
-
- // optional string atom = 3;
- if (has_atom()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::StringSize(
- this->atom());
- }
-
- // optional bool verbatim = 4;
- if (has_verbatim()) {
- total_size += 1 + 1;
- }
-
- }
- // repeated .JSONProto compound = 1;
- total_size += 1 * this->compound_size();
- for (int i = 0; i < this->compound_size(); i++) {
- total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- this->compound(i));
- }
-
- if (!unknown_fields().empty()) {
- total_size +=
- ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
- unknown_fields());
- }
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = total_size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
- return total_size;
-}
-
-void JSONProto::MergeFrom(const ::google::protobuf::Message& from) {
- GOOGLE_CHECK_NE(&from, this);
- const JSONProto* source =
- ::google::protobuf::internal::dynamic_cast_if_available<const JSONProto*>(
- &from);
- if (source == NULL) {
- ::google::protobuf::internal::ReflectionOps::Merge(from, this);
- } else {
- MergeFrom(*source);
- }
-}
-
-void JSONProto::MergeFrom(const JSONProto& from) {
- GOOGLE_CHECK_NE(&from, this);
- compound_.MergeFrom(from.compound_);
- if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) {
- if (from.has_key()) {
- set_key(from.key());
- }
- if (from.has_atom()) {
- set_atom(from.atom());
- }
- if (from.has_verbatim()) {
- set_verbatim(from.verbatim());
- }
- }
- mutable_unknown_fields()->MergeFrom(from.unknown_fields());
-}
-
-void JSONProto::CopyFrom(const ::google::protobuf::Message& from) {
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-void JSONProto::CopyFrom(const JSONProto& from) {
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-bool JSONProto::IsInitialized() const {
-
- return true;
-}
-
-void JSONProto::Swap(JSONProto* other) {
- if (other != this) {
- compound_.Swap(&other->compound_);
- std::swap(key_, other->key_);
- std::swap(atom_, other->atom_);
- std::swap(verbatim_, other->verbatim_);
- std::swap(_has_bits_[0], other->_has_bits_[0]);
- _unknown_fields_.Swap(&other->_unknown_fields_);
- std::swap(_cached_size_, other->_cached_size_);
- }
-}
-
-::google::protobuf::Metadata JSONProto::GetMetadata() const {
- protobuf_AssignDescriptorsOnce();
- ::google::protobuf::Metadata metadata;
- metadata.descriptor = JSONProto_descriptor_;
- metadata.reflection = JSONProto_reflection_;
- return metadata;
-}
-
-
-// @@protoc_insertion_point(namespace_scope)
-
-// @@protoc_insertion_point(global_scope)
diff --git a/src/uscxml/plugins/invoker/umundo/JSON.pb.h b/src/uscxml/plugins/invoker/umundo/JSON.pb.h
deleted file mode 100644
index ff65656..0000000
--- a/src/uscxml/plugins/invoker/umundo/JSON.pb.h
+++ /dev/null
@@ -1,361 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: JSON.proto
-
-#ifndef PROTOBUF_JSON_2eproto__INCLUDED
-#define PROTOBUF_JSON_2eproto__INCLUDED
-
-#include <string>
-
-#include <google/protobuf/stubs/common.h>
-
-
-#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/message.h>
-#include <google/protobuf/repeated_field.h>
-#include <google/protobuf/extension_set.h>
-#include <google/protobuf/unknown_field_set.h>
-// @@protoc_insertion_point(includes)
-
-// Internal implementation detail -- do not call these.
-void protobuf_AddDesc_JSON_2eproto();
-void protobuf_AssignDesc_JSON_2eproto();
-void protobuf_ShutdownFile_JSON_2eproto();
-
-class JSONProto;
-
-// ===================================================================
-
-class JSONProto : public ::google::protobuf::Message {
-public:
- JSONProto();
- virtual ~JSONProto();
-
- JSONProto(const JSONProto& from);
-
- inline JSONProto& operator=(const JSONProto& from) {
- CopyFrom(from);
- return *this;
- }
-
- inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
- return _unknown_fields_;
- }
-
- inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
- return &_unknown_fields_;
- }
-
- static const ::google::protobuf::Descriptor* descriptor();
- static const JSONProto& default_instance();
-
- void Swap(JSONProto* other);
-
- // implements Message ----------------------------------------------
-
- JSONProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const JSONProto& from);
- void MergeFrom(const JSONProto& from);
- void Clear();
- bool IsInitialized() const;
-
- int ByteSize() const;
- bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input);
- void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const;
- ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
- int GetCachedSize() const {
- return _cached_size_;
- }
-private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const;
-public:
-
- ::google::protobuf::Metadata GetMetadata() const;
-
- // nested types ----------------------------------------------------
-
- // accessors -------------------------------------------------------
-
- // repeated .JSONProto compound = 1;
- inline int compound_size() const;
- inline void clear_compound();
- static const int kCompoundFieldNumber = 1;
- inline const ::JSONProto& compound(int index) const;
- inline ::JSONProto* mutable_compound(int index);
- inline ::JSONProto* add_compound();
- inline const ::google::protobuf::RepeatedPtrField< ::JSONProto >&
- compound() const;
- inline ::google::protobuf::RepeatedPtrField< ::JSONProto >*
- mutable_compound();
-
- // optional string key = 2;
- inline bool has_key() const;
- inline void clear_key();
- static const int kKeyFieldNumber = 2;
- inline const ::std::string& key() const;
- inline void set_key(const ::std::string& value);
- inline void set_key(const char* value);
- inline void set_key(const char* value, size_t size);
- inline ::std::string* mutable_key();
- inline ::std::string* release_key();
- inline void set_allocated_key(::std::string* key);
-
- // optional string atom = 3;
- inline bool has_atom() const;
- inline void clear_atom();
- static const int kAtomFieldNumber = 3;
- inline const ::std::string& atom() const;
- inline void set_atom(const ::std::string& value);
- inline void set_atom(const char* value);
- inline void set_atom(const char* value, size_t size);
- inline ::std::string* mutable_atom();
- inline ::std::string* release_atom();
- inline void set_allocated_atom(::std::string* atom);
-
- // optional bool verbatim = 4;
- inline bool has_verbatim() const;
- inline void clear_verbatim();
- static const int kVerbatimFieldNumber = 4;
- inline bool verbatim() const;
- inline void set_verbatim(bool value);
-
- // @@protoc_insertion_point(class_scope:JSONProto)
-private:
- inline void set_has_key();
- inline void clear_has_key();
- inline void set_has_atom();
- inline void clear_has_atom();
- inline void set_has_verbatim();
- inline void clear_has_verbatim();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::google::protobuf::RepeatedPtrField< ::JSONProto > compound_;
- ::std::string* key_;
- ::std::string* atom_;
- bool verbatim_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
-
- friend void protobuf_AddDesc_JSON_2eproto();
- friend void protobuf_AssignDesc_JSON_2eproto();
- friend void protobuf_ShutdownFile_JSON_2eproto();
-
- void InitAsDefaultInstance();
- static JSONProto* default_instance_;
-};
-// ===================================================================
-
-
-// ===================================================================
-
-// JSONProto
-
-// repeated .JSONProto compound = 1;
-inline int JSONProto::compound_size() const {
- return compound_.size();
-}
-inline void JSONProto::clear_compound() {
- compound_.Clear();
-}
-inline const ::JSONProto& JSONProto::compound(int index) const {
- return compound_.Get(index);
-}
-inline ::JSONProto* JSONProto::mutable_compound(int index) {
- return compound_.Mutable(index);
-}
-inline ::JSONProto* JSONProto::add_compound() {
- return compound_.Add();
-}
-inline const ::google::protobuf::RepeatedPtrField< ::JSONProto >&
-JSONProto::compound() const {
- return compound_;
-}
-inline ::google::protobuf::RepeatedPtrField< ::JSONProto >*
-JSONProto::mutable_compound() {
- return &compound_;
-}
-
-// optional string key = 2;
-inline bool JSONProto::has_key() const {
- return (_has_bits_[0] & 0x00000002u) != 0;
-}
-inline void JSONProto::set_has_key() {
- _has_bits_[0] |= 0x00000002u;
-}
-inline void JSONProto::clear_has_key() {
- _has_bits_[0] &= ~0x00000002u;
-}
-inline void JSONProto::clear_key() {
- if (key_ != &::google::protobuf::internal::kEmptyString) {
- key_->clear();
- }
- clear_has_key();
-}
-inline const ::std::string& JSONProto::key() const {
- return *key_;
-}
-inline void JSONProto::set_key(const ::std::string& value) {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- key_->assign(value);
-}
-inline void JSONProto::set_key(const char* value) {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- key_->assign(value);
-}
-inline void JSONProto::set_key(const char* value, size_t size) {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- key_->assign(reinterpret_cast<const char*>(value), size);
-}
-inline ::std::string* JSONProto::mutable_key() {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- return key_;
-}
-inline ::std::string* JSONProto::release_key() {
- clear_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- return NULL;
- } else {
- ::std::string* temp = key_;
- key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- return temp;
- }
-}
-inline void JSONProto::set_allocated_key(::std::string* key) {
- if (key_ != &::google::protobuf::internal::kEmptyString) {
- delete key_;
- }
- if (key) {
- set_has_key();
- key_ = key;
- } else {
- clear_has_key();
- key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- }
-}
-
-// optional string atom = 3;
-inline bool JSONProto::has_atom() const {
- return (_has_bits_[0] & 0x00000004u) != 0;
-}
-inline void JSONProto::set_has_atom() {
- _has_bits_[0] |= 0x00000004u;
-}
-inline void JSONProto::clear_has_atom() {
- _has_bits_[0] &= ~0x00000004u;
-}
-inline void JSONProto::clear_atom() {
- if (atom_ != &::google::protobuf::internal::kEmptyString) {
- atom_->clear();
- }
- clear_has_atom();
-}
-inline const ::std::string& JSONProto::atom() const {
- return *atom_;
-}
-inline void JSONProto::set_atom(const ::std::string& value) {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- atom_->assign(value);
-}
-inline void JSONProto::set_atom(const char* value) {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- atom_->assign(value);
-}
-inline void JSONProto::set_atom(const char* value, size_t size) {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- atom_->assign(reinterpret_cast<const char*>(value), size);
-}
-inline ::std::string* JSONProto::mutable_atom() {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- return atom_;
-}
-inline ::std::string* JSONProto::release_atom() {
- clear_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- return NULL;
- } else {
- ::std::string* temp = atom_;
- atom_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- return temp;
- }
-}
-inline void JSONProto::set_allocated_atom(::std::string* atom) {
- if (atom_ != &::google::protobuf::internal::kEmptyString) {
- delete atom_;
- }
- if (atom) {
- set_has_atom();
- atom_ = atom;
- } else {
- clear_has_atom();
- atom_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- }
-}
-
-// optional bool verbatim = 4;
-inline bool JSONProto::has_verbatim() const {
- return (_has_bits_[0] & 0x00000008u) != 0;
-}
-inline void JSONProto::set_has_verbatim() {
- _has_bits_[0] |= 0x00000008u;
-}
-inline void JSONProto::clear_has_verbatim() {
- _has_bits_[0] &= ~0x00000008u;
-}
-inline void JSONProto::clear_verbatim() {
- verbatim_ = false;
- clear_has_verbatim();
-}
-inline bool JSONProto::verbatim() const {
- return verbatim_;
-}
-inline void JSONProto::set_verbatim(bool value) {
- set_has_verbatim();
- verbatim_ = value;
-}
-
-
-// @@protoc_insertion_point(namespace_scope)
-
-#ifndef SWIG
-namespace google {
-namespace protobuf {
-
-
-} // namespace google
-} // namespace protobuf
-#endif // SWIG
-
-// @@protoc_insertion_point(global_scope)
-
-#endif // PROTOBUF_JSON_2eproto__INCLUDED
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
deleted file mode 100644
index 0302d87..0000000
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
+++ /dev/null
@@ -1,655 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "UmundoInvoker.h"
-#include <glog/logging.h>
-#include "uscxml/URL.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool pluginConnect(pluma::Host& host) {
- host.add( new UmundoInvokerProvider() );
- return true;
-}
-#endif
-
-UmundoInvoker::UmundoInvoker() : _node(NULL), _discovery(NULL), _pub(NULL), _sub(NULL) {
-}
-
-UmundoInvoker::~UmundoInvoker() {
- if (_node) {
- if (_sub) {
- _node->removeSubscriber(*_sub);
- delete _sub;
- }
- if (_pub) {
- _node->removePublisher(*_pub);
- delete _pub;
- }
- delete(_node);
- }
-};
-
-boost::shared_ptr<InvokerImpl> UmundoInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<UmundoInvoker> invoker = boost::shared_ptr<UmundoInvoker>(new UmundoInvoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data UmundoInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void UmundoInvoker::send(const SendRequest& req) {
- umundo::Message msg;
-
- if (req.name.length() > 0) {
- msg.putMeta("event", req.name);
- } else {
- msg.putMeta("event", "umundo");
- }
-
- try {
- Data data = req.data;
-
- if (data.empty() && req.content.length())
- data = _interpreter->getDataModel().getStringAsData(req.content);
-
- if (data.empty()) {
- LOG(ERROR) << "Cannot transform content to data object per datamodel or no data given";
- return;
- }
-
-// std::cout << Data::toJSON(data) << std::endl;
-
- std::string type;
- if (req.params.find("type") != req.params.end()) {
- // we are supposed to build a typed object
- type = req.params.find("type")->second.atom;
-
- const google::protobuf::Message* protoMsg = umundo::PBSerializer::getProto(type);
- if (protoMsg == NULL) {
- LOG(ERROR) << "No type '" << type << "' is known, pass a directory with proto .desc files via types param when invoking";
- return;
- }
-
- google::protobuf::Message* pbMsg = protoMsg->New();
- if (!dataToProtobuf(pbMsg, data)) {
- LOG(ERROR) << "Cannot create message from JSON - not sending";
- return;
- }
-
- if (!_isService) {
- // add all s11n properties
- _pub->prepareMsg(&msg, type, pbMsg);
- _pub->send(&msg);
- } else {
- // invoke as service
- std::map<umundo::ServiceDescription, umundo::ServiceStub*>::iterator svcIter = _svcs.begin();
- while(svcIter != _svcs.end()) {
- umundo::ServiceStub* stub = svcIter->second;
- Event event;
- void* rv = NULL;
- stub->callStubMethod(req.name, pbMsg, type, rv, "");
- protobufToData(event.data, *(const google::protobuf::Message*)rv);
-
- event.name = _invokeId + ".reply." + req.name;
- event.origin = msg.getMeta("um.channel");
- event.origintype = "umundo";
- event.eventType = Event::EXTERNAL;
-
- returnEvent(event);
- svcIter++;
- }
- }
- } else {
- // just encode JSON
- JSONProto* jsonProtoMsg = new JSONProto();
- if (!dataToJSONbuf(jsonProtoMsg, data)) {
- LOG(ERROR) << "Cannot create message from JSON - not sending";
- return;
- }
-
- if (!_isService) {
- // add all s11n properties
- _pub->prepareMsg(&msg, "JSON", jsonProtoMsg);
- _pub->send(&msg);
- } else {
- LOG(ERROR) << "Cannot invoke services with untyped JSON";
- return;
- }
-
- }
- } catch (Event e) {
- LOG(ERROR) << "Syntax error when invoking umundo:" << std::endl << e << std::endl;
- return;
- }
-}
-
-void UmundoInvoker::cancel(const std::string sendId) {
- assert(false);
-}
-
-void UmundoInvoker::invoke(const InvokeRequest& req) {
-
- std::string domain;
- std::string channelName;
- std::string serviceName;
-
- if (req.params.find("channel") != req.params.end()) {
- channelName = req.params.find("channel")->second.atom;
- _isService = false;
- } else if (req.params.find("service") != req.params.end()) {
- serviceName = req.params.find("service")->second.atom;
- _isService = true;
- } else {
- LOG(ERROR) << "Invoking umundo needs a service or a channel param";
- return;
- }
- if (req.params.find("domain") != req.params.end()) {
- domain = req.params.find("domain")->second.atom;
- }
- _node = new umundo::Node();
-
- umundo::DiscoveryConfigMDNS discOpts;
- _discovery = new umundo::Discovery(&discOpts);
-
- _discovery->add(*_node);
-
- // add type from .proto or .desc files
- std::list<std::string> type;
- Event::getParam(req.params, "type", type);
- std::list<std::string>::const_iterator typeIter = type.begin();
- while(typeIter != type.end()) {
- URL typeURI(*typeIter);
- if (typeURI.toAbsolute(_interpreter->getBaseURL(req.elem))) {
- std::string filename = typeURI.asLocalFile(".proto");
- umundo::PBSerializer::addProto(filename);
- } else {
- LOG(ERROR) << "umundo invoker has relative type src but no baseURI set with interpreter.";
- }
- typeIter++;
- }
-
- // add directory with .proto or .desc files
- std::list<std::string> types;
- Event::getParam(req.params, "type", types);
- std::list<std::string>::const_iterator typesIter = types.begin();
- while(typesIter != types.end()) {
- URL typeURI(*typesIter);
- if (typeURI.toAbsolute(_interpreter->getBaseURL(req.elem))) {
- umundo::PBSerializer::addProto(typeURI.path());
- } else {
- LOG(ERROR) << "invoke element has relative src URI with no baseURI set.";
- }
- typesIter++;
- }
-
- if (!_isService) {
- // use umundo to publish objects on a channel
- _pub = new umundo::TypedPublisher(channelName);
- _sub = new umundo::TypedSubscriber(channelName, this);
-
- _pub->setGreeter(this);
- _sub->registerType("JSON", new JSONProto());
-
- _node->addPublisher(*_pub);
- _node->addSubscriber(*_sub);
-
- } else if (serviceName.length() > 0) {
- // use umundo to access services
- _svcFilter = new umundo::ServiceFilter(serviceName);
- _node->connect(_svcMgr);
- _svcMgr->startQuery(*_svcFilter, this);
- }
-}
-
-void UmundoInvoker::welcome(umundo::TypedPublisher atPub, const umundo::SubscriberStub& sub) {
- Event event;
- event.name = "umundo.sub.added";
- event.data.compound["subId"] = Data(sub.getUUID(), Data::VERBATIM);
- event.data.compound["channel"] = Data(atPub.getChannelName(), Data::VERBATIM);
- event.data.compound["totalSubs"] = Data(toStr(atPub.waitForSubscribers(0)), Data::VERBATIM);
- returnEvent(event);
-}
-
-void UmundoInvoker::farewell(umundo::TypedPublisher fromPub, const umundo::SubscriberStub& sub) {
- Event event;
- event.name = "umundo.sub.removed";
- event.data.compound["subId"] = Data(sub.getUUID(), Data::VERBATIM);
- event.data.compound["channel"] = Data(fromPub.getChannelName(), Data::VERBATIM);
- event.data.compound["totalSubs"] = Data(toStr(fromPub.waitForSubscribers(0)), Data::VERBATIM);
- returnEvent(event);
-}
-
-void UmundoInvoker::receive(void* object, umundo::Message* msg) {
- uscxml::Event event;
- if (msg->getMeta().find("event") != msg->getMeta().end()) {
- event.name = msg->getMeta("event");
- } else {
- event.name = "umundo.rcvd";
- }
-
- event.invokeid = _invokeId;
- event.origin = msg->getMeta("um.channel");
- event.origintype = "umundo";
- event.eventType = Event::EXTERNAL;
-
- if (object != NULL) {
- if (msg->getMeta().find("um.s11n.type") != msg->getMeta().end() &&
- boost::equals(msg->getMeta().find("um.s11n.type")->second, "JSON")) {
- jsonbufToData(event.data, *(JSONProto*)object);
- } else {
- protobufToData(event.data, *(const google::protobuf::Message*)object);
- }
- }
-
- // get meta fields into event
- std::map<std::string, std::string>::const_iterator metaIter = msg->getMeta().begin();
- while(metaIter != msg->getMeta().end()) {
- if (isNumeric(metaIter->second.c_str(), 10)) {
- event.data.compound[metaIter->first] = Data(metaIter->second, Data::INTERPRETED);
- } else {
- event.data.compound[metaIter->first] = Data(metaIter->second, Data::VERBATIM);
- }
- metaIter++;
- }
-
- if (msg->size() > 0) {
- event.data.compound["protobuf"] = Data(msg->data(), msg->size(), "application/x-protobuf");
- }
-
- returnEvent(event);
-}
-
-void UmundoInvoker::added(umundo::ServiceDescription desc) {
- LOG(ERROR) << "Service found!";
-
- umundo::ServiceStub* stub = new umundo::ServiceStub(desc);
- _svcs[desc] = stub;
-
- Event addedEvent;
- addedEvent.invokeid = _invokeId;
- addedEvent.origin = desc.getName();
- addedEvent.origintype = "umundo";
- addedEvent.eventType = Event::EXTERNAL;
- addedEvent.name = _invokeId + ".added";
-
- std::map<std::string, std::string>::const_iterator propIter = desc.getProperties().begin();
- while(propIter != desc.getProperties().end()) {
- addedEvent.data.compound[propIter->first] = Data(propIter->second, Data::VERBATIM);
- propIter++;
- }
-
- returnEvent(addedEvent);
-}
-
-void UmundoInvoker::removed(umundo::ServiceDescription desc) {
- LOG(ERROR) << "Service lost!";
-
- if (_svcs.find(desc) == _svcs.end()) {
- return;
- }
-
- delete _svcs[desc];
- _svcs.erase(desc);
-
- Event addedEvent;
- addedEvent.invokeid = _invokeId;
- addedEvent.origin = desc.getName();
- addedEvent.origintype = "umundo";
- addedEvent.eventType = Event::EXTERNAL;
- addedEvent.name = _invokeId + ".removed";
-
- std::map<std::string, std::string>::const_iterator propIter = desc.getProperties().begin();
- while(propIter != desc.getProperties().end()) {
- addedEvent.data.compound[propIter->first] = Data(propIter->second, Data::VERBATIM);
- propIter++;
- }
-
- returnEvent(addedEvent);
-}
-
-void UmundoInvoker::changed(umundo::ServiceDescription desc, uint64_t what) {
-}
-
-bool UmundoInvoker::jsonbufToData(Data& data, const JSONProto& json) {
- if (json.compound_size() > 0) {
- if (json.compound(0).key().size() > 0) {
- // compound
- for (int i = 0; i < json.compound_size(); i++) {
- jsonbufToData(data.compound[json.compound(i).key()], json.compound(i));
- }
- } else {
- // array
- for (int i = 0; i < json.compound_size(); i++) {
- Data arrayData;
- data.array.push_back(arrayData);
- jsonbufToData(data.array.back(), json.compound(i));
- }
- }
- } else if (json.atom().size() > 0) {
- data.atom = json.atom();
- if (json.verbatim()) {
- data.type = Data::VERBATIM;
- } else {
- data.type = Data::INTERPRETED;
- }
- }
-
- return true;
-}
-
-bool UmundoInvoker::protobufToData(Data& data, const google::protobuf::Message& msg) {
- const google::protobuf::Descriptor* desc = msg.GetDescriptor();
- const google::protobuf::Reflection* reflect = msg.GetReflection();
-
- data.compound["protobufType"] = Data(desc->name(), Data::VERBATIM);
-
- for (int i = 0; i < desc->field_count(); i++) {
- const google::protobuf::FieldDescriptor* fieldDesc = desc->field(i);
- std::string key = fieldDesc->name();
-
- if (!fieldDesc->is_repeated() && !reflect->HasField(msg, fieldDesc))
- continue;
-
- switch(fieldDesc->type()) {
- case google::protobuf::FieldDescriptor::TYPE_BOOL:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(reflect->GetRepeatedBool(msg, fieldDesc, j) ? "true" : "false"));
- }
- } else {
- data.compound[key].atom = (reflect->GetBool(msg, fieldDesc) ? "true" : "false");
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_BYTES:
- case google::protobuf::FieldDescriptor::TYPE_STRING:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedString(msg, fieldDesc, j)), Data::VERBATIM));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetString(msg, fieldDesc));
- data.compound[key].type = Data::VERBATIM;
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedDouble(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetDouble(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_ENUM:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- const google::protobuf::EnumValueDescriptor* enumDesc = reflect->GetRepeatedEnum(msg, fieldDesc, j);
- data.compound[key].array.push_back(Data(toStr(enumDesc->name()), Data::VERBATIM));
- }
- } else {
- const google::protobuf::EnumValueDescriptor* enumDesc = reflect->GetEnum(msg, fieldDesc);
- data.compound[key] = Data(enumDesc->name(), Data::VERBATIM);
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_FIXED32:
- case google::protobuf::FieldDescriptor::TYPE_UINT32:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedUInt32(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetUInt32(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_FIXED64:
- case google::protobuf::FieldDescriptor::TYPE_UINT64:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedUInt64(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetUInt64(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_FLOAT:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedFloat(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetFloat(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_GROUP:
- LOG(ERROR) << "TYPE_GROUP is unimplemented" << std::endl;
- break;
- case google::protobuf::FieldDescriptor::TYPE_INT32:
- case google::protobuf::FieldDescriptor::TYPE_SINT32:
- case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedInt32(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetInt32(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_INT64:
- case google::protobuf::FieldDescriptor::TYPE_SINT64:
- case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data(toStr(reflect->GetRepeatedInt64(msg, fieldDesc, j)), Data::INTERPRETED));
- }
- } else {
- data.compound[key].atom = toStr(reflect->GetInt64(msg, fieldDesc));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
- if (fieldDesc->is_repeated()) {
- for (int j = 0; j < reflect->FieldSize(msg, fieldDesc); j++) {
- data.compound[key].array.push_back(Data());
- protobufToData(data.compound[key].array.back(), reflect->GetRepeatedMessage(msg, fieldDesc, j));
- }
- } else {
- protobufToData(data.compound[key], reflect->GetMessage(msg, fieldDesc));
- }
- break;
- }
- }
- return true;
-}
-
-bool UmundoInvoker::dataToJSONbuf(JSONProto* msg, Data& data) {
- const google::protobuf::Descriptor* desc = msg->GetDescriptor();
- const google::protobuf::Reflection* reflect = msg->GetReflection();
-
- if (!data.compound.empty()) {
- const google::protobuf::FieldDescriptor* fieldDesc = desc->FindFieldByName("compound");
-
- std::map<std::string, Data>::iterator compoundIter = data.compound.begin();
- while(compoundIter != data.compound.end()) {
- JSONProto* compoundMsg = (JSONProto*)reflect->AddMessage(msg, fieldDesc);
- dataToJSONbuf(compoundMsg, compoundIter->second);
- compoundMsg->set_key(compoundIter->first);
- compoundIter++;
- }
- } else if (!data.array.empty()) {
- const google::protobuf::FieldDescriptor* fieldDesc = desc->FindFieldByName("compound");
-
- std::list<Data>::iterator arrayIter = data.array.begin();
- while(arrayIter != data.array.end()) {
- JSONProto* arrayMsg = (JSONProto*)reflect->AddMessage(msg, fieldDesc);
- dataToJSONbuf(arrayMsg, *arrayIter);
- arrayIter++;
- }
- } else if (!data.atom.empty()) {
- const google::protobuf::FieldDescriptor* atomDesc = desc->FindFieldByName("atom");
- const google::protobuf::FieldDescriptor* verbDesc = desc->FindFieldByName("verbatim");
-
- if (data.type == Data::VERBATIM) {
- reflect->SetBool(msg, verbDesc, true);
- } else {
- reflect->SetBool(msg, verbDesc, false);
- }
- reflect->SetString(msg, atomDesc, data.atom);
- }
- return true;
-}
-
-bool UmundoInvoker::dataToProtobuf(google::protobuf::Message* msg, Data& data) {
- const google::protobuf::Descriptor* desc = msg->GetDescriptor();
- const google::protobuf::Reflection* reflect = msg->GetReflection();
-
- for (int i = 0; i < desc->field_count(); i++) {
- const google::protobuf::FieldDescriptor* fieldDesc = desc->field(i);
- std::string key = fieldDesc->name();
-
- if (data.compound.find(key) == data.compound.end()) {
- if (fieldDesc->is_required()) {
- LOG(ERROR) << "required field " << key << " not given";
- return false;
- }
- continue;
- }
-
- std::list<Data>::iterator arrayIter = data.compound[key].array.begin();
-
- switch(fieldDesc->type()) {
- case google::protobuf::FieldDescriptor::TYPE_BOOL:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddBool(msg, fieldDesc, arrayIter->atom.compare("false") == 0 ? false : true);
- arrayIter++;
- }
- } else {
- reflect->SetBool(msg, fieldDesc, (data.compound[key].atom.compare("false") == 0 ? false : true));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_BYTES:
- case google::protobuf::FieldDescriptor::TYPE_STRING:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddString(msg, fieldDesc, arrayIter->atom);
- arrayIter++;
- }
- } else {
- reflect->SetString(msg, fieldDesc, data.compound[key].atom);
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddDouble(msg, fieldDesc, strTo<double>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetDouble(msg, fieldDesc, strTo<double>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_ENUM:
- LOG(ERROR) << "TYPE_ENUM is unimplemented" << std::endl;
- break;
- case google::protobuf::FieldDescriptor::TYPE_FIXED32:
- case google::protobuf::FieldDescriptor::TYPE_UINT32:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddUInt32(msg, fieldDesc, strTo<uint32_t>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetUInt32(msg, fieldDesc, strTo<uint32_t>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_FIXED64:
- case google::protobuf::FieldDescriptor::TYPE_UINT64:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddUInt64(msg, fieldDesc, strTo<uint64_t>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetUInt64(msg, fieldDesc, strTo<uint64_t>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_FLOAT:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddFloat(msg, fieldDesc, strTo<float>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetFloat(msg, fieldDesc, strTo<float>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_GROUP:
- LOG(ERROR) << "TYPE_GROUP is unimplemented" << std::endl;
- break;
- case google::protobuf::FieldDescriptor::TYPE_INT32:
- case google::protobuf::FieldDescriptor::TYPE_SINT32:
- case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddInt32(msg, fieldDesc, strTo<int32_t>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetInt32(msg, fieldDesc, strTo<int32_t>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_INT64:
- case google::protobuf::FieldDescriptor::TYPE_SINT64:
- case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- reflect->AddInt64(msg, fieldDesc, strTo<int64_t>(arrayIter->atom));
- arrayIter++;
- }
- } else {
- reflect->SetInt64(msg, fieldDesc, strTo<int64_t>(data.compound[key].atom));
- }
- break;
- case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
- if (fieldDesc->is_repeated()) {
- while(arrayIter != data.compound[key].array.end()) {
- dataToProtobuf(reflect->AddMessage(msg, fieldDesc), *arrayIter);
- arrayIter++;
- }
- } else {
- dataToProtobuf(reflect->MutableMessage(msg, fieldDesc), data.compound[key]);
- }
- break;
- }
- }
- return true;
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
deleted file mode 100644
index 4c0e988..0000000
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#ifndef UMUNDOINVOKER_H_77YXQGU7
-#define UMUNDOINVOKER_H_77YXQGU7
-
-#include <uscxml/Interpreter.h>
-#include <google/protobuf/message.h>
-#include <umundo/core.h>
-#include <umundo/s11n.h>
-#include <umundo/rpc.h>
-#include <umundo/s11n/protobuf/PBSerializer.h>
-
-#include "JSON.pb.h"
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class Interpreter;
-
-class UmundoInvoker : public InvokerImpl, public umundo::TypedReceiver, public umundo::ResultSet<umundo::ServiceDescription>, public umundo::TypedGreeter {
-public:
- UmundoInvoker();
- virtual ~UmundoInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::list<std::string> getNames() {
- std::list<std::string> names;
- names.push_back("umundo");
- names.push_back("http://umundo.tk.informatik.tu-darmstadt.de/");
- names.push_back("http://umundo.tk.informatik.tu-darmstadt.de");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
- virtual void receive(void* object, umundo::Message* msg);
-
- virtual void added(umundo::ServiceDescription);
- virtual void removed(umundo::ServiceDescription);
- virtual void changed(umundo::ServiceDescription, uint64_t what);
-
- virtual void welcome(umundo::TypedPublisher atPub, const umundo::SubscriberStub& sub);
- virtual void farewell(umundo::TypedPublisher fromPub, const umundo::SubscriberStub& sub);
-
-protected:
- bool _isService;
-
- bool dataToJSONbuf(JSONProto* msg, Data& data);
- bool dataToProtobuf(google::protobuf::Message* msg, Data& data);
-
- bool jsonbufToData(Data& data, const JSONProto& json);
- bool protobufToData(Data& data, const google::protobuf::Message& msg);
-
- umundo::Node* _node;
- umundo::Discovery* _discovery;
- umundo::TypedPublisher* _pub;
- umundo::TypedSubscriber* _sub;
-
- umundo::ServiceFilter* _svcFilter;
- umundo::ServiceManager* _svcMgr;
- std::map<umundo::ServiceDescription, umundo::ServiceStub*> _svcs;
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(UmundoInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: UMUNDOINVOKER_H_77YXQGU7 */