improve the auto-generated doxygen output.

This commit is contained in:
Mathieu Lacage
2008-04-17 15:30:18 -07:00
parent a890500150
commit 3b711f9852
28 changed files with 153 additions and 56 deletions

View File

@@ -1046,13 +1046,13 @@ ENABLE_PREPROCESSING = YES
# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = NO
MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = NO
EXPAND_ONLY_PREDEF = YES
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# in the INCLUDE_PATH (see below) will be search if a #include is found.
@@ -1089,7 +1089,9 @@ PREDEFINED = RUN_SELF_TESTS \
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition.
EXPAND_AS_DEFINED =
EXPAND_AS_DEFINED = ATTRIBUTE_VALUE_DEFINE \
ATTRIBUTE_VALUE_DEFINE_WITH_NAME \
ATTRIBUTE_HELPER_HEADER_2
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone

View File

@@ -89,6 +89,11 @@ private:
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_2 (DataRate);
/**

View File

@@ -29,21 +29,21 @@ namespace ns3 {
template <typename T, typename BASE>
Ptr<AttributeChecker>
MakeSimpleAttributeChecker (std::string name)
MakeSimpleAttributeChecker (std::string name, std::string underlying)
{
struct SimpleAttributeChecker : public BASE
{
virtual bool Check (const AttributeValue &value) const {
return dynamic_cast<const T *> (&value) != 0;
}
virtual std::string GetType (void) const {
virtual std::string GetValueTypeName (void) const {
return m_type;
}
virtual bool HasTypeConstraints (void) const {
return false;
virtual bool HasUnderlyingTypeInformation (void) const {
return true;
}
virtual std::string GetTypeConstraints (void) const {
return "";
virtual std::string GetUnderlyingTypeInformation (void) const {
return m_underlying;
}
virtual Ptr<AttributeValue> Create (void) const {
return ns3::Create<T> ();
@@ -59,8 +59,10 @@ MakeSimpleAttributeChecker (std::string name)
return true;
}
std::string m_type;
std::string m_underlying;
} *checker = new SimpleAttributeChecker ();
checker->m_type = name;
checker->m_underlying = underlying;
return Ptr<AttributeChecker> (checker, false);
}
@@ -108,7 +110,7 @@ MakeSimpleAttributeChecker (std::string name)
return MakeAccessorHelper<type##Value> (a1, a2); \
}
#define ATTRIBUTE_VALUE_DEFINE_WITH_NAME(type,name) \
#define ATTRIBUTE_VALUE_DEFINE_WITH_NAME(type,name) \
class name##Value : public AttributeValue \
{ \
public: \
@@ -210,9 +212,16 @@ MakeSimpleAttributeChecker (std::string name)
#define ATTRIBUTE_CHECKER_IMPLEMENT(type) \
Ptr<const AttributeChecker> Make##type##Checker (void) \
{ \
return MakeSimpleAttributeChecker<type##Value,type##Checker> (#type); \
return MakeSimpleAttributeChecker<type##Value,type##Checker> (#type "Value", #type); \
} \
#define ATTRIBUTE_CHECKER_IMPLEMENT_WITH_NAME(type,name) \
Ptr<const AttributeChecker> Make##type##Checker (void) \
{ \
return MakeSimpleAttributeChecker<type##Value,type##Checker> (#type "Value", name); \
} \
/**
* \ingroup AttributeHelper
* \param type the name of the class

View File

@@ -145,9 +145,28 @@ public:
* false otherwise.
*/
virtual bool Check (const AttributeValue &value) const = 0;
virtual std::string GetType (void) const = 0;
virtual bool HasTypeConstraints (void) const = 0;
virtual std::string GetTypeConstraints (void) const = 0;
/**
* \returns the c++ fully-qualified typename of the subclass
* of the ns3::AttributeValue base class which is associated
* to this checker.
*
* A typical return value here is FooValue where Foo is the name of the
* type being wrapped.
*/
virtual std::string GetValueTypeName (void) const = 0;
/**
* \returns true if this checker has information about the underlying
* C++ type, false otherwise.
*
* If this method returns false, the return value of the GetUnderlyingTypeInformation
* method cannot be relied upon.
*/
virtual bool HasUnderlyingTypeInformation (void) const = 0;
/**
* \returns a human-readable representation of information about
* the underlying C++ type.
*/
virtual std::string GetUnderlyingTypeInformation (void) const = 0;
/**
* \returns a new instance of an AttributeValue (wrapper in an Attribute
* instance) which matches the type of the underlying attribute.

View File

@@ -97,6 +97,6 @@ BooleanValue::DeserializeFromString (std::string value, Ptr<const AttributeCheck
}
ATTRIBUTE_CHECKER_IMPLEMENT (Boolean);
ATTRIBUTE_CHECKER_IMPLEMENT_WITH_NAME (Boolean,"bool");
} // namespace ns3

View File

@@ -43,15 +43,15 @@ Ptr<const AttributeChecker> MakeDoubleChecker (double min, double max, std::stri
}
return v->Get () >= m_minValue && v->Get () <= m_maxValue;
}
virtual std::string GetType (void) const {
return m_name;
virtual std::string GetValueTypeName (void) const {
return "ns3::DoubleValue";
}
virtual bool HasTypeConstraints (void) const {
virtual bool HasUnderlyingTypeInformation (void) const {
return true;
}
virtual std::string GetTypeConstraints (void) const {
virtual std::string GetUnderlyingTypeInformation (void) const {
std::ostringstream oss;
oss << m_minValue << ":" << m_maxValue;
oss << m_name << " " << m_minValue << ":" << m_maxValue;
return oss.str ();
}
virtual Ptr<AttributeValue> Create (void) const {

View File

@@ -27,7 +27,7 @@
namespace ns3 {
/**
* \class DoubleValue
* \class ns3::DoubleValue
* \brief Hold an floating point type
*
* \anchor double

View File

@@ -109,17 +109,17 @@ EnumChecker::Check (const AttributeValue &value) const
return false;
}
std::string
EnumChecker::GetType (void) const
EnumChecker::GetValueTypeName (void) const
{
return "EnumValue";
return "ns3::EnumValue";
}
bool
EnumChecker::HasTypeConstraints (void) const
EnumChecker::HasUnderlyingTypeInformation (void) const
{
return true;
}
std::string
EnumChecker::GetTypeConstraints (void) const
EnumChecker::GetUnderlyingTypeInformation (void) const
{
std::ostringstream oss;
for (ValueSet::const_iterator i = m_valueSet.begin (); i != m_valueSet.end ();)

View File

@@ -57,9 +57,9 @@ public:
void Add (int v, std::string name);
virtual bool Check (const AttributeValue &value) const;
virtual std::string GetType (void) const;
virtual bool HasTypeConstraints (void) const;
virtual std::string GetTypeConstraints (void) const;
virtual std::string GetValueTypeName (void) const;
virtual bool HasUnderlyingTypeInformation (void) const;
virtual std::string GetUnderlyingTypeInformation (void) const;
virtual Ptr<AttributeValue> Create (void) const;
virtual bool Copy (const AttributeValue &src, AttributeValue &dst) const;

View File

@@ -44,15 +44,15 @@ MakeIntegerChecker (int64_t min, int64_t max, std::string name)
}
return v->Get () >= m_minValue && v->Get () <= m_maxValue;
}
virtual std::string GetType (void) const {
return m_name;
virtual std::string GetValueTypeName (void) const {
return "ns3::IntegerValue";
}
virtual bool HasTypeConstraints (void) const {
virtual bool HasUnderlyingTypeInformation (void) const {
return true;
}
virtual std::string GetTypeConstraints (void) const {
virtual std::string GetUnderlyingTypeInformation (void) const {
std::ostringstream oss;
oss << m_minValue << ":" << m_maxValue;
oss << m_name << " " << m_minValue << ":" << m_maxValue;
return oss.str ();
}
virtual Ptr<AttributeValue> Create (void) const {

View File

@@ -27,7 +27,7 @@
namespace ns3 {
/**
* \class IntegerValue
* \class ns3::IntegerValue
* \brief Hold a signed integer type
*
* \anchor int8_t

View File

@@ -89,6 +89,11 @@ private:
std::ostream & operator << (std::ostream &os, const ObjectFactory &factory);
std::istream & operator >> (std::istream &is, ObjectFactory &factory);
/**
* \class ns3::ObjectFactoryValue
* \brief hold objects of type ns3::ObjectFactory
*/
ATTRIBUTE_HELPER_HEADER_2 (ObjectFactory);
} // namespace ns3

