From 71426c90f9ff0a3904de27ecaa4d04c9518965a0 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 6 Sep 2006 15:01:56 +0200 Subject: [PATCH] fix documentation generation warning and add doc for TagPrettyPrinter --- src/common/tags.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/common/tags.h b/src/common/tags.h index eee5807fd..6f9db0b8b 100644 --- a/src/common/tags.h +++ b/src/common/tags.h @@ -80,6 +80,8 @@ private: }; /** + * \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 @@ private: template class TagPrettyPrinter { public: - TagPrettyPrinter (void(*) (T *, std::ostream &)); + /** + * \param fn a function which can pretty-print an instance + * of type T in the output stream. + */ + TagPrettyPrinter (void(*fn) (T *, std::ostream &)); private: TagPrettyPrinter (); static void prettyPrintCb (uint8_t *buf, std::ostream &os); @@ -113,6 +119,10 @@ private: }; // namespace ns3 + +/************************************************************** + An implementation of the templates defined above + *************************************************************/ #include #include @@ -161,13 +171,14 @@ const uint32_t TypeUid::getUid (void) template TagPrettyPrinter::TagPrettyPrinter (void(*prettyPrinter) (T *, std::ostream &)) { + assert (sizeof (T) <= Tags::SIZE); gPrettyPrinter = prettyPrinter; TagsPrettyPrinterRegistry::record (TypeUid::getUid (), &TagPrettyPrinter::prettyPrintCb); } template void -TagPrettyPrinter::prettyPrintCb (uint8_t buf[Tags::SIZE], std::ostream &os) +TagPrettyPrinter::prettyPrintCb (uint8_t *buf, std::ostream &os) { assert (sizeof (T) <= Tags::SIZE); T *tag = reinterpret_cast (buf);