[Doxygen] Attribute implementations.

This commit is contained in:
Peter D. Barnes, Jr.
2014-10-21 16:14:35 -07:00
parent 9d326c107d
commit cccfc167dd
36 changed files with 1012 additions and 241 deletions

View File

@@ -1658,7 +1658,8 @@ PREDEFINED = \
NS3_LOG_ENABLE \
NS_LOG_COMPONENT_DEFINE()=1 \
NS_LOG_COMPONENT_DEFINE_MASK()=1 \
NS_OBJECT_ENSURE_REGISTERED()=1 \
NS_OBJECT_ENSURE_REGISTERED()=1 \
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
@@ -1666,9 +1667,18 @@ PREDEFINED = \
# Use the PREDEFINED tag if you want to use a different macro definition that
# overrules the definition found in the source code.
EXPAND_AS_DEFINED = ATTRIBUTE_VALUE_DEFINE \
EXPAND_AS_DEFINED = ATTRIBUTE_ACCESSOR_DEFINE \
ATTRIBUTE_CHECKER_DEFINE \
ATTRIBUTE_CHECKER_IMPLEMENT \
ATTRIBUTE_CHECKER_IMPLEMENT_WITH_NAME \
ATTRIBUTE_CONVERTER_DEFINE \
ATTRIBUTE_HELPER_CPP \
ATTRIBUTE_HELPER_HEADER \
ATTRIBUTE_VALUE_DEFINE \
ATTRIBUTE_VALUE_DEFINE_WITH_NAME \
ATTRIBUTE_HELPER_HEADER_2
ATTRIBUTE_VALUE_IMPLEMENT \
ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME \
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all references to function-like macros

View File

@@ -25,26 +25,25 @@
namespace ns3 {
/**
* \ingroup attribute
*
* \brief Hold a bool native type
*
* \anchor bool
*
* This class can be used to hold bool variables
* which must go through the Attribute system.
*/
class BooleanValue : public AttributeValue
{
public:
BooleanValue ();
/**
* Construct from an explicit value.
*
* \param [in] value The boolean value to begin with.
*/
BooleanValue (bool value);
void Set (bool value);
bool Get (void) const;
template <typename T>
bool GetAccessor (T &v) const;
/**
* Functor returning the value.
* \returns The value.
*/
operator bool () const;
virtual Ptr<AttributeValue> Copy (void) const;
@@ -61,6 +60,15 @@ bool BooleanValue::GetAccessor (T &v) const
return true;
}
/**
* Output streamer.
*
* The value is printed as "true" or "false".
*
* \param [in,out] os The stream.
* \param [in] value The BooleanValue to print.
* \returns The stream.
*/
std::ostream & operator << (std::ostream &os, const BooleanValue &value);
ATTRIBUTE_CHECKER_DEFINE (Boolean);

View File

@@ -102,11 +102,16 @@ namespace ns3 {
*
* Trait class to convert a pointer into a reference,
* used by MemPtrCallBackImpl
* @{
*/
template <typename T>
struct CallbackTraits;
/**
* \ingroup makecallbackmemptr
*
* Trait class to convert a pointer into a reference,
* used by MemPtrCallBackImpl
*/
template <typename T>
struct CallbackTraits<T *>
{
@@ -119,7 +124,6 @@ struct CallbackTraits<T *>
return *p;
}
};
/**@}*/
/**
* \ingroup callbackimpl
@@ -962,6 +966,8 @@ protected:
* Of course, it also does not use copy-destruction semantics
* and relies on a reference list rather than autoPtr to hold
* the pointer.
*
* \see attribute_Callback
*/
template<typename R,
typename T1 = empty, typename T2 = empty,
@@ -1671,10 +1677,6 @@ Callback<R,T1,T2,T3,T4,T5,T6> MakeBoundCallback (R (*fnPtr)(TX1,TX2,TX3,T1,T2,T3
namespace ns3 {
/**
* \ingroup callback
* AttributeValue form of a Callback
*/
class CallbackValue : public AttributeValue
{
public:
@@ -1687,7 +1689,7 @@ public:
CallbackValue (const CallbackBase &base);
/** Destructor */
virtual ~CallbackValue ();
/** \param base the Callbackbase to use */
/** \param base The CallbackBase to use */
void Set (CallbackBase base);
/**
* Give value my callback, if type compatible

View File

@@ -27,26 +27,39 @@
namespace ns3 {
// Additional docs for class DoubleValue:
/**
* \ingroup attribute
*
* \class ns3::DoubleValue
* \brief Hold a floating point type
*
* \anchor double
* This class can be used to hold variables of floating point type
* such as 'double' or 'float'. The internal format is 'double'.
*/
ATTRIBUTE_VALUE_DEFINE_WITH_NAME (double, Double);
ATTRIBUTE_ACCESSOR_DEFINE (Double);
template <typename T>
Ptr<const AttributeChecker> MakeDoubleChecker (void);
/**
* Make a checker with a minimum value.
*
* The minimum value is included in the allowed range.
*
* \param [in] min The minimum value.
* \returns The AttributeChecker.
* \see AttributeChecker
*/
template <typename T>
Ptr<const AttributeChecker> MakeDoubleChecker (double min);
/**
* Make a checker with a minimum and a maximum value.
*
* The minimum and maximum values are included in the allowed range.
*
* \param [in] min The minimum value.
* \param [in] max The maximum value.
* \returns The AttributeChecker.
* \see AttributeChecker
*/
template <typename T>
Ptr<const AttributeChecker> MakeDoubleChecker (double min, double max);

View File

@@ -27,26 +27,26 @@ namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("Enum");
EnumValue::EnumValue ()
: m_v ()
: m_value ()
{
NS_LOG_FUNCTION (this);
}
EnumValue::EnumValue (int v)
: m_v (v)
EnumValue::EnumValue (int value)
: m_value (value)
{
NS_LOG_FUNCTION (this << v);
NS_LOG_FUNCTION (this << value);
}
void
EnumValue::Set (int v)
EnumValue::Set (int value)
{
NS_LOG_FUNCTION (this << v);
m_v = v;
NS_LOG_FUNCTION (this << value);
m_value = value;
}
int
EnumValue::Get (void) const
{
NS_LOG_FUNCTION (this);
return m_v;
return m_value;
}
Ptr<AttributeValue>
EnumValue::Copy (void) const
@@ -62,7 +62,7 @@ EnumValue::SerializeToString (Ptr<const AttributeChecker> checker) const
NS_ASSERT (p != 0);
for (EnumChecker::ValueSet::const_iterator i = p->m_valueSet.begin (); i != p->m_valueSet.end (); i++)
{
if (i->first == m_v)
if (i->first == m_value)
{
return i->second;
}
@@ -82,7 +82,7 @@ EnumValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker>
{
if (i->second == value)
{
m_v = i->first;
m_value = i->first;
return true;
}
}
@@ -95,16 +95,16 @@ EnumChecker::EnumChecker ()
}
void
EnumChecker::AddDefault (int v, std::string name)
EnumChecker::AddDefault (int value, std::string name)
{
NS_LOG_FUNCTION (this << v << name);
m_valueSet.push_front (std::make_pair (v, name));
NS_LOG_FUNCTION (this << value << name);
m_valueSet.push_front (std::make_pair (value, name));
}
void
EnumChecker::Add (int v, std::string name)
EnumChecker::Add (int value, std::string name)
{
NS_LOG_FUNCTION (this << v << name);
m_valueSet.push_back (std::make_pair (v, name));
NS_LOG_FUNCTION (this << value << name);
m_valueSet.push_back (std::make_pair (value, name));
}
bool
EnumChecker::Check (const AttributeValue &value) const

View File

@@ -26,36 +26,53 @@
namespace ns3 {
// Additional docs for class DoubleValue:
/**
* \ingroup attribute
*
* \brief hold variables of type 'enum'
* Hold variables of type \c enum
*
* This class can be used to hold variables of any kind
* of enum.
*
* This is often used with ObjectFactory and Config to bind
* the value of a particular enum to an Attribute or Config name.
* For example,
* \code
* Ptr<RateErrorModel> model = CreateObjectWithAttributes<RateErrorModel> (
* "ErrorRate", DoubleValue (0.05),
* "ErrorUnit", EnumValue (RateErrorModel::ERROR_UNIT_PACKET));
*
* Config::SetDefault ("ns3::RipNg::SplitHorizon",
* EnumValue (RipNg::NO_SPLIT_HORIZON));
* \endcode
*/
class EnumValue : public AttributeValue
{
public:
EnumValue ();
EnumValue (int v);
void Set (int v);
/**
* Construct from an explicit value.
*
* \param [in] value The value to begin with.
*/
EnumValue (int value);
void Set (int value);
int Get (void) const;
template <typename T>
bool GetAccessor (T &v) const;
bool GetAccessor (T & value) const;
virtual Ptr<AttributeValue> Copy (void) const;
virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
private:
int m_v;
int m_value; //!< The stored integer value.
};
template <typename T>
bool EnumValue::GetAccessor (T &v) const
bool
EnumValue::GetAccessor (T &value) const
{
v = T (m_v);
value = T (m_value);
return true;
}
@@ -64,8 +81,18 @@ class EnumChecker : public AttributeChecker
public:
EnumChecker ();
void AddDefault (int v, std::string name);
void Add (int v, std::string name);
/**
* Add a default value.
* \param [in] value The value.
* \param [in] name Then enum symbol name.
*/
void AddDefault (int value, std::string name);
/**
* Add a new value.
* \param [in] value The value.
* \param [in] name Then enum symbol name.
*/
void Add (int value, std::string name);
virtual bool Check (const AttributeValue &value) const;
virtual std::string GetValueTypeName (void) const;
@@ -76,7 +103,9 @@ public:
private:
friend class EnumValue;
/** Type of container for storing Enum values and symbol names. */
typedef std::list<std::pair<int,std::string> > ValueSet;
/** The stored Enum values and symbol names. */
ValueSet m_valueSet;
};
@@ -86,6 +115,62 @@ Ptr<const AttributeAccessor> MakeEnumAccessor (T1 a1);
template <typename T1, typename T2>
Ptr<const AttributeAccessor> MakeEnumAccessor (T1 a1, T2 a2);
/**
* Make an EnumChecker pre-configured with a set of allowed
* values by name.
*
* Values are normally given as fully qualified enum symbols
* with matching names. For example,
* \c MakeEnumChecker (RipNg::SPLIT_HORIZON, "ns3::RipNg::SplitHorizon");
*
* \see AttributeChecker
*
* \returns The AttributeChecker
* \param [in] v1 An enum value
* \param [in] n1 The corresponding name.
* \param [in] v2 A enum value
* \param [in] n2 The corresponding name.
* \param [in] v3 A enum value
* \param [in] n3 The corresponding name.
* \param [in] v4 A enum value
* \param [in] n4 The corresponding name.
* \param [in] v5 A enum value
* \param [in] n5 The corresponding name.
* \param [in] v6 A enum value
* \param [in] n6 The corresponding name.
* \param [in] v7 A enum value
* \param [in] n7 The corresponding name.
* \param [in] v8 A enum value
* \param [in] n8 The corresponding name.
* \param [in] v9 A enum value
* \param [in] n9 The corresponding name.
* \param [in] v10 An enum value
* \param [in] n10 The enum name.
* \param [in] v11 An enum value
* \param [in] n11 The corresponding name.
* \param [in] v12 A enum value
* \param [in] n12 The corresponding name.
* \param [in] v13 A enum value
* \param [in] n13 The corresponding name.
* \param [in] v14 A enum value
* \param [in] n14 The corresponding name.
* \param [in] v15 A enum value
* \param [in] n15 The corresponding name.
* \param [in] v16 A enum value
* \param [in] n16 The corresponding name.
* \param [in] v17 A enum value
* \param [in] n17 The corresponding name.
* \param [in] v18 A enum value
* \param [in] n18 The corresponding name.
* \param [in] v19 A enum value
* \param [in] n19 The corresponding name.
* \param [in] v20 An enum value
* \param [in] n20 The enum name.
* \param [in] v21 An enum value
* \param [in] n21 The corresponding name.
* \param [in] v22 A enum value
* \param [in] n22 The corresponding name.
*/
Ptr<const AttributeChecker> MakeEnumChecker (int v1, std::string n1,
int v2 = 0, std::string n2 = "",
int v3 = 0, std::string n3 = "",

View File

@@ -27,30 +27,42 @@
namespace ns3 {
// Additional docs for class DoubleValue:
/**
* \ingroup attribute
* \class ns3::IntegerValue
* \brief Hold a signed integer type
*
* \anchor int8_t
* \anchor int16_t
* \anchor int32_t
* \anchor int64_t
* Hold a signed integer type
*
* This class can be used to hold variables of signed integer
* type such as int8_t, int16_t, int32_t, int64_t, or,
* int, etc.
*/
ATTRIBUTE_VALUE_DEFINE_WITH_NAME (int64_t, Integer);
ATTRIBUTE_ACCESSOR_DEFINE (Integer);
template <typename T>
Ptr<const AttributeChecker> MakeIntegerChecker (void);
/**
* Make a checker with a minimum value.
*
* The minimum value is included in the allowed range.
*
* \param [in] min The minimum value.
* \returns The AttributeChecker.
* \see AttributeChecker
*/
template <typename T>
Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min);
/**
* Make a checker with a minimum and a maximum value.
*
* The minimum and maximum values are included in the allowed range.
*
* \param [in] min The minimum value.
* \param [in] max The maximum value.
* \returns The AttributeChecker.
* \see AttributeChecker
*/
template <typename T>
Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min, int64_t max);

View File

@@ -91,6 +91,8 @@ class TimeWithUnit;
* resolution. Therefore the maximum duration of your simulation,
* if you use picoseconds, is 2^64 ps = 2^24 s = 7 months, whereas,
* had you used nanoseconds, you could have run for 584 years.
*
* \see attribute_Time
*/
class Time
{
@@ -913,24 +915,14 @@ inline Time TimeStep (uint64_t ts)
return Time (ts);
}
/**
* \ingroup time
* \class ns3::TimeValue
* \brief Attribute for objects of type ns3::Time
*/
ATTRIBUTE_VALUE_DEFINE (Time);
/**
* Attribute accessor function for Time
* @{
*/
ATTRIBUTE_ACCESSOR_DEFINE (Time);
/**@}*/
/**
* \ingroup time
* \ingroup attribute_Time
* \brief Helper to make a Time checker with bounded range.
* Both limits are inclusive
*
* The minimum and maximum values are included in the allowed range.
*
* \param [in] min Minimum allowed value.
* \param [in] max Maximum allowed value.
@@ -938,12 +930,6 @@ ATTRIBUTE_ACCESSOR_DEFINE (Time);
*/
Ptr<const AttributeChecker> MakeTimeChecker (const Time min, const Time max);
/**
* \ingroup time
* \brief Helper to make an unbounded Time checker.
*
* \return the AttributeChecker
*/
inline
Ptr<const AttributeChecker> MakeTimeChecker (void)
{
@@ -951,9 +937,11 @@ Ptr<const AttributeChecker> MakeTimeChecker (void)
}
/**
* \ingroup time
* \ingroup attribute_Time
* \brief Helper to make a Time checker with a lower bound.
*
* The minimum value is included in the allowed range.
*
* \param [in] min Minimum allowed value.
* \return the AttributeChecker
*/

View File

@@ -165,6 +165,16 @@ protected:
void ConstructSelf (const AttributeConstructionList &attributes);
private:
/**
* Attempt to set the value referenced by the accessor \p spec
* to a valid value according to the \c checker, based on \p value.
*
* \param [in] spec The accessor for the storage location.
* \param [in] checker The checker to use in validating the value.
* \param [in] value The value to attempt to store.
* \returns true if the \c value could be validated by the \p checker
* and written to the storage location.
*/
bool DoSet (Ptr<const AttributeAccessor> spec,
Ptr<const AttributeChecker> checker,
const AttributeValue &value);

View File

@@ -35,6 +35,8 @@ class AttributeValue;
*
* This class can also hold a set of attributes to set
* automatically during the object construction.
*
* \see attribute_ObjectFactory
*/
class ObjectFactory
{
@@ -129,13 +131,6 @@ CreateObjectWithAttributes (std::string n1 = "", const AttributeValue & v1 = Emp
std::string n9 = "", const AttributeValue & v9 = EmptyAttributeValue ());
/**
* \class ns3::ObjectFactoryValue
* \brief hold objects of type ns3::ObjectFactory
*/
ATTRIBUTE_HELPER_HEADER (ObjectFactory);
} // namespace ns3

View File

@@ -27,25 +27,48 @@
namespace ns3 {
/**
* \ingroup attribute_ObjectMap
* ObjectVectorMap is an alias for ObjectPtrContainerValue
*/
typedef ObjectPtrContainerValue ObjectMapValue;
/**
* \ingroup attribute_ObjectMap
* MakeAccessorHelper implementation for ObjectVector.
* \copydetails ns3::DoMakeAccessorHelperOne(U T::*)
*/
template <typename T, typename U>
Ptr<const AttributeAccessor>
MakeObjectMapAccessor (U T::*memberContainer);
MakeObjectMapAccessor (U T::*memberVariable);
// Documentation generated by print-introspected-doxygen.cc
template <typename T>
Ptr<const AttributeChecker> MakeObjectMapChecker (void);
/**
* \ingroup attribute_ObjectMap
* \copydoc ns3::MakeObjectPtrContainerAccessor()
*/
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectMapAccessor (Ptr<U> (T::*get)(INDEX) const,
INDEX (T::*getN)(void) const);
/**
* \ingroup attribute_ObjectMap
* \copydoc ns3::MakeObjectPtrContainerAccessor()
*/
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectMapAccessor (INDEX (T::*getN)(void) const,
Ptr<U> (T::*get)(INDEX) const);
/***************************************************************
* The implementation of the above functions.
***************************************************************/
template <typename T, typename U>
Ptr<const AttributeAccessor>
MakeObjectMapAccessor (U T::*memberVector)

View File

@@ -38,8 +38,10 @@ namespace ns3 {
class ObjectPtrContainerValue : public AttributeValue
{
public:
/** Iterator type for traversing this container. */
typedef std::map<uint32_t, Ptr<Object> >::const_iterator Iterator;
/** Default constructor. */
ObjectPtrContainerValue ();
/**
@@ -66,15 +68,45 @@ public:
private:
friend class ObjectPtrContainerAccessor;
/** The container implementation. */
std::map<uint32_t, Ptr<Object> > m_objects;
};
/**
* \ingroup attribute_ObjectPtrContainer
* Create an AttributeAccessor using a container class indexed get method.
*
* The two versions of this function differ only in argument order.
*
* \tparam T The container class type.
* \tparam U The type of object the get method returns.
* \tparam INDEX The type of the index variable.
* \param [in] get The class method to get a specific instance
* from the container.
* \param [in] getN The class method to return the number of objects
* in the container.
* \return The AttributeAccessor.
*/
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectPtrContainerAccessor (Ptr<U> (T::*get)(INDEX) const,
INDEX (T::*getN)(void) const);
/**
* \ingroup attribute_ObjectPtrContainer
* Create an AttributeAccessor using a container class indexed get method.
*
* The two versions of this function differ only in argument order.
*
* \tparam T The container class type.
* \tparam U The type of object the get method returns.
* \tparam INDEX The type of the index variable.
* \param [in] get The class method to get a specific instance
* from the container.
* \param [in] getN The class method to return the number of objects
* in the container.
* \return The AttributeAccessor.
*/
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectPtrContainerAccessor (INDEX (T::*getN)(void) const,
@@ -83,6 +115,10 @@ MakeObjectPtrContainerAccessor (INDEX (T::*getN)(void) const,
class ObjectPtrContainerChecker : public AttributeChecker
{
public:
/**
* Get the TypeId of the container class type.
* \returns The class TypeId.
*/
virtual TypeId GetItemTypeId (void) const = 0;
};
@@ -91,12 +127,18 @@ Ptr<const AttributeChecker> MakeObjectPtrContainerChecker (void);
} // namespace ns3
/***************************************************************
* The implementation of the above functions.
***************************************************************/
namespace ns3 {
namespace internal {
/** ObjectPtrContainerChecker implementation class. */
template <typename T>
class AnObjectPtrContainerChecker : public ObjectPtrContainerChecker
class ObjectPtrContainerChecker : public ns3::ObjectPtrContainerChecker
{
public:
virtual TypeId GetItemTypeId (void) const {
@@ -131,7 +173,8 @@ public:
} // namespace internal
/** AttributeAccessor implementation for ObjectPtrContainerValue. */
class ObjectPtrContainerAccessor : public AttributeAccessor
{
public:
@@ -140,7 +183,22 @@ public:
virtual bool HasGetter (void) const;
virtual bool HasSetter (void) const;
private:
/**
* Get the number of instances in the container.
*
* \param [in] object The container object.
* \param [out] n The number of instances in the container.
* \returns true if the value could be obtained successfully.
*/
virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const = 0;
/**
* Get an instance from the container, identified by index.
*
* \param [in] object The container object.
* \param [in] i The desired instance index.
* \param [out] index The index retrieved.
* \returns The index requested.
*/
virtual Ptr<Object> DoGet (const ObjectBase *object, uint32_t i, uint32_t *index) const = 0;
};
@@ -184,7 +242,7 @@ MakeObjectPtrContainerAccessor (INDEX (T::*getN)(void) const,
template <typename T>
Ptr<const AttributeChecker> MakeObjectPtrContainerChecker (void)
{
return Create<internal::AnObjectPtrContainerChecker<T> > ();
return Create<internal::ObjectPtrContainerChecker<T> > ();
}

View File

@@ -27,25 +27,49 @@
namespace ns3 {
/**
* \ingroup attribute_ObjectVector
* ObjectVectorValue is an alias for ObjectPtrContainerValue
*/
typedef ObjectPtrContainerValue ObjectVectorValue;
/**
* \ingroup attribute_ObjectVector
* MakeAccessorHelper implementation for ObjectVector.
* \copydetails ns3::DoMakeAccessorHelperOne(U T::*)
*/
template <typename T, typename U>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (U T::*memberContainer);
MakeObjectVectorAccessor (U T::*memberVariable);
// Documentation generated by print-introspected-doxygen.cc
template <typename T>
Ptr<const AttributeChecker> MakeObjectVectorChecker (void);
Ptr<const AttributeChecker>
MakeObjectVectorChecker (void);
/**
* \ingroup attribute_ObjectVector
* \copydoc ns3::MakeObjectPtrContainerAccessor()
*/
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (Ptr<U> (T::*get)(INDEX) const,
INDEX (T::*getN)(void) const);
/**
* \ingroup attribute_ObjectVector
* \copydoc ns3::MakeObjectPtrContainerAccessor()
*/
template <typename T, typename U, typename INDEX>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (INDEX (T::*getN)(void) const,
Ptr<U> (T::*get)(INDEX) const);
/***************************************************************
* The implementation of the above functions.
***************************************************************/
template <typename T, typename U>
Ptr<const AttributeAccessor>
MakeObjectVectorAccessor (U T::*memberVector)

View File

@@ -25,36 +25,55 @@
namespace ns3 {
/**
* \ingroup attribute
*
* \brief hold objects of type Ptr<T>
*/
// Additional docs for class PointerValue:
/** Hold objects of type Ptr<T>. */
class PointerValue : public AttributeValue
{
public:
PointerValue ();
/**
* Construct this PointerValue by referencing an explicit Object.
*
* \param [in] object The object to begin with.
*/
PointerValue (Ptr<Object> object);
/**
* Set the value from by reference an Object.
*
* \param [in] object The object to reference.
*/
void SetObject (Ptr<Object> object);
/**
* Get the Object referenced by the PointerValue.
* \returns The Object.
*/
Ptr<Object> GetObject (void) const;
/**
* Construct this PointerValue by referencing an explicit Object.
*
* \tparam T (implicit) The type of the object.
* \param [in] object The object to begin with.
*/
template <typename T>
PointerValue (const Ptr<T> &object);
PointerValue (const Ptr<T> & object);
/** Cast to an Object of type \c T. */
template <typename T>
void Set (const Ptr<T> &object);
operator Ptr<T> () const;
// Documentation generated by print-introspected-doxygen.cc
template <typename T>
void Set (const Ptr<T> & value);
template <typename T>
Ptr<T> Get (void) const;
template <typename T>
bool GetAccessor (Ptr<T> &v) const;
template <typename T>
operator Ptr<T> () const;
bool GetAccessor (Ptr<T> &value) const;
virtual Ptr<AttributeValue> Copy (void) const;
virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
@@ -68,6 +87,11 @@ private:
class PointerChecker : public AttributeChecker
{
public:
/**
* Get the TypeId of the base type.
* \returns The base TypeId.
*/
virtual TypeId GetPointeeTypeId (void) const = 0;
};
template <typename T>
@@ -80,8 +104,9 @@ namespace ns3 {
namespace internal {
/** PointerChecker implementation. */
template <typename T>
class APointerChecker : public PointerChecker
class PointerChecker : public ns3::PointerChecker
{
virtual bool Check (const AttributeValue &val) const {
const PointerValue *value = dynamic_cast<const PointerValue *> (&val);
@@ -177,7 +202,7 @@ template <typename T>
Ptr<AttributeChecker>
MakePointerChecker (void)
{
return Create<internal::APointerChecker<T> > ();
return Create<internal::PointerChecker<T> > ();
}

View File

@@ -25,11 +25,9 @@
namespace ns3 {
// Additional docs for class DoubleValue:
/**
* \ingroup attribute
*
* \class ns3::StringValue
* \brief hold variables of type string
* Hold variables of type string
*
* This class can be used to hold variables of type string,
* that is, either char * or std::string.

View File

@@ -42,10 +42,11 @@ class ObjectBase;
* - the set of accessible constructors in the subclass
* - the set of 'attributes' accessible in the subclass
*
* \see attribute_TypeId
*
* \internal
* See the discussion in IidManager about hash chaining of TypeId's.
*
*/
*/
class TypeId
{
public:

View File

@@ -27,16 +27,9 @@
namespace ns3 {
// Additional docs for class DoubleValue:
/**
* \ingroup attribute
*
* \class ns3::UintegerValue
* \brief Hold an unsigned integer type
*
* \anchor uint8_t
* \anchor uint16_t
* \anchor uint32_t
* \anchor uint64_t
* Hold an unsigned integer type.
*
* This class can be used to hold variables of unsigned integer
* type such as uint8_t, uint16_t, uint32_t, uint64_t, or,
@@ -49,9 +42,28 @@ ATTRIBUTE_ACCESSOR_DEFINE (Uinteger);
template <typename T>
Ptr<const AttributeChecker> MakeUintegerChecker (void);
/**
* Make a checker with a minimum value.
*
* The minimum value is included in the allowed range.
*
* \param [in] min The minimum value.
* \returns The AttributeChecker.
* \see AttributeChecker
*/
template <typename T>
Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min);
/**
* Make a checker with a minimum and a maximum value.
*
* The minimum and maximum values are included in the allowed range.
*
* \param [in] min The minimum value.
* \param [in] max The maximum value.
* \returns The AttributeChecker.
* \see AttributeChecker
*/
template <typename T>
Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min, uint64_t max);

View File

@@ -27,6 +27,7 @@ namespace ns3 {
/**
* \brief a 3d vector
* \see attribute_Vector3D
*/
class Vector3D
{
@@ -55,10 +56,15 @@ public:
* z coordinate of vector
*/
double z;
friend double CalculateDistance (const Vector3D &a, const Vector3D &b);
friend std::ostream &operator << (std::ostream &os, const Vector3D &vector);
friend std::istream &operator >> (std::istream &is, Vector3D &vector);
};
/**
* \brief a 3d vector
* \brief a 2d vector
* \see attribute_Vector2D
*/
class Vector2D
{
@@ -82,6 +88,10 @@ public:
* y coordinate of vector
*/
double y;
friend double CalculateDistance (const Vector2D &a, const Vector2D &b);
friend std::ostream &operator << (std::ostream &os, const Vector2D &vector);
friend std::istream &operator >> (std::istream &is, Vector2D &vector);
};
/**
@@ -90,7 +100,6 @@ public:
* \returns the cartesian distance between a and b.
*/
double CalculateDistance (const Vector3D &a, const Vector3D &b);
/**
* \param a one point
* \param b another point
@@ -98,28 +107,91 @@ double CalculateDistance (const Vector3D &a, const Vector3D &b);
*/
double CalculateDistance (const Vector2D &a, const Vector2D &b);
/**
* \class ns3::Vector3DValue
* \brief hold objects of type ns3::Vector3D
*/
/**
* \class ns3::Vector2DValue
* \brief hold objects of type ns3::Vector2D
*/
ATTRIBUTE_HELPER_HEADER (Vector3D);
ATTRIBUTE_HELPER_HEADER (Vector2D);
/**
* Output streamer.
*
* Vectors are written as "x:y:z".
*
* \param [in,out] os The stream.
* \param [in] vector The vector to stream
* \return The stream.
*/
std::ostream &operator << (std::ostream &os, const Vector3D &vector);
std::istream &operator >> (std::istream &is, Vector3D &vector);
/**
* Output streamer.
*
* Vectors are written as "x:y".
*
* \param [in,out] os The stream.
* \param [in] vector The vector to stream
* \return The stream.
*/
std::ostream &operator << (std::ostream &os, const Vector2D &vector);
/**
* Input streamer.
*
* Vectors are expected to be in the form "x:y:z".
*
* \param [in,out] is The stream.
* \param [in] vector The vector.
* \returns The stream.
*/
std::istream &operator >> (std::istream &is, Vector3D &vector);
/**
* Input streamer.
*
* Vectors are expected to be in the form "x:y".
*
* \param [in,out] is The stream.
* \param [in] vector The vector.
* \returns The stream.
*/
std::istream &operator >> (std::istream &is, Vector2D &vector);
// for compatibility with mobility models
/**
* \relates Vector3D
* Vector alias typedef for compatibility with mobility models
*/
typedef Vector3D Vector;
/**
* \ingroup attribute_Vector3D
* Vector alias typedef for compatibility with mobility models
*/
typedef Vector3DValue VectorValue;
/**
* \ingroup attribute_Vector3D
* Vector alias typedef for compatibility with mobility models
*/
typedef Vector3DChecker VectorChecker;
// Document these by hand so they go in group attribute_Vector3D
/**
* \ingroup attribute_Vector3D
* \fn ns3::Ptr<const ns3::AttributeAccessor> ns3::MakeVectorAccessor (T1 a1)
* \copydoc ns3::MakeAccessorHelper(T1)
* \see AttributeAccessor
*/
/**
* \ingroup attribute_Vector3D
* \fn ns3::Ptr<const ns3::AttributeAccessor> ns3::MakeVectorAccessor (T1 a1, T2 a2)
* \copydoc ns3::MakeAccessorHelper(T1,T2)
* \see AttributeAccessor
*/
ATTRIBUTE_ACCESSOR_DEFINE (Vector);
Ptr<const AttributeChecker> MakeVectorChecker (void);
/**
* \ingroup attribute_Vector3D
* \returns The AttributeChecker.
* \see AttributeChecker
*/
Ptr<const AttributeChecker> MakeVectorChecker (void);
} // namespace ns3

View File

@@ -37,6 +37,10 @@
using namespace ns3;
/**
* Test class for TracedValue callbacks.
* \see attribute_ValueClassTest
*/
class ValueClassTest
{
public:

View File

@@ -29,7 +29,7 @@ namespace ns3 {
namespace dot11s {
/**
* \brief a IEEE 802.11s Mesh ID 7.3.287 of 802.11s draft 3.0
*
* \see attribute_IeMeshId
*/
class IeMeshId : public WifiInformationElement
{

View File

@@ -29,6 +29,7 @@ namespace ns3 {
/**
* \ingroup mobility
* \brief a 3d box
* \see attribute_Box
*/
class Box
{
@@ -102,11 +103,6 @@ public:
std::ostream &operator << (std::ostream &os, const Box &box);
std::istream &operator >> (std::istream &is, Box &box);
/**
* \class ns3::BoxValue
* \brief hold objects of type ns3::Box
*/
ATTRIBUTE_HELPER_HEADER (Box);
} // namespace ns3

View File

@@ -29,6 +29,7 @@ namespace ns3 {
/**
* \ingroup mobility
* \brief a 2d rectangle
* \see attribute_Rectangle
*/
class Rectangle
{

View File

@@ -30,6 +30,7 @@ namespace ns3 {
/**
* \ingroup mobility
* \brief a (time, location) pair.
* \see attribute_Waypoint
*/
class Waypoint
{

View File

@@ -32,6 +32,8 @@ namespace ns3 {
/**
* \ingroup network
* \defgroup address Address
*
* Network Address abstractions, including MAC, IPv4 and IPv6.
*/
/**
* \ingroup address
@@ -82,6 +84,8 @@ namespace ns3 {
* return type;
* }
* \endcode
*
* \see attribute_Address
*/
class Address
{
@@ -271,12 +275,7 @@ private:
uint8_t m_data[MAX_SIZE]; //!< The address value
};
/**
* \class ns3::AddressValue
* \brief hold objects of type ns3::Address
*/
ATTRIBUTE_HELPER_HEADER (Address); //!< Macro to make help make class an ns-3 attribute
ATTRIBUTE_HELPER_HEADER (Address);
bool operator == (const Address &a, const Address &b);
bool operator != (const Address &a, const Address &b);

View File

@@ -41,32 +41,48 @@ namespace ns3 {
* Allows for natural and familiar use of data rates. Allows construction
* from strings, natural multiplication e.g.:
* \code
* DataRate x("56kbps");
* double nBits = x*ns3::Seconds(19.2);
* uint32_t nBytes = 20;
* double txtime = x.CalclulateTxTime(nBytes);
* DataRate x("56kbps");
* double nBits = x*ns3::Seconds(19.2);
* uint32_t nBytes = 20;
* double txtime = x.CalclulateTxTime(nBytes);
* \endcode
* This class also supports the regular comparison operators <, >, <=, >=, ==,
* and !=
* This class also supports the regular comparison operators \c <, \c >,
* \c <=, \c >=, \c ==, and \c !=
*
* Conventions used:
* "b" stands for bits, "B" for bytes (8 bits) \n
* "k" stands for 1000, "K" also stands for 1000, "Ki" stands for 1024 \n
* "M" stand for 1000000, "Mib" stands for 1024 kibibits, or 1048576 bits \n
* "G" stand for 10^9, "Gib" stands for 1024 mebibits \n
* whitespace is allowed but not required between the numeric value and units
* Data rate specifiers consist of
* * A numeric value,
* * An optional multiplier prefix and
* * A unit.
*
* Whitespace is allowed but not required between the numeric value and
* multipler or unit.
*
* Supported multiplier prefixes:
*
* | Prefix | Value |
* | :------- | ----------: |
* | "k", "K" | 1000 |
* | "Ki" | 1024 |
* | "M" | 1000000 |
* | "Mi" | 1024 Ki |
* | "G" | 10^9 |
* | "Gi " | 1024 Mi |
*
* Supported unit strings:
* bps, b/s, Bps, B/s \n
* kbps, kb/s, Kbps, Kb/s, kBps, kB/s, KBps, KB/s, Kib/s, KiB/s \n
* Mbps, Mb/s, MBps, MB/s, Mib/s, MiB/s \n
* Gbps, Gb/s, GBps, GB/s, Gib/s, GiB/s \n
*
*
* | Symbol | Meaning |
* | :------- | :---------- |
* | "b" | bits |
* | "B" | 8-bit bytes |
* | "s", "/s"| per second |
*
* Examples:
* "56kbps" = 56,000 bits/s \n
* "128 kb/s" = 128,000 bits/s \n
* "8Kib/s" = 1 KiB/s = 8192 bits/s \n
* "1kB/s" = 8000 bits/s
* * "56kbps" = 56,000 bits/s
* * "128 kb/s" = 128,000 bits/s
* * "8Kib/s" = 1 KiB/s = 8192 bits/s
* * "1kB/s" = 8000 bits/s
*
* \see attribute_DataRate
*/
class DataRate
{
@@ -200,13 +216,7 @@ std::ostream &operator << (std::ostream &os, const DataRate &rate);
*/
std::istream &operator >> (std::istream &is, DataRate &rate);
/**
* \class ns3::DataRateValue
* \brief hold objects of type ns3::DataRate
*/
ATTRIBUTE_HELPER_HEADER (DataRate); //!< Macro to make help make data-rate an ns-3 attribute
ATTRIBUTE_HELPER_HEADER (DataRate);
/**

View File

@@ -34,6 +34,8 @@ class Ipv4Mask;
* \ingroup address
*
* \brief Ipv4 addresses are stored in host order in this class.
*
* \see attribute_Ipv4Address
*/
class Ipv4Address {
public:
@@ -218,6 +220,8 @@ private:
* The constructor takes arguments according to a few formats.
* Ipv4Mask ("255.255.255.255"), Ipv4Mask ("/32"), and Ipv4Mask (0xffffffff)
* are all equivalent.
*
* \see attribute_Ipv4Mask
*/
class Ipv4Mask {
public:

View File

@@ -42,6 +42,7 @@ class Mac64Address;
* \class Ipv6Address
* \brief Describes an IPv6 address.
* \see Ipv6Prefix
* \see attribute_Ipv6Address
*/
class Ipv6Address
{
@@ -383,6 +384,7 @@ private:
* \class Ipv6Prefix
* \brief Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask.
* \see Ipv6Address
* \see attribute_Ipv6Prefix
*/
class Ipv6Prefix
{

View File

@@ -35,6 +35,8 @@ class Address;
* \ingroup address
*
* This class can contain 16 bit addresses.
*
* \see attribute_Mac16Address
*/
class Mac16Address
{

View File

@@ -37,6 +37,8 @@ class Address;
* \brief an EUI-48 address
*
* This class can contain 48 bit IEEE addresses.
*
* \see attribute_Mac48Address
*/
class Mac48Address
{

View File

@@ -37,6 +37,8 @@ class Address;
* \brief an EUI-64 address
*
* This class can contain 64 bit IEEE addresses.
*
* \see attribute_Mac64Address
*/
class Mac64Address
{

View File

@@ -251,6 +251,8 @@ private:
* \ingroup uan
*
* Container for UanTxModes.
*
* \see attribute_UanModesList
*/
class UanModesList
{

View File

@@ -45,6 +45,8 @@ class VendorSpecificContentManager;
* Normally the value is assigned by IEEE and the length of field is
* either 24 bits or 36 bits.
* For more, see IEEE802.11p-2010 section 7.3.1.31 and 7.4.5
*
* \see attribute_OrganizationIdentifier
*/
class OrganizationIdentifier
{

View File

@@ -38,6 +38,8 @@ namespace ns3 {
* \ingroup wifi
*
* This class knows how to serialise and deserialise the Ht Capabilities Information Element
*
* \see attribute_HtCapabilities
*/
class HtCapabilities: public WifiInformationElement
{

View File

@@ -31,6 +31,8 @@ namespace ns3 {
* \ingroup wifi
*
* The IEEE 802.11 SSID Information Element
*
* \see attribute_Ssid
*/
class Ssid : public WifiInformationElement
{

View File

@@ -87,6 +87,8 @@ enum WifiCodeRate
* to lookup in a global array the characteristics of the
* associated transmission mode. It is thus extremely cheap to
* keep a WifiMode variable around.
*
* \see attribute_WifiMode
*/
class WifiMode
{

View File

@@ -41,18 +41,23 @@ NS_LOG_COMPONENT_DEFINE ("PrintIntrospectedDoxygen");
namespace
{
std::string anchor; ///< hyperlink anchor
std::string argument; ///< function argument
std::string boldStart; ///< start of bold span
std::string boldStop; ///< end of bold span
std::string breakBoth; ///< linebreak
std::string breakHtmlOnly; ///< linebreak for html output only
std::string breakTextOnly; ///< linebreak for text output only
std::string brief; ///< brief tag
std::string classStart; ///< start of a class
std::string classStop; ///< end of a class
std::string codeWord; ///< format next word as source code
std::string commentStart; ///< start of code comment
std::string commentStop; ///< end of code comment
std::string copyDoc; ///< copy (or refer) to docs elsewhere
std::string flagSpanStart; ///< start of Attribute flag value
std::string flagSpanStop; ///< end of Attribute flag value
std::string functionStart; ///< start of a class/function
std::string functionStop; ///< end of a class/function
std::string functionStart; ///< start of a method/function
std::string functionStop; ///< end of a method/function
std::string headingStart; ///< start of section heading (h3)
std::string headingStop; ///< end of section heading (h3)
std::string indentHtmlOnly; ///< small indent
@@ -62,9 +67,12 @@ namespace
std::string listStop; ///< end unordered list
std::string page; ///< start a separate page
std::string reference; ///< reference tag
std::string returns; ///< the return value
std::string sectionStart; ///< start of a section or group
std::string seeAlso; ///< Reference to other docs
std::string subSectionStart; ///< start a new subsection
std::string temporaryCharacter; ///< "%" placeholder
std::string variable; ///< variable or class member
} // anonymous namespace
@@ -72,7 +80,7 @@ namespace
/**
* Initialize the markup strings, for either doxygen or text.
*
* \param [in] outpuText true for text output, false for doxygen output.
* \param [in] outputText true for text output, false for doxygen output.
*/
void
SetMarkup (bool outputText)
@@ -81,14 +89,19 @@ SetMarkup (bool outputText)
if (outputText)
{
anchor = "";
argument = " Arg: ";
boldStart = "";
boldStop = "";
breakBoth = "\n";
breakHtmlOnly = "";
breakTextOnly = "\n";
brief = "";
classStart = "";
classStop = "\n\n";
codeWord = " ";
commentStart = "===============================================================\n";
commentStop = "";
copyDoc = " See: ";
flagSpanStart = "";
flagSpanStop = "";
functionStart = "";
@@ -101,25 +114,33 @@ SetMarkup (bool outputText)
listStop = "";
listLineStart = " * ";
listLineStop = "";
reference = "";
reference = " ";
returns = " Returns: ";
sectionStart = "Section ";
seeAlso = " See: ";
subSectionStart = "Subsection ";
temporaryCharacter = "";
variable = "Variable: ";
}
else
{
anchor = "\\anchor ";
argument = "\\param ";
boldStart = "<b>";
boldStop = "</b>";
breakBoth = "<br>";
breakHtmlOnly = "<br>";
breakTextOnly = "";
brief = "\\brief ";
classStart = "\\class ";
classStop = "";
codeWord = "\\p ";
commentStart = "/*!\n";
commentStop = "*/\n";
copyDoc = "\\copydoc ";
flagSpanStart = "<span class=\"mlabel\">";
flagSpanStop = "</span>";
functionStart = "\\class ";
functionStart = "\\fn ";
functionStop = "";
headingStart = "<h3>";
headingStop = "</h3>";
@@ -129,14 +150,21 @@ SetMarkup (bool outputText)
listStop = "</ul>";
listLineStart = "<li>";
listLineStop = "</li>";
reference = "\\ref ";
reference = " \\ref ";
returns = "\\returns ";
sectionStart = "\\ingroup ";
seeAlso = "\\see ";
subSectionStart = "\\addtogroup ";
temporaryCharacter = "%";
variable = "\\var ";
}
} // SetMarkup ()
/***************************************************************
* Docs for a single TypeId
***************************************************************/
/**
* Print direct Attributes for this TypeId.
*
@@ -170,14 +198,15 @@ PrintAttributesTid (std::ostream &os, const TypeId tid)
os << " "
<< listLineStart
<< "Underlying type: ";
if ( (info.checker->GetValueTypeName () != "ns3::EnumValue")
&& (info.checker->GetUnderlyingTypeInformation () != "std::string")
)
std::string valType = info.checker->GetValueTypeName ();
std::string underType = info.checker->GetUnderlyingTypeInformation ();
if ((valType != "ns3::EnumValue") && (underType != "std::string"))
{
// Two indirect cases to handle
// Indirect cases to handle
bool handled = false;
if (info.checker->GetValueTypeName () == "ns3::PointerValue")
if (valType == "ns3::PointerValue")
{
const PointerChecker *ptrChecker =
dynamic_cast<const PointerChecker *> (PeekPointer (info.checker));
@@ -189,7 +218,7 @@ PrintAttributesTid (std::ostream &os, const TypeId tid)
handled = true;
}
}
else if (info.checker->GetValueTypeName () == "ns3::ObjectPtrContainerValue")
else if (valType == "ns3::ObjectPtrContainerValue")
{
const ObjectPtrContainerChecker * ptrChecker =
dynamic_cast<const ObjectPtrContainerChecker *> (PeekPointer (info.checker));
@@ -201,9 +230,35 @@ PrintAttributesTid (std::ostream &os, const TypeId tid)
handled = true;
}
}
// Helper to match first part of string
class StringBeginMatcher
{
public:
StringBeginMatcher (const std::string s)
: m_string (s) { };
bool operator () (const std::string t)
{
std::size_t pos = m_string.find (t);
return pos == 0;
};
private:
std::string m_string;
};
StringBeginMatcher match (underType);
if ( match ("bool") || match ("double") ||
match ("int8_t") || match ("uint8_t") ||
match ("int16_t") || match ("uint16_t") ||
match ("int32_t") || match ("uint32_t") ||
match ("int64_t") || match ("uint64_t")
)
{
os << underType;
handled = true;
}
if (! handled)
{
os << reference << info.checker->GetUnderlyingTypeInformation ();
os << reference << underType;
}
}
os << listLineStop << std::endl;
@@ -237,7 +292,7 @@ PrintAttributesTid (std::ostream &os, const TypeId tid)
}
os << listStop << std::endl;
}
} // PrintAttributesTid ()
/**
@@ -314,7 +369,7 @@ PrintTraceSourcesTid (std::ostream & os, const TypeId tid)
os << listLineStop << std::endl;
}
os << listStop << std::endl;
}
} // PrintTraceSourcesTid ()
/**
@@ -379,48 +434,12 @@ void PrintSize (std::ostream & os, const TypeId tid)
<< " of this type is " << tid.GetSize ()
<< " bytes (on a " << arch << "-bit architecture)."
<< std::endl;
}
} // PrintSize ()
/**
* Print the list of all Trace sources.
*
* \param [in,out] os The output stream.
*/
void
PrintAllTraceSources (std::ostream & os)
{
NS_LOG_FUNCTION_NOARGS ();
os << commentStart << page << "TraceSourceList All TraceSources\n"
<< std::endl;
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i)
{
TypeId tid = TypeId::GetRegistered (i);
if (tid.GetTraceSourceN () == 0 ||
tid.MustHideFromDocumentation ())
{
continue;
}
os << boldStart << tid.GetName () << boldStop << breakHtmlOnly
<< std::endl;
os << listStart << std::endl;
for (uint32_t j = 0; j < tid.GetTraceSourceN (); ++j)
{
struct TypeId::TraceSourceInformation info = tid.GetTraceSource(j);
os << listLineStart
<< boldStart << info.name << boldStop
<< ": " << info.help
<< listLineStop
<< std::endl;
}
os << listStop << std::endl;
}
os << commentStop << std::endl;
} // PrintAllTraceSources ()
/***************************************************************
* Lists of All things
***************************************************************/
/**
* Print the list of all Attributes.
@@ -433,6 +452,11 @@ PrintAllAttributes (std::ostream & os)
NS_LOG_FUNCTION_NOARGS ();
os << commentStart << page << "AttributeList All Attributes\n"
<< std::endl;
os << "This is a list of all" << reference << "attribute by class. "
<< "For more information see the" << reference << "attribute "
<< "section of this API documentation and the Attributes sections "
<< "in the Tutorial and Manual.\n"
<< std::endl;
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i)
{
@@ -473,6 +497,8 @@ PrintAllGlobals (std::ostream & os)
NS_LOG_FUNCTION_NOARGS ();
os << commentStart << page << "GlobalValueList All GlobalValues\n"
<< std::endl;
os << "This is a list of all" << reference << "ns3::GlobalValue instances.\n"
<< std::endl;
os << listStart << std::endl;
for (GlobalValue::Iterator i = GlobalValue::Begin ();
@@ -509,6 +535,8 @@ PrintAllLogComponents (std::ostream & os)
NS_LOG_FUNCTION_NOARGS ();
os << commentStart << page << "LogComponentList All LogComponents\n"
<< std::endl;
os << "This is a list of all" << reference << "ns3::LogComponent instances.\n"
<< std::endl;
os << listStart << std::endl;
LogComponent::ComponentList * logs = LogComponent::GetComponentList ();
@@ -516,7 +544,8 @@ PrintAllLogComponents (std::ostream & os)
for (it = logs->begin (); it != logs->end (); ++it)
{
std::string file = it->second->File ();
if (file.find ("../") == 0)
// Strip leading "../" related to depth in build directory
while (file.find ("../") == 0)
{
file = file.substr (3);
}
@@ -528,9 +557,377 @@ PrintAllLogComponents (std::ostream & os)
}
os << listStop << std::endl;
os << commentStop << std::endl;
} // PrintAllLogComponents
} // PrintAllLogComponents ()
/**
* Print the list of all Trace sources.
*
* \param [in,out] os The output stream.
*/
void
PrintAllTraceSources (std::ostream & os)
{
NS_LOG_FUNCTION_NOARGS ();
os << commentStart << page << "TraceSourceList All TraceSources\n"
<< std::endl;
os << "This is a list of all" << reference << "tracing sources. "
<< "For more information see the " << reference << "tracing "
<< "section of this API documentation and the Tracing sections "
<< "in the Tutorial and Manual.\n"
<< std::endl;
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i)
{
TypeId tid = TypeId::GetRegistered (i);
if (tid.GetTraceSourceN () == 0 ||
tid.MustHideFromDocumentation ())
{
continue;
}
os << boldStart << tid.GetName () << boldStop << breakHtmlOnly
<< std::endl;
os << listStart << std::endl;
for (uint32_t j = 0; j < tid.GetTraceSourceN (); ++j)
{
struct TypeId::TraceSourceInformation info = tid.GetTraceSource(j);
os << listLineStart
<< boldStart << info.name << boldStop
<< ": " << info.help
<< listLineStop
<< std::endl;
}
os << listStop << std::endl;
}
os << commentStop << std::endl;
} // PrintAllTraceSources ()
/***************************************************************
* Docs for Attribute classes
***************************************************************/
/**
* Print the section definition for an AttributeValue.
*
* In doxygen form this will print a comment block with
* \verbatim
* \ingroup attribute
* \defgroup attribute_<name>Value <name>Value
* \endverbatim
*
* \param [in,out] os The output stream.
* \param [in] name The base name of the resulting AttributeValue type.
* \param [in] seeBase Print a "see also" pointing to the base class.
*/
void
PrintAttributeValueSection (std::ostream & os,
const std::string & name,
const bool seeBase = true)
{
NS_LOG_FUNCTION (name);
std::string section = "attribute_" + name;
// \ingroup attribute
// \defgroup attribute_<name>Value <name> Attribute
os << commentStart << sectionStart << "attribute\n"
<< subSectionStart << "attribute_" << name << " "
<< name << " Attribute\n"
<< "Attribute implementation for " << name << "\n";
if (seeBase)
{
// Some classes don't live in ns3::. Yuck
if (name != "IeMeshId")
{
os << seeAlso << "ns3::" << name << "\n";
}
else
{
os << seeAlso << "ns3::dot11s::" << name << "\n";
}
}
os << commentStop;
} // PrintAttributeValueSection ()
/**
* Print the AttributeValue documentation for a class.
*
* This will print documentation for the \p <name>Value class and methods.
*
* \param [in,out] os The output stream.
* \param [in] name The token to use in defining the accessor name.
* \param [in] type The underlying type name.
* \param [in] header The header file which contains this declaration.
*/
void
PrintAttributeValueWithName (std::ostream & os,
const std::string & name,
const std::string & type,
const std::string & header)
{
NS_LOG_FUNCTION (name << type << header);
std::string sectAttr = sectionStart + "attribute_" + name;
// \ingroup attribute_<name>Value
// \class ns3::<name>Value "header"
std::string valClass = name + "Value";
std::string qualClass = " ns3::" + valClass;
os << commentStart << sectAttr << std::endl;
os << classStart << qualClass << " \"" << header << "\"" << std::endl;
os << "AttributeValue implementation for " << name << "." << std::endl;
os << seeAlso << "AttributeValue" << std::endl;
os << commentStop;
// Copy ctor: <name>Value::<name>Value
os << commentStart
<< functionStart << name
<< qualClass << "::" << valClass;
if ( (name == "EmptyAttribute") ||
(name == "ObjectPtrContainer") )
{
// Just default constructors.
os << "(void)\n";
}
else
{
// Copy constructors
os << "(const " << type << " & value)\n"
<< "Copy constructor.\n"
<< argument << "[in] value The " << name << " value to copy.\n";
}
os << commentStop;
// <name>Value::Get (void) const
os << commentStart
<< functionStart << type
<< qualClass << "::Get (void) const\n"
<< returns << "The " << name << " value.\n"
<< commentStop;
// <name>Value::GetAccessor (T & value) const
os << commentStart
<< functionStart << "bool"
<< qualClass << "::GetAccessor (T & value) const\n"
<< "Access the " << name << " value as type " << codeWord << "T.\n"
<< argument << "[out] value The " << name << " value, as type "
<< codeWord << "T.\n"
<< returns << "true.\n"
<< commentStop;
// <name>Value::Set (const name & value)
if (type != "Callback") // Yuck
{
os << commentStart
<< functionStart << "void"
<< qualClass << "::Set (const " << type << " & value)\n"
<< "Set the value.\n"
<< argument << "[in] value The value to adopt.\n"
<< commentStop;
}
// <name>Value::m_value
os << commentStart
<< variable << type
<< qualClass << "::m_value\n"
<< "The stored " << name << " instance.\n"
<< commentStop
<< std::endl;
} // PrintAttributeValueWithName ()
/**
* Print the AttributeValue MakeAccessor documentation for a class.
*
* This will print documentation for the \p Make<name>Accessor functions.
*
* \param [in,out] os The output stream.
* \param [in] name The token to use in defining the accessor name.
*/
void
PrintMakeAccessors (std::ostream & os, const std::string & name)
{
NS_LOG_FUNCTION (name);
std::string sectAttr = sectionStart + "attribute_" + name + "\n";
std::string make = "ns3::Make" + name + "Accessor ";
// \ingroup attribute_<name>Value
// Make<name>Accessor (T1 a1)
os << commentStart << sectAttr
<< functionStart << "ns3::Ptr<const ns3::AttributeAccessor> "
<< make << "(T1 a1)\n"
<< copyDoc << "ns3::MakeAccessorHelper(T1)\n"
<< seeAlso << "AttributeAccessor\n"
<< commentStop;
// \ingroup attribute_<name>Value
// Make<name>Accessor (T1 a1)
os << commentStart << sectAttr
<< functionStart << "ns3::Ptr<const ns3::AttributeAccessor> "
<< make << "(T1 a1, T2 a2)\n"
<< copyDoc << "ns3::MakeAccessorHelper(T1,T2)\n"
<< seeAlso << "AttributeAccessor\n"
<< commentStop;
} // PrintMakeAccessors ()
/**
* Print the AttributeValue MakeChecker documentation for a class.
*
* This will print documentation for the \p Make<name>Checker function.
*
* \param [in,out] os The output stream.
* \param [in] name The token to use in defining the accessor name.
* \param [in] header The header file which contains this declaration.
*/
void
PrintMakeChecker (std::ostream & os,
const std::string & name,
const std::string & header)
{
NS_LOG_FUNCTION (name << header);
std::string sectAttr = sectionStart + "attribute_" + name + "\n";
std::string make = "ns3::Make" + name + "Checker ";
// \ingroup attribute_<name>Value
// class <name>Checker
os << commentStart << sectAttr << std::endl;
os << classStart << " ns3::" << name << "Checker"
<< " \"" << header << "\"" << std::endl;
os << "AttributeChecker implementation for " << name << "Value." << std::endl;
os << seeAlso << "AttributeChecker" << std::endl;
os << commentStop;
// \ingroup attribute_<name>Value
// Make<name>Checker (void)
os << commentStart << sectAttr
<< functionStart << "ns3::Ptr<const ns3::AttributeChecker> "
<< make << "(void)\n"
<< returns << "The AttributeChecker.\n"
<< seeAlso << "AttributeChecker\n"
<< commentStop;
} // PrintMakeChecker ()
/**Descriptor for an AttributeValue. */
typedef struct {
const std::string m_name; //!< The base name of the resulting AttributeValue type.
const std::string m_type; //!< The name of the underlying type.
const bool m_seeBase; //!< Print a "see also" pointing to the base class.
const std::string m_header; //!< The header file name.
} AttributeDescriptor;
/**
* Print documentation corresponding to use of the
* ATTRIBUTE_HELPER_HEADER macro or
* ATTRIBUTE_VALUE_DEFINE_WITH_NAME macro.
*
* \param [in,out] os The output stream.
* \param [in] attr The AttributeDescriptor.
*/
void
PrintAttributeHelper (std::ostream & os,
const AttributeDescriptor & attr)
{
NS_LOG_FUNCTION (attr.m_name << attr.m_type << attr.m_seeBase <<
attr.m_header);
PrintAttributeValueSection (os, attr.m_name, attr.m_seeBase);
PrintAttributeValueWithName (os, attr.m_name, attr.m_type, attr.m_header);
PrintMakeAccessors (os, attr.m_name);
PrintMakeChecker (os, attr.m_name, attr.m_header);
} // PrintAttributeHelper ()
/**
* Print documentation for Attribute implementations.
*/
void
PrintAttributeImplementations (std::ostream & os)
{
NS_LOG_FUNCTION_NOARGS ();
const AttributeDescriptor attributes [] =
{
// Users of ATTRIBUTE_HELPER_HEADER
//
{ "Address", "Address", true, "address.h" },
{ "Box", "Box", true, "box.h" },
{ "DataRate", "DataRate", true, "data-rate.h" },
{ "HtCapabilities", "HtCapabilities", true, "ht-capabilities.h" },
{ "IeMeshId", "IeMeshId", true, "id-dot11s-id.h" },
{ "Ipv4Address", "Ipv4Address", true, "ipv4-address.h" },
{ "Ipv4Mask", "Ipv4Mask", true, "ipv4-address.h" },
{ "Ipv6Address", "Ipv6Address", true, "ipv6-address.h" },
{ "Ipv6Prefix", "Ipv6Prefix", true, "ipv6-address.h" },
{ "Mac16Address", "Mac16Address", true, "mac16-address.h" },
{ "Mac48Address", "Mac48Address", true, "mac48-address.h" },
{ "Mac64Address", "Mac64Address", true, "mac64-address.h" },
{ "ObjectFactory", "ObjectFactory", true, "object-factory.h" },
{ "OrganizationIdentifier",
"OrganizationIdentifier",
true, "vendor-specific-action.h" },
{ "Rectangle", "Rectangle", true, "rectangle.h" },
{ "Ssid", "Ssid", true, "ssid.h" },
{ "TypeId", "TypeId", true, "type-id.h" },
{ "UanModesList", "UanModesList", true, "uan-tx-mode.h" },
{ "ValueClassTest", "ValueClassTest", false, "" /* outside ns3 */ },
{ "Vector2D", "Vector2D", true, "vector.h" },
{ "Vector3D", "Vector3D", true, "vector.h" },
{ "Waypoint", "Waypoint", true, "waypoint.h" },
{ "WifiMode", "WifiMode", true, "wifi-mode.h" },
// All three (Value, Access and Checkers) defined, but custom
{ "Boolean", "Boolean", false, "boolean.h" },
{ "Callback", "Callback", true, "callback.h" },
{ "Double", "double", false, "double.h" },
{ "Enum", "int", false, "enum.h" },
{ "Integer", "int64_t", false, "integer.h" },
{ "Pointer", "Pointer", false, "pointer.h" },
{ "RandomVariable", "RandomVariable", true, "random-variable.h" },
{ "String", "std::string", false, "string.h" },
{ "Time", "Time", true, "nstime.h" },
{ "Uinteger", "uint64_t", false, "uinteger.h" },
{ "", "", false, "last placeholder" }
};
int i = 0;
while (attributes[i].m_name != "")
{
PrintAttributeHelper (os, attributes[i]);
++i;
}
// Special cases
PrintAttributeValueSection (os, "EmptyAttribute", false);
PrintAttributeValueWithName (os, "EmptyAttribute", "EmptyAttribute",
"attribute.h");
PrintAttributeValueSection (os, "ObjectPtrContainer", false);
PrintAttributeValueWithName (os, "ObjectPtrContainer", "ObjectPtrContainer", "object-ptr-container.h");
PrintMakeChecker (os, "ObjectPtrContainer", "object-ptr-container.h");
PrintAttributeValueSection (os, "ObjectVector", false);
PrintMakeAccessors (os, "ObjectVector");
PrintMakeChecker (os, "ObjectVector", "object-vector.h");
PrintAttributeValueSection (os, "ObjectMap", false);
PrintMakeAccessors (os, "ObjectMap");
PrintMakeChecker (os, "ObjectMap", "object-map.h");
} // PrintAttributeImplementations ()
/***************************************************************
* Aggregation and configuration paths
***************************************************************/
/**
* Gather aggregation and configuration path information from registered types.
*/
@@ -609,7 +1006,7 @@ private:
* List of aggregation relationships.
*/
std::vector<std::pair<TypeId,TypeId> > m_aggregates;
};
}; // class StaticInformation
void
@@ -798,7 +1195,7 @@ StaticInformation::DoGather (TypeId tid)
m_currentPath.pop_back ();
}
}
}
} // StaticInformation::DoGather ()
void
@@ -928,9 +1325,13 @@ PrintConfigPaths (std::ostream & os, const StaticInformation & info,
}
os << listStop << std::endl;
}
} // PrintConfigPaths
} // PrintConfigPaths ()
/***************************************************************
* Main
***************************************************************/
int main (int argc, char *argv[])
{
NS_LOG_FUNCTION_NOARGS ();
@@ -979,7 +1380,7 @@ int main (int argc, char *argv[])
continue;
}
std::cout << functionStart << tid.GetName () << std::endl;
std::cout << classStart << tid.GetName () << std::endl;
std::cout << std::endl;
PrintConfigPaths (std::cout, info, tid);
@@ -995,6 +1396,7 @@ int main (int argc, char *argv[])
PrintAllGlobals (std::cout);
PrintAllLogComponents (std::cout);
PrintAllTraceSources (std::cout);
PrintAttributeImplementations (std::cout);
return 0;
}