View File

@@ -87,13 +87,13 @@ public:
virtual bool Check (const AttributeValue &value) const {
return dynamic_cast<const ObjectVectorValue *> (&value) != 0;
}
virtual std::string GetType (void) const {
virtual std::string GetValueTypeName (void) const {
return "ns3::ObjectVectorValue";
}
virtual bool HasTypeConstraints (void) const {
virtual bool HasUnderlyingTypeInformation (void) const {
return true;
}
virtual std::string GetTypeConstraints (void) const {
virtual std::string GetUnderlyingTypeInformation (void) const {
return T::GetTypeId ().GetName ();
}
virtual Ptr<AttributeValue> Create (void) const {

View File

@@ -25,6 +25,9 @@
namespace ns3 {
/**
* \brief hold objects of type Ptr<T>
*/
class PointerValue : public AttributeValue
{
public:
@@ -109,17 +112,16 @@ class APointerChecker : public PointerChecker
}
return true;
}
virtual std::string GetType (void) const {
// XXX: we should be able to return better information
virtual std::string GetValueTypeName (void) const {
return "ns3::PointerValue";
}
virtual bool HasUnderlyingTypeInformation (void) const {
return true;
}
virtual std::string GetUnderlyingTypeInformation (void) const {
TypeId tid = T::GetTypeId ();
return "Ptr< " + tid.GetName () + " >";
}
virtual bool HasTypeConstraints (void) const {
return false;
}
virtual std::string GetTypeConstraints (void) const {
return "";
}
virtual Ptr<AttributeValue> Create (void) const {
return ns3::Create<PointerValue> ();
}

View File

@@ -662,6 +662,11 @@ public:
std::ostream &operator << (std::ostream &os, const RandomVariable &var);
std::istream &operator >> (std::istream &os, RandomVariable &var);
/**
* \class ns3::RandomVariableValue
* \brief hold objects of type ns3::RandomVariable
*/
ATTRIBUTE_VALUE_DEFINE (RandomVariable);
ATTRIBUTE_CHECKER_DEFINE (RandomVariable);
ATTRIBUTE_ACCESSOR_DEFINE (RandomVariable);

View File

@@ -2,7 +2,7 @@
namespace ns3 {
ATTRIBUTE_CHECKER_IMPLEMENT (String);
ATTRIBUTE_CHECKER_IMPLEMENT_WITH_NAME (String, "std::string");
ATTRIBUTE_CONVERTER_IMPLEMENT (String);
ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME (std::string, String);

View File

@@ -7,7 +7,7 @@
namespace ns3 {
/**
* \class StringValue
* \class ns3::StringValue
* \brief hold variables of type string
*
* This class can be used to hold variables of type string,

View File

@@ -380,6 +380,11 @@ bool operator == (TypeId a, TypeId b);
bool operator != (TypeId a, TypeId b);
bool operator < (TypeId a, TypeId b);
/**
* \class ns3::TypeIdValue
* \brief hold objects of type ns3::TypeId
*/
ATTRIBUTE_HELPER_HEADER_2 (TypeId);

View File

@@ -43,15 +43,15 @@ Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min, uint64_t max, std
}
return v->Get () >= m_minValue && v->Get () <= m_maxValue;
}
virtual std::string GetType (void) const {
return m_name;
virtual std::string GetValueTypeName (void) const {
return "ns3::UintegerValue";
}
virtual bool HasTypeConstraints (void) const {
virtual bool HasUnderlyingTypeInformation (void) const {
return true;
}
virtual std::string GetTypeConstraints (void) const {
virtual std::string GetUnderlyingTypeInformation (void) const {
std::ostringstream oss;
oss << m_minValue << ":" << m_maxValue;
oss << m_name << " " << m_minValue << ":" << m_maxValue;
return oss.str ();
}
virtual Ptr<AttributeValue> Create (void) const {

View File

@@ -58,6 +58,11 @@ private:
std::ostream &operator << (std::ostream &os, const Ssid &ssid);
std::istream &operator >> (std::istream &is, Ssid &ssid);
/**
* \class ns3::SsidValue
* \brief hold objects of type ns3::Ssid
*/
ATTRIBUTE_HELPER_HEADER_2 (Ssid);
} // namespace ns3

View File

@@ -118,6 +118,11 @@ bool operator == (const WifiMode &a, const WifiMode &b);
std::ostream & operator << (std::ostream & os, const WifiMode &mode);
std::istream & operator >> (std::istream &is, WifiMode &mode);
/**
* \class ns3::WifiModeValue
* \brief hold objects of type ns3::WifiMode
*/
ATTRIBUTE_HELPER_HEADER_2 (WifiMode);
/**

View File

@@ -68,6 +68,11 @@ public:
std::ostream &operator << (std::ostream &os, const Rectangle &rectangle);
std::istream &operator >> (std::istream &is, Rectangle &rectangle);
/**
* \class ns3::RectangleValue
* \brief hold objects of type ns3::Rectangle
*/
ATTRIBUTE_HELPER_HEADER_2 (Rectangle);
} // namespace ns3

View File

@@ -63,6 +63,11 @@ public:
double CalculateDistance (const Vector &a, const Vector &b);
/**
* \class ns3::VectorValue
* \brief hold objects of type ns3::Vector
*/
ATTRIBUTE_HELPER_HEADER_2 (Vector);
std::ostream &operator << (std::ostream &os, const Vector &vector);

View File

@@ -166,6 +166,11 @@ private:
uint8_t m_data[MAX_SIZE];
};
/**
* \class ns3::AddressValue
* \brief hold objects of type ns3::Address
*/
ATTRIBUTE_HELPER_HEADER_2 (Address);
bool operator == (const Address &a, const Address &b);

View File

@@ -185,6 +185,15 @@ private:
uint32_t m_mask;
};
/**
* \class ns3::Ipv4AddressValue
* \brief hold objects of type ns3::Ipv4Address
*/
/**
* \class ns3::Ipv4MaskValue
* \brief hold objects of type ns3::Ipv4Mask
*/
ATTRIBUTE_HELPER_HEADER_2 (Ipv4Address);
ATTRIBUTE_HELPER_HEADER_2 (Ipv4Mask);

View File

@@ -112,6 +112,11 @@ private:
uint8_t m_address[6];
};
/**
* \class ns3::Mac48AddressValue
* \brief hold objects of type ns3::Mac48Address
*/
ATTRIBUTE_HELPER_HEADER_2 (Mac48Address);
bool operator == (const Mac48Address &a, const Mac48Address &b);

View File

@@ -667,6 +667,12 @@ typedef TimeUnit<0> Scalar;
typedef TimeUnit<-1> TimeInvert;
typedef TimeUnit<2> TimeSquare;
/**
* \class ns3::TimeValue
* \brief hold objects of type ns3::Time
*/
ATTRIBUTE_ACCESSOR_DEFINE (Time);
ATTRIBUTE_VALUE_DEFINE (Time);
ATTRIBUTE_CHECKER_DEFINE (Time);

View File

@@ -19,12 +19,12 @@ PrintAttributes (TypeId tid, std::ostream &os)
os << "<li><b>" << tid.GetAttributeName (j) << "</b>: "
<< tid.GetAttributeHelp (j) << std::endl;
Ptr<const AttributeChecker> checker = tid.GetAttributeChecker (j);
os << " <ul>" << std::endl << " <li>Type: \\ref " << checker->GetType ();
if (checker->HasTypeConstraints ())
os << " <ul>" << std::endl << " <li>Set with class: \\ref "
<< checker->GetValueTypeName () << "</li>" << std::endl;
if (checker->HasUnderlyingTypeInformation ())
{
os << " -> " << checker->GetTypeConstraints ();
os << " <li>Underlying type: \\ref " << checker->GetUnderlyingTypeInformation () << "</li>" << std::endl;
}
os << "</li>" << std::endl;
uint32_t flags = tid.GetAttributeFlags (j);
Ptr<const AttributeAccessor> accessor = tid.GetAttributeAccessor (j);
os << " <li>Flags: ";