35 #include "commeffectevent.pb.h" 37 class EMANE::Events::CommEffectEvent::Implementation
41 commEffects_{commEffects}{}
57 if(!msg.ParseFromString(serialization))
64 for(
const auto & effect : msg.commeffects())
66 commEffects.push_back({
static_cast<EMANE::NEMId>(effect.nemid()),
67 std::chrono::duration_cast<Microseconds>(
DoubleSeconds{effect.latencyseconds()}),
68 std::chrono::duration_cast<Microseconds>(
DoubleSeconds{effect.jitterseconds()}),
69 effect.probabilityloss(),
70 effect.probabilityduplicate(),
71 effect.unicastbitratebps(),
72 effect.broadcastbitratebps(),
76 pImpl_.reset(
new Implementation{commEffects});
81 pImpl_{
new Implementation{commEffects}}{}
85 pImpl_{
new Implementation{rhs.getCommEffects()}}{}
95 pImpl_{
new Implementation{{}}}
97 rval.pImpl_.swap(pImpl_);
103 rval.pImpl_.swap(pImpl_);
112 return pImpl_->getCommEffects();
121 for(
auto & commEffect : pImpl_->getCommEffects())
123 auto pCommEffectMessage = msg.add_commeffects();
125 pCommEffectMessage->set_nemid(commEffect.getNEMId());
126 pCommEffectMessage->set_latencyseconds(std::chrono::duration_cast<DoubleSeconds>(commEffect.getLatency()).count());
127 pCommEffectMessage->set_jitterseconds(std::chrono::duration_cast<DoubleSeconds>(commEffect.getJitter()).count());
128 pCommEffectMessage->set_probabilityloss(commEffect.getProbabilityLoss());
129 pCommEffectMessage->set_probabilityduplicate(commEffect.getProbabilityDuplicate());
130 pCommEffectMessage->set_unicastbitratebps(commEffect.getUnicastBitRate());
131 pCommEffectMessage->set_broadcastbitratebps(commEffect.getBroadcastBitRate());
134 if(!msg.SerializeToString(&serialization))
139 return serialization;
std::string Serialization
SerializationException is thrown when an exception occurs during serialization or deserialization of ...
Event interface is the base for all events.
Serialization serialize() const override
CommEffectEvent(const Serialization &serialization)
CommEffectEvent & operator=(const CommEffectEvent &rhs)
std::list< CommEffect > CommEffects
Comm Effect events are used to set asynchronous link characteristics from one or more transmitting NE...
std::chrono::duration< double > DoubleSeconds
const CommEffects & getCommEffects() const