[Ns-developers] ns3: Signals

Gustavo Carneiro gjcarneiro at gmail.com
Tue Mar 13 07:15:45 PDT 2007


  As discussed in the "Node position" thread, here's a patch to add signal
objects to ns-3:

  http://telecom.inescporto.pt/~gjc/ns3-signal.diff

  It can be very useful to provide extension points into the ns-3 core when
you wan loose coupling between extensions and the core, i.e. the core knows
nothing of the extensions and just provides a general notification mechanism
where the extensions can plug into.

  Example:

class Node
{
public:

  struct position_t { double x, y, z; };

  Signal<position_t, position_t> m_setPosition;

  void SetPosition (position_t newPosition) {
    position_t oldPosition = m_position;
    m_position = newPosition;
    m_setPosition.Emit (oldPosition, newPosition);
  }
private:
  position_t m_position;
};

  Cheers,
-- 
Gustavo J. A. M. Carneiro
"The universe is always one step beyond logic."


More information about the Ns-developers mailing list