src/core/model/event-id.cc
changeset 9134 7a750f032acd
parent 7386 2310ed220a61
child 9193 9e679a504fc6
equal deleted inserted replaced
9133:bcf7cef191c1 9134:7a750f032acd
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    19  */
    19  */
    20 #include "event-id.h"
    20 #include "event-id.h"
    21 #include "simulator.h"
    21 #include "simulator.h"
    22 #include "event-impl.h"
    22 #include "event-impl.h"
       
    23 #include "log.h"
       
    24 
       
    25 NS_LOG_COMPONENT_DEFINE ("EventId");
    23 
    26 
    24 namespace ns3 {
    27 namespace ns3 {
    25 
    28 
    26 EventId::EventId ()
    29 EventId::EventId ()
    27   : m_eventImpl (0),
    30   : m_eventImpl (0),
    28     m_ts (0),
    31     m_ts (0),
    29     m_context (0),
    32     m_context (0),
    30     m_uid (0)
    33     m_uid (0)
    31 {
    34 {
       
    35   NS_LOG_FUNCTION (this);
    32 }
    36 }
    33 
    37 
    34 EventId::EventId (const Ptr<EventImpl> &impl, uint64_t ts, uint32_t context, uint32_t uid)
    38 EventId::EventId (const Ptr<EventImpl> &impl, uint64_t ts, uint32_t context, uint32_t uid)
    35   : m_eventImpl (impl),
    39   : m_eventImpl (impl),
    36     m_ts (ts),
    40     m_ts (ts),
    37     m_context (context),
    41     m_context (context),
    38     m_uid (uid)
    42     m_uid (uid)
    39 {
    43 {
       
    44   NS_LOG_FUNCTION (this << impl << ts << context << uid);
    40 }
    45 }
    41 void
    46 void
    42 EventId::Cancel (void)
    47 EventId::Cancel (void)
    43 {
    48 {
       
    49   NS_LOG_FUNCTION (this);
    44   Simulator::Cancel (*this);
    50   Simulator::Cancel (*this);
    45 }
    51 }
    46 bool
    52 bool
    47 EventId::IsExpired (void) const
    53 EventId::IsExpired (void) const
    48 {
    54 {
       
    55   NS_LOG_FUNCTION (this);
    49   return Simulator::IsExpired (*this);
    56   return Simulator::IsExpired (*this);
    50 }
    57 }
    51 bool
    58 bool
    52 EventId::IsRunning (void) const
    59 EventId::IsRunning (void) const
    53 {
    60 {
       
    61   NS_LOG_FUNCTION (this);
    54   return !IsExpired ();
    62   return !IsExpired ();
    55 }
    63 }
    56 EventImpl *
    64 EventImpl *
    57 EventId::PeekEventImpl (void) const
    65 EventId::PeekEventImpl (void) const
    58 {
    66 {
       
    67   NS_LOG_FUNCTION (this);
    59   return PeekPointer (m_eventImpl);
    68   return PeekPointer (m_eventImpl);
    60 }
    69 }
    61 uint64_t 
    70 uint64_t 
    62 EventId::GetTs (void) const
    71 EventId::GetTs (void) const
    63 {
    72 {
       
    73   NS_LOG_FUNCTION (this);
    64   return m_ts;
    74   return m_ts;
    65 }
    75 }
    66 uint32_t 
    76 uint32_t 
    67 EventId::GetContext (void) const
    77 EventId::GetContext (void) const
    68 {
    78 {
       
    79   NS_LOG_FUNCTION (this);
    69   return m_context;
    80   return m_context;
    70 }
    81 }
    71 uint32_t 
    82 uint32_t 
    72 EventId::GetUid (void) const
    83 EventId::GetUid (void) const
    73 {
    84 {
       
    85   NS_LOG_FUNCTION (this);
    74   return m_uid;
    86   return m_uid;
    75 }
    87 }
    76 
    88 
    77 bool operator == (const EventId &a, const EventId &b)
    89 bool operator == (const EventId &a, const EventId &b)
    78 {
    90 {
       
    91   NS_LOG_FUNCTION (a.GetUid () << b.GetUid ());
    79   return 
    92   return 
    80     a.m_uid == b.m_uid && 
    93     a.m_uid == b.m_uid && 
    81     a.m_context == b.m_context && 
    94     a.m_context == b.m_context && 
    82     a.m_ts == b.m_ts && 
    95     a.m_ts == b.m_ts && 
    83     a.m_eventImpl == b.m_eventImpl;
    96     a.m_eventImpl == b.m_eventImpl;
    84 }
    97 }
    85 bool operator != (const EventId &a, const EventId &b)
    98 bool operator != (const EventId &a, const EventId &b)
    86 {
    99 {
       
   100   NS_LOG_FUNCTION (a.GetUid () << b.GetUid ());
    87   return !(a == b);
   101   return !(a == b);
    88 }
   102 }
    89 
   103 
    90 
   104 
    91 
   105