make IsChildOf not return true for test against self. Add operator < for TypeId.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu Apr 10 10:23:56 2008 -0700 (22 months ago)
changeset 29393cff8627a284
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
     1.1 --- a/src/core/type-id.cc	Thu Apr 10 09:23:24 2008 -0700
     1.2 +++ b/src/core/type-id.cc	Thu Apr 10 10:23:56 2008 -0700
     1.3 @@ -480,7 +480,7 @@
     1.4      {
     1.5        tmp = tmp.GetParent ();
     1.6      }
     1.7 -  return tmp == other;
     1.8 +  return tmp == other && *this != other;
     1.9  }
    1.10  std::string 
    1.11  TypeId::GetGroupName (void) const
    1.12 @@ -696,4 +696,9 @@
    1.13    return a.m_tid != b.m_tid;
    1.14  }
    1.15  
    1.16 +bool operator < (TypeId a, TypeId b)
    1.17 +{
    1.18 +  return a.m_tid < b.m_tid;
    1.19 +}
    1.20 +
    1.21  } // namespace ns3
     2.1 --- a/src/core/type-id.h	Thu Apr 10 09:23:24 2008 -0700
     2.2 +++ b/src/core/type-id.h	Thu Apr 10 10:23:56 2008 -0700
     2.3 @@ -357,6 +357,7 @@
     2.4    friend class AttributeList;
     2.5    friend bool operator == (TypeId a, TypeId b);
     2.6    friend bool operator != (TypeId a, TypeId b);
     2.7 +  friend bool operator <  (TypeId a, TypeId b);
     2.8  
     2.9  
    2.10    /**
    2.11 @@ -375,6 +376,10 @@
    2.12  
    2.13  std::ostream & operator << (std::ostream &os, TypeId tid);
    2.14  std::istream & operator >> (std::istream &is, TypeId &tid);
    2.15 +bool operator == (TypeId a, TypeId b);
    2.16 +bool operator != (TypeId a, TypeId b);
    2.17 +bool operator <  (TypeId a, TypeId b);
    2.18 +
    2.19  
    2.20  ATTRIBUTE_HELPER_HEADER_2 (TypeId);
    2.21