30 #include "../EventId.h"
31 #include "../MetaData.h"
41 id.set_sender_id(uuid.data, uuid.size());
47 fillEventId(*(notification.mutable_event_id()), event->getEventId());
51 const EventPtr& event,
const string& wireSchema) {
53 notification.set_wire_schema(wireSchema);
55 notification.set_scope(event->getScopePtr()->toString());
56 if (!event->getMethod().empty()) {
57 notification.set_method(event->getMethod());
59 notification.mutable_meta_data()->set_create_time(
60 event->getMetaData().getCreateTime());
61 notification.mutable_meta_data()->set_send_time(
62 event->getMetaData().getSendTime());
63 notification.mutable_meta_data()->set_receive_time(
64 event->getMetaData().getReceiveTime());
65 notification.mutable_meta_data()->set_deliver_time(
66 event->getMetaData().getDeliverTime());
67 for (map<string, string>::const_iterator it =
68 event->mutableMetaData().userInfosBegin();
69 it !=
event->mutableMetaData().userInfosEnd(); ++it) {
71 notification.mutable_meta_data()->mutable_user_infos()->Add();
72 info->set_key(it->first);
73 info->set_value(it->second);
75 for (map<string, boost::uint64_t>::const_iterator it =
76 event->mutableMetaData().userTimesBegin();
77 it !=
event->mutableMetaData().userTimesEnd(); ++it) {
79 notification.mutable_meta_data()->mutable_user_times()->Add();
80 info->set_key(it->first);
81 info->set_timestamp(it->second);
83 set<rsb::EventId> causes =
event->getCauses();
84 for (set<rsb::EventId>::const_iterator causeIt = causes.begin();
85 causeIt != causes.end(); ++causeIt) {
86 fillEventId(*(notification.add_causes()), *causeIt);
92 VoidPtr data,
const string& dataType) {
94 event->mutableMetaData().setCreateTime(
95 (boost::uint64_t) notification.meta_data().create_time());
96 event->mutableMetaData().setSendTime(
97 (boost::uint64_t) notification.meta_data().send_time());
98 event->mutableMetaData().setReceiveTime(
99 (boost::uint64_t) notification.meta_data().receive_time());
100 event->mutableMetaData().setDeliverTime(
101 (boost::uint64_t) notification.meta_data().deliver_time());
104 (boost::uint8_t*) notification.event_id().sender_id().c_str()),
105 notification.event_id().sequence_number());
107 event->setScopePtr(
ScopePtr(
new Scope(notification.scope())));
108 if (notification.has_method()) {
109 event->setMethod(notification.method());
112 for (
int i = 0; i < notification.meta_data().user_infos_size(); ++i) {
113 event->mutableMetaData().setUserInfo(
114 notification.meta_data().user_infos(i).key(),
115 notification.meta_data().user_infos(i).value());
117 for (
int i = 0; i < notification.meta_data().user_times_size(); ++i) {
118 event->mutableMetaData().setUserTime(
119 notification.meta_data().user_times(i).key(),
120 notification.meta_data().user_times(i).timestamp());
122 for (
int i = 0; i < notification.causes_size(); ++i) {
123 protocol::EventId cause = notification.causes(i);
127 (boost::uint8_t*) cause.sender_id().c_str()),
128 cause.sequence_number()));
131 event->setType(dataType);
132 event->setData(data);