Lines 330-379
QueueDisc::QueueDisc ()
|
Link Here
|
---|
|
330 |
{ |
330 |
{ |
331 |
NS_LOG_FUNCTION (this); |
331 |
NS_LOG_FUNCTION (this); |
332 |
|
332 |
|
333 |
using namespace std::placeholders; |
333 |
// These lambdas call the DropBeforeEnqueue or DropAfterDequeue methods of this |
334 |
|
334 |
// QueueDisc object. Given that a callback to the operator() of these lambdas |
335 |
// Remove ambiguity for overloaded member functions |
335 |
// is connected to the DropBeforeEnqueue and DropAfterDequeue traces of the |
336 |
typedef std::basic_string<char>& (std::basic_string<char>::*Function) (const char*); |
336 |
// internal queues, the INTERNAL_QUEUE_DROP constant is passed as the reason |
337 |
|
337 |
// why the packet is dropped. |
338 |
Function append = &std::basic_string<char>::append, |
338 |
m_internalQueueDbeFunctor = [this] (Ptr<const QueueDiscItem> item) |
339 |
assign = &std::basic_string<char>::assign; |
339 |
{ |
340 |
|
340 |
return DropBeforeEnqueue (item, INTERNAL_QUEUE_DROP); |
341 |
// The operator() of these function objects calls the QueueDisc::DropBeforeEnqueue |
341 |
}; |
342 |
// and QueueDisc::DropAfterDequeue methods of this QueueDisc object (these function |
342 |
m_internalQueueDadFunctor = [this] (Ptr<const QueueDiscItem> item) |
343 |
// objects are bound to this QueueDisc object), which require two arguments: a |
343 |
{ |
344 |
// Ptr<const QueueDiscItem> and a const char*. Given that a callback to the operator() |
344 |
return DropAfterDequeue (item, INTERNAL_QUEUE_DROP); |
345 |
// is connected to the DropBeforeEnqueue and DropAfterDequeue traces of the Queue |
345 |
}; |
346 |
// class, the first argument is provided by such traces, while the second argument |
346 |
|
347 |
// (the reason why the packet was dropped) is bound to the INTERNAL_QUEUE_DROP constant. |
347 |
// These lambdas call the DropBeforeEnqueue or DropAfterDequeue methods of this |
348 |
m_internalQueueDbeFunctor = std::bind (&QueueDisc::DropBeforeEnqueue, this, |
348 |
// QueueDisc object. Given that a callback to the operator() of these lambdas |
349 |
_1, (const char*)INTERNAL_QUEUE_DROP); |
349 |
// is connected to the DropBeforeEnqueue and DropAfterDequeue traces of the |
350 |
m_internalQueueDadFunctor = std::bind (&QueueDisc::DropAfterDequeue, this, |
350 |
// child queue discs, the concatenation of the CHILD_QUEUE_DISC_DROP constant |
351 |
_1, (const char*)INTERNAL_QUEUE_DROP); |
351 |
// and the second argument provided by such traces is passed as the reason why |
352 |
|
352 |
// the packet is dropped. |
353 |
// The operator() of these function objects calls the QueueDisc::DropBeforeEnqueue |
353 |
m_childQueueDiscDbeFunctor = [this] (Ptr<const QueueDiscItem> item, const char* r) |
354 |
// and QueueDisc::DropAfterDequeue methods of this QueueDisc object (these function |
354 |
{ |
355 |
// objects are bound to this QueueDisc object), which require two arguments: a |
355 |
return DropBeforeEnqueue (item, |
356 |
// Ptr<const QueueDiscItem> and a const char*. Given that a callback to the operator() |
356 |
m_childQueueDiscDropMsg.assign (CHILD_QUEUE_DISC_DROP).append (r).data ()); |
357 |
// is connected to the DropBeforeEnqueue and DropAfterDequeue traces of the QueueDisc |
357 |
}; |
358 |
// class, both arguments are provided by such traces. The first argument is provided |
358 |
m_childQueueDiscDadFunctor = [this] (Ptr<const QueueDiscItem> item, const char* r) |
359 |
// as is, while the second argument (the reason why the packet was dropped) is obtained |
359 |
{ |
360 |
// by calling m_childQueueDiscDropMsg.assign (CHILD_QUEUE_DISC_DROP).append (_2).data () |
360 |
return DropAfterDequeue (item, |
361 |
// i.e., the second argument is the concatenation of the CHILD_QUEUE_DISC_DROP constant |
361 |
m_childQueueDiscDropMsg.assign (CHILD_QUEUE_DISC_DROP).append (r).data ()); |
362 |
// and the second argument provided by the traces of the QueueDisc class. |
362 |
}; |
363 |
m_childQueueDiscDbeFunctor = std::bind (&QueueDisc::DropBeforeEnqueue, this, _1, |
|
|
364 |
std::bind (&std::basic_string<char>::data, |
365 |
std::bind (append, |
366 |
std::bind (assign, |
367 |
&m_childQueueDiscDropMsg, |
368 |
(const char*)CHILD_QUEUE_DISC_DROP), |
369 |
_2))); |
370 |
m_childQueueDiscDadFunctor = std::bind (&QueueDisc::DropAfterDequeue, this, _1, |
371 |
std::bind (&std::basic_string<char>::data, |
372 |
std::bind (append, |
373 |
std::bind (assign, |
374 |
&m_childQueueDiscDropMsg, |
375 |
(const char*)CHILD_QUEUE_DISC_DROP), |
376 |
_2))); |
377 |
} |
363 |
} |
378 |
|
364 |
|
379 |
QueueDisc::~QueueDisc () |
365 |
QueueDisc::~QueueDisc () |