src/core/attribute.h
changeset 2599 fcc1728eb669
parent 2595 b504951bcca8
child 2619 df0774070293
--- a/src/core/attribute.h	Wed Mar 12 10:18:14 2008 -0700
+++ b/src/core/attribute.h	Wed Mar 12 11:35:00 2008 -0700
@@ -216,6 +216,9 @@
    *          false otherwise.
    */
   virtual bool Check (Attribute value) const = 0;
+  virtual std::string GetType (void) const = 0;
+  virtual bool HasTypeConstraints (void) const = 0;
+  virtual std::string GetTypeConstraints (void) const = 0;
   /**
    * \returns a new instance of an AttributeValue (wrapper in an Attribute 
    *          instance) which matches the type of the underlying attribute.
@@ -228,10 +231,6 @@
   mutable uint32_t m_count;
 };
 
-template <typename T, typename BASE>
-Ptr<AttributeChecker>
-MakeSimpleAttributeChecker (void);
-
 template <typename T, typename U>
 Ptr<const AttributeAccessor>
 MakePtrAccessor (Ptr<U> T::*memberVariable);
@@ -323,6 +322,16 @@
       }
     return true;
   }
+  virtual std::string GetType (void) const {
+    // XXX: we should be able to return better information
+    return "Ptr<>";
+  }
+  virtual bool HasTypeConstraints (void) const {
+    return false;
+  }
+  virtual std::string GetTypeConstraints (void) const {
+    return "";
+  }
   virtual Attribute Create (void) const {
     return Attribute::Create<PtrValue<T> > ();
   }
@@ -488,23 +497,6 @@
   return Create<internal::APtrChecker<T> > ();
 }
 
-template <typename T, typename BASE>
-Ptr<AttributeChecker>
-MakeSimpleAttributeChecker (void)
-{
-  struct SimpleAttributeChecker : public BASE
-  {
-    virtual bool Check (Attribute value) const {
-      return value.DynCast<const T *> () != 0;
-    }
-    virtual Attribute Create (void) const {
-      return Attribute::Create<T> ();
-    }
-  } *checker = new SimpleAttributeChecker ();
-  return Ptr<AttributeChecker> (checker, false);
-}
-
-
 } // namespace ns3
 
 #endif /* ATTRIBUTE_H */