35 #include "radiotorouter.pb.h" 37 class EMANE::Controls::R2RIQueueMetricControlMessage::Implementation
43 queueMetrics_{queueMetrics}{}
54 EMANE::Controls::R2RIQueueMetricControlMessage::
55 R2RIQueueMetricControlMessage(
const R2RIQueueMetricControlMessage & msg):
57 pImpl_{
new Implementation{*msg.pImpl_}}
62 EMANE::Controls::R2RIQueueMetricControlMessage::R2RIQueueMetricControlMessage(
const R2RIQueueMetrics & queueMetrics):
64 pImpl_{
new Implementation{queueMetrics}}{}
69 return pImpl_->getQueueMetrics();
82 EMANEMessage::RadioToRouterQueueMetrics msg;
86 R2RIQueueMetrics::const_iterator iter = metrics.begin();
88 for(;iter != metrics.end(); ++iter)
90 auto pQueueMetric = msg.add_metrics();
92 pQueueMetric->set_queueid(iter->getQueueId());
93 pQueueMetric->set_maxsize(iter->getMaxSize());
94 pQueueMetric->set_currentdepth(iter->getCurrentDepth());
95 pQueueMetric->set_numdiscards(iter->getNumDiscards());
96 pQueueMetric->set_avgdelay(std::chrono::duration_cast<DoubleSeconds>(iter->getAvgDelay()).count());
99 if(!msg.SerializeToString(&serialization))
104 return serialization;
110 EMANEMessage::RadioToRouterQueueMetrics msg;
112 if(!msg.ParseFromString(serialization))
119 for(
const auto & metric : msg.metrics())
123 metric.currentdepth(),
124 metric.numdiscards(),
std::string Serialization
~R2RIQueueMetricControlMessage()
R2RI Queue Metric Control Message is sent to an NEM's transport layer to convey information about MAC...
SerializationException is thrown when an exception occurs during serialization or deserialization of ...
std::string serialize() const override
R2RIQueueMetricControlMessage * clone() const override
std::chrono::microseconds Microseconds
std::chrono::duration< double > DoubleSeconds
ControlMessage interface is the base for all control messages.
const R2RIQueueMetrics & getQueueMetrics() const
std::list< R2RIQueueMetric > R2RIQueueMetrics
R2RI queue metrics are used in conjunction with the R2RIQueueMetricControlMessage to inform an NEM's ...
ControlMessage(ControlMessageId id)
static R2RIQueueMetricControlMessage * create(const Serialization &serialization)