src/devices/csma-cd/csma-cd-net-device.cc
changeset 992 37953a86a975
parent 977 09bf4e458015
child 993 9f9d5048b710
equal deleted inserted replaced
991:e05514a93564 992:37953a86a975
    58 
    58 
    59 CsmaCdNetDevice::~CsmaCdNetDevice()
    59 CsmaCdNetDevice::~CsmaCdNetDevice()
    60 {
    60 {
    61   NS_DEBUG ("CsmaCdNetDevice::~CsmaCdNetDevice ()");
    61   NS_DEBUG ("CsmaCdNetDevice::~CsmaCdNetDevice ()");
    62   m_queue = 0;
    62   m_queue = 0;
    63 }
       
    64 
       
    65 //
       
    66 // Copy constructor for CsmaCdNetDevice.
       
    67 //
       
    68 // We use the underlying NetDevice copy constructor to get the base class
       
    69 // copied.  These just remain as is (e.g. you get the same name, the same
       
    70 // MAC address).  If you need to fix them up, YOU, the copier need to do 
       
    71 // that.
       
    72 // 
       
    73 // The things we need to be careful of are the channel, the queue and the
       
    74 // trace callback.  If the channel pointer is non-zero, we copy the pointer 
       
    75 // and add a reference.  If the queue is non-zero, we copy it using the queue
       
    76 // assignment operator.  We don't mess with the trace -- we just reset it.
       
    77 // We're assuming that the tracing will be set up after the topology creation
       
    78 // phase and this won't actually matter.
       
    79 //
       
    80 
       
    81 CsmaCdNetDevice::CsmaCdNetDevice (const CsmaCdNetDevice& nd)
       
    82   : NetDevice(nd), m_bps (nd.m_bps)
       
    83 {
       
    84   NS_DEBUG ("CsmaCdNetDevice::CsmaCdNetDevice (" << &nd << ")");
       
    85 
       
    86   m_txMachineState = READY;
       
    87   m_tInterframeGap = nd.m_tInterframeGap;
       
    88   m_backoff = nd.m_backoff;
       
    89   m_channel = nd.m_channel; 
       
    90   m_queue = 0;
       
    91   m_pktType = nd.m_pktType;
       
    92   m_sendEnable = nd.m_sendEnable;
       
    93   m_receiveEnable = nd.m_receiveEnable;
       
    94     
       
    95   if (nd.m_queue)
       
    96     {
       
    97       m_queue = nd.m_queue;
       
    98     }
       
    99     
       
   100 }
    63 }
   101 
    64 
   102 void 
    65 void 
   103 CsmaCdNetDevice::DoDispose ()
    66 CsmaCdNetDevice::DoDispose ()
   104 {
    67 {