From e62ea4cdb4dd635722145d4c8c401b7bb099ce64 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 19 Jul 2007 08:29:48 +0200 Subject: [PATCH] add operator == and != to EventId --- src/simulator/event-id.cc | 13 +++++++++++++ src/simulator/event-id.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/simulator/event-id.cc b/src/simulator/event-id.cc index 7357070b0..18f875935 100644 --- a/src/simulator/event-id.cc +++ b/src/simulator/event-id.cc @@ -70,5 +70,18 @@ EventId::GetUid (void) const return m_uid; } +bool operator == (const EventId &a, const EventId &b) +{ + return + a.m_uid == b.m_uid && + a.m_ts == b.m_ts && + a.m_eventImpl == b.m_eventImpl; +} +bool operator != (const EventId &a, const EventId &b) +{ + return !(a == b); +} + + }; // namespace ns3 diff --git a/src/simulator/event-id.h b/src/simulator/event-id.h index a7514289d..4350c9bbe 100644 --- a/src/simulator/event-id.h +++ b/src/simulator/event-id.h @@ -55,11 +55,15 @@ public: uint64_t GetTs (void) const; uint32_t GetUid (void) const; private: + friend bool operator == (const EventId &a, const EventId &b); EventImpl *m_eventImpl; uint64_t m_ts; uint32_t m_uid; }; +bool operator == (const EventId &a, const EventId &b); +bool operator != (const EventId &a, const EventId &b); + }; // namespace ns3 #endif /* EVENT_ID_H */