fix documentation generation warning and add doc for TagPrettyPrinter
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 06 Sep 2006 15:01:56 +0200
changeset 74 93b151b87563
parent 73 a44becd5a5fc
child 75 0f3f4b0a158b
fix documentation generation warning and add doc for TagPrettyPrinter
src/common/tags.h
--- a/src/common/tags.h	Wed Sep 06 14:56:13 2006 +0200
+++ b/src/common/tags.h	Wed Sep 06 15:01:56 2006 +0200
@@ -80,6 +80,8 @@
 };
 
 /**
+ * \brief pretty print packet tags
+ * 
  * This class is used to register a pretty-printer
  * callback function to print in a nice user-friendly
  * way the content of the target type. To register
@@ -92,7 +94,11 @@
 template <typename T>
 class TagPrettyPrinter {
 public:
-    TagPrettyPrinter<T> (void(*) (T *, std::ostream &));
+	/**
+	 * \param fn a function which can pretty-print an instance
+	 *        of type T in the output stream.
+	 */
+    TagPrettyPrinter<T> (void(*fn) (T *, std::ostream &));
 private:
     TagPrettyPrinter<T> ();
     static void prettyPrintCb (uint8_t *buf, std::ostream &os);
@@ -113,6 +119,10 @@
 }; // namespace ns3
 
 
+
+/**************************************************************
+     An implementation of the templates defined above
+ *************************************************************/
 #include <cassert>
 #include <string.h>
 
@@ -161,13 +171,14 @@
 template <typename T>
 TagPrettyPrinter<T>::TagPrettyPrinter (void(*prettyPrinter) (T *, std::ostream &))
 {
+    assert (sizeof (T) <= Tags::SIZE);
     gPrettyPrinter  = prettyPrinter;
     TagsPrettyPrinterRegistry::record (TypeUid<T>::getUid (),
                       &TagPrettyPrinter<T>::prettyPrintCb);
 }
 template <typename T>
 void 
-TagPrettyPrinter<T>::prettyPrintCb (uint8_t buf[Tags::SIZE], std::ostream &os)
+TagPrettyPrinter<T>::prettyPrintCb (uint8_t *buf, std::ostream &os)
 {
     assert (sizeof (T) <= Tags::SIZE);
     T *tag = reinterpret_cast<T *> (buf);