make IsChildOf not return true for test against self. Add operator < for TypeId.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 10 Apr 2008 10:23:56 -0700
changeset 2939 3cff8627a284
parent 2938 621b23d5be5b
child 2940 8fb456039670
make IsChildOf not return true for test against self. Add operator < for TypeId.
src/core/type-id.cc
src/core/type-id.h
--- a/src/core/type-id.cc	Thu Apr 10 09:23:24 2008 -0700
+++ b/src/core/type-id.cc	Thu Apr 10 10:23:56 2008 -0700
@@ -480,7 +480,7 @@
     {
       tmp = tmp.GetParent ();
     }
-  return tmp == other;
+  return tmp == other && *this != other;
 }
 std::string 
 TypeId::GetGroupName (void) const
@@ -696,4 +696,9 @@
   return a.m_tid != b.m_tid;
 }
 
+bool operator < (TypeId a, TypeId b)
+{
+  return a.m_tid < b.m_tid;
+}
+
 } // namespace ns3
--- a/src/core/type-id.h	Thu Apr 10 09:23:24 2008 -0700
+++ b/src/core/type-id.h	Thu Apr 10 10:23:56 2008 -0700
@@ -357,6 +357,7 @@
   friend class AttributeList;
   friend bool operator == (TypeId a, TypeId b);
   friend bool operator != (TypeId a, TypeId b);
+  friend bool operator <  (TypeId a, TypeId b);
 
 
   /**
@@ -375,6 +376,10 @@
 
 std::ostream & operator << (std::ostream &os, TypeId tid);
 std::istream & operator >> (std::istream &is, TypeId &tid);
+bool operator == (TypeId a, TypeId b);
+bool operator != (TypeId a, TypeId b);
+bool operator <  (TypeId a, TypeId b);
+
 
 ATTRIBUTE_HELPER_HEADER_2 (TypeId);