From 6c93b818aff338f3e946d387dd87ebfd7d2290ab Mon Sep 17 00:00:00 2001 From: Raj Bhattacharjea Date: Mon, 14 May 2007 10:38:08 -0400 Subject: [PATCH] datarate, packet, defaultvalue, object dox --- src/common/data-rate.h | 2 +- src/common/packet.h | 2 +- src/core/default-value.h | 16 ++++++++++++++++ src/core/object.h | 21 +++++++++++++++++++++ src/devices/p2p/p2p-channel.h | 27 ++++++++++++++++++++++++++- 5 files changed, 65 insertions(+), 3 deletions(-) diff --git a/src/common/data-rate.h b/src/common/data-rate.h index a400d9894..dd1c9bda5 100644 --- a/src/common/data-rate.h +++ b/src/common/data-rate.h @@ -61,7 +61,7 @@ class DataRate * numerical portion, followed by units in the following format: * - Prefix: nothing, "k", "M", "G" * - Data Unit: "b, "B" - * - Time Suffix: "ps", "/s" + * - Time Suffix: "ps", "/s" \n * The prefixes are SI powers of 10 (10^0,10^3,10^6,10^9 respectively).\n * The units are the bit, and the (8-bit) byte respectively.\n * Both time suffixes denote "per second". Some supported examples include diff --git a/src/common/packet.h b/src/common/packet.h index 1517480ee..01432882c 100644 --- a/src/common/packet.h +++ b/src/common/packet.h @@ -50,7 +50,7 @@ namespace ns3 { * * Implementing a new type of Header for a new protocol is pretty easy * and is a matter of creating a subclass of the ns3::Header base class, - * and implementing the 4 pure virtual methods defined in ns3::Header. + * and implementing the 4 pure virtual methods defined in ns3::Chunk. * Sample code which shows how to create such a new Header, how to use * it, and how to manipulate tags is shown below: * \include samples/main-packet.cc diff --git a/src/core/default-value.h b/src/core/default-value.h index fbf34940d..cc72547d5 100644 --- a/src/core/default-value.h +++ b/src/core/default-value.h @@ -199,10 +199,26 @@ private: class StringEnumDefaultValue : public DefaultValueBase { public: + /** + * \param name The name of the variable + * \param help The help string + */ StringEnumDefaultValue (const std::string &name, const std::string &help); + /** + * \brief Add a default value to this enumeration of strings + * \param value The string to make the default for this + */ void AddDefaultValue (const std::string &value); + /** + * \brief Add a possible value to accept for this default value + */ void AddPossibleValue (const std::string &value); + /** + * \brief Get the value of this default value. + * \return The string that has been assigned to this default value, either by + * Bind() or by a command line setting + */ std::string GetValue (void) const; private: virtual bool DoParseValue (const std::string &value); diff --git a/src/core/object.h b/src/core/object.h index 0f03307cc..bf09d6f48 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -25,13 +25,34 @@ namespace ns3 { +/** + * \brief Base class that supports reference counting for memory management + * + * Many objects in the system derive from this class in order to use its + * reference counting implementation. + */ class Object { public: + /** + * \brief Constructor + * + * Creates an object with a single reference count + */ Object (); virtual ~Object (); + /** + * \brief Increments the reference count of this object + */ void Ref (void) const; + /** + * \brief Decrements the reference count of this object + */ void Unref (void) const; + /** + * \return true if there is only a single reference to this object anywhere + * in the system; false otherwise. + */ bool IsSingle (void) const; void Dispose (void); protected: diff --git a/src/devices/p2p/p2p-channel.h b/src/devices/p2p/p2p-channel.h index dacdc9c0b..97a251177 100644 --- a/src/devices/p2p/p2p-channel.h +++ b/src/devices/p2p/p2p-channel.h @@ -57,17 +57,42 @@ public: // bring myself to just type 2 in the code (even though I type 0 and 1 :-). // static const int N_DEVICES = 2; - + /** + * \brief Create a PointToPointChannel + * + * By default, you get a channel with the name "PointToPoint Channel" that + * has an "infitely" fast transmission speed and zero delay. + */ PointToPointChannel (); + + /** + * \brief Create a PointToPointChannel + * + * \param bps The bitrate of the channel + * \param delay Transmission delay through the channel + */ PointToPointChannel (const DataRate& bps, const Time& delay); + + /** + * \brief Create a PointToPointChannel + * + * \param name the name of the channel for identification purposes + * \param bps The bitrate of the channel + * \param delay Transmission delay through the channel + */ PointToPointChannel (const std::string& name, const DataRate& bps, const Time& delay); + /** + * \brief Attach a given netdevice to this channel + * \param device pointer to the netdevice to attach to the channel + */ void Attach (Ptr device); bool TransmitStart (Packet& p, Ptr src); bool TransmitEnd (Packet &p, Ptr src); void PropagationCompleteEvent(Packet p, Ptr src); + virtual uint32_t GetNDevices (void) const; virtual Ptr GetDevice (uint32_t i) const;