diff --git a/ipaacalib/cpp/include/ipaaca/ipaaca.h b/ipaacalib/cpp/include/ipaaca/ipaaca.h index 36312290a9b9e7d9e8ebbde1470baf2adc4ff8cb..6e3c3e7bd96df3ce68c68550c8f659dc08599a8e 100644 --- a/ipaacalib/cpp/include/ipaaca/ipaaca.h +++ b/ipaacalib/cpp/include/ipaaca/ipaaca.h @@ -611,6 +611,7 @@ class RemotePushIU: public IUInterface {//{{{ friend class InputBuffer; friend class OutputBuffer; friend class IUConverter; + friend class MessageConverter; public: Payload _payload; protected: diff --git a/ipaacalib/cpp/src/ipaaca.cc b/ipaacalib/cpp/src/ipaaca.cc index 9da3bf19faae592820ebdf1b492e865c005a2faf..3965f036260a4f745ef8d110aa7b4f248c6200d4 100644 --- a/ipaacalib/cpp/src/ipaaca.cc +++ b/ipaacalib/cpp/src/ipaaca.cc @@ -1292,7 +1292,7 @@ AnnotatedData IUConverter::deserialize(const std::string& wireSchema, const std: return std::make_pair("ipaaca::RemotePushIU", obj); break; } - /*case IU_ACCESS_MESSAGE: + case IU_ACCESS_MESSAGE: { // Create a "Message-type IU" boost::shared_ptr<RemoteMessage> obj = RemoteMessage::create(); @@ -1319,7 +1319,7 @@ AnnotatedData IUConverter::deserialize(const std::string& wireSchema, const std: //return std::make_pair(getDataType(), obj); return std::make_pair("ipaaca::RemoteMessage", obj); break; - } */ + } default: // other cases not handled yet! ( TODO ) throw NotImplementedError(); @@ -1395,6 +1395,34 @@ AnnotatedData MessageConverter::deserialize(const std::string& wireSchema, const pbo->ParseFromString(wire); IUAccessMode mode = static_cast<IUAccessMode>(pbo->access_mode()); switch(mode) { + case IU_ACCESS_PUSH: + { + // Create a "remote push IU" + boost::shared_ptr<RemotePushIU> obj = RemotePushIU::create(); + // transfer pbo data to obj + obj->_uid = pbo->uid(); + obj->_revision = pbo->revision(); + obj->_category = pbo->category(); + obj->_payload_type = pbo->payload_type(); + obj->_owner_name = pbo->owner_name(); + obj->_committed = pbo->committed(); + obj->_read_only = pbo->read_only(); + obj->_access_mode = IU_ACCESS_PUSH; + for (int i=0; i<pbo->payload_size(); i++) { + const protobuf::PayloadItem& it = pbo->payload(i); + obj->_payload._store[it.key()] = it.value(); + } + for (int i=0; i<pbo->links_size(); i++) { + const protobuf::LinkSet& pls = pbo->links(i); + LinkSet& ls = obj->_links._links[pls.type()]; + for (int j=0; j<pls.targets_size(); j++) { + ls.insert(pls.targets(j)); + } + } + //return std::make_pair(getDataType(), obj); + return std::make_pair("ipaaca::RemotePushIU", obj); + break; + } case IU_ACCESS_MESSAGE: { // Create a "Message-type IU"