diff --git a/src/core/attribute-list.cc b/src/core/attribute-list.cc index 2ec595d3a..8d92ad16b 100644 --- a/src/core/attribute-list.cc +++ b/src/core/attribute-list.cc @@ -212,7 +212,7 @@ AttributeList::DeserializeFromString (std::string str) std::string::size_type equal = str.find ("=", cur); if (equal == std::string::npos) { - // XXX: invalid attribute. + NS_FATAL_ERROR ("Error while parsing serialized attribute: \"" << str << "\""); break; } else @@ -221,7 +221,7 @@ AttributeList::DeserializeFromString (std::string str) struct TypeId::AttributeInfo info; if (!TypeId::LookupAttributeByFullName (name, &info)) { - // XXX invalid name. + NS_FATAL_ERROR ("Error while parsing serialized attribute: name does not exist: \"" << name << "\""); break; } else @@ -242,7 +242,7 @@ AttributeList::DeserializeFromString (std::string str) bool ok = val->DeserializeFromString (value, info.checker); if (!ok) { - // XXX invalid value + NS_FATAL_ERROR ("Error while parsing serialized attribute: value invalid: \"" << value << "\""); break; } else diff --git a/src/core/attribute-list.h b/src/core/attribute-list.h index 36bda6735..be2583f43 100644 --- a/src/core/attribute-list.h +++ b/src/core/attribute-list.h @@ -87,7 +87,6 @@ public: */ static AttributeList *GetGlobal (void); - // XXX: untested. std::string SerializeToString (void) const; bool DeserializeFromString (std::string value); private: diff --git a/src/core/attribute-test.cc b/src/core/attribute-test.cc index 64eee0837..594051895 100644 --- a/src/core/attribute-test.cc +++ b/src/core/attribute-test.cc @@ -167,7 +167,7 @@ public: MakeTraceSourceAccessor (&AttributeObjectTest::m_cb)) .AddTraceSource ("ValueSource", "help text", MakeTraceSourceAccessor (&AttributeObjectTest::m_valueSrc)) - .AddAttribute ("Pointer", "XXX", + .AddAttribute ("Pointer", "help text", PointerValue (), MakePointerAccessor (&AttributeObjectTest::m_ptr), MakePointerChecker ()) diff --git a/src/core/attribute.h b/src/core/attribute.h index aa16c8634..a18f3694a 100644 --- a/src/core/attribute.h +++ b/src/core/attribute.h @@ -144,7 +144,7 @@ public: * to detect the type of the associated attribute. * * Most subclasses of this base class are implemented by the - * ATTRIBUTE_HELPER_* macros. + * \ref ATTRIBUTE_HELPER_HEADER and \ref ATTRIBUTE_HELPER_CPP macros. */ class AttributeChecker : public RefCountBase { diff --git a/src/core/command-line.h b/src/core/command-line.h index 2a5948361..a03cff92b 100644 --- a/src/core/command-line.h +++ b/src/core/command-line.h @@ -28,6 +28,7 @@ namespace ns3 { /** * \brief parse command-line arguments + * \ingroup core * * Instances of this class can be used to parse command-line * arguments: users can register new arguments with diff --git a/src/core/config.h b/src/core/config.h index 6346b071b..256b491ef 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -29,6 +29,10 @@ class AttributeValue; class Object; class CallbackBase; +/** + * \brief Configuration of simulation parameters and tracing + * \ingroup core + */ namespace Config { /** diff --git a/src/core/object-vector.cc b/src/core/object-vector.cc index bca66f8af..663b34dc4 100644 --- a/src/core/object-vector.cc +++ b/src/core/object-vector.cc @@ -34,8 +34,16 @@ ObjectVectorValue::Copy (void) const std::string ObjectVectorValue::SerializeToString (Ptr checker) const { - // XXX - return ""; + std::ostringstream oss; + for (uint32_t i = 0; i < m_objects.size (); ++i) + { + oss << m_objects[i]; + if (i != m_objects.size () - 1) + { + oss << " "; + } + } + return oss.str (); } bool ObjectVectorValue::DeserializeFromString (std::string value, Ptr checker) diff --git a/src/core/object.h b/src/core/object.h index c136e89ae..dcaf97e36 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -46,6 +46,14 @@ class TraceSourceAccessor; * \ingroup object * \brief a base class which provides memory management and object aggregation * + * The memory management scheme is based on reference-counting with dispose-like + * functionality to break the reference cycles. The reference count is increamented + * and decremented with the methods Object::Ref and Object::Unref. If a reference cycle is + * present, the user is responsible for breaking it by calling Object::Dispose in + * a single location. This will eventually trigger the invocation of Object::DoDispose + * on itself and all its aggregates. The Object::DoDispose method is always automatically + * invoked from the Object::Unref method before destroying the object, even if the user + * did not call Object::Dispose directly. */ class Object : public ObjectBase { diff --git a/src/core/singleton.h b/src/core/singleton.h index 722d93a62..77f51d58d 100644 --- a/src/core/singleton.h +++ b/src/core/singleton.h @@ -22,6 +22,17 @@ namespace ns3 { +/** + * \brief a template singleton + * + * This template class can be used to implement the singleton pattern. + * The underlying object will be destroyed automatically when the process + * exits. Note that, if you call Singleton::Get again after the object has + * been destroyed, the object will be re-created which will result in a + * memory leak as reported by most memory leak checkers. It is up to the + * user to ensure that Singleton::Get is never called from a static variable + * finalizer. + */ template class Singleton { diff --git a/src/core/trace-source-accessor.h b/src/core/trace-source-accessor.h index 4a76aa598..e85f260ca 100644 --- a/src/core/trace-source-accessor.h +++ b/src/core/trace-source-accessor.h @@ -74,7 +74,10 @@ private: * \param a the trace source * * Create a TraceSourceAccessor which will control access to the underlying - * trace source. + * trace source. This helper template method assumes that the underlying + * type implements a statically-polymorphic set of Connect and Disconnect + * methods and creates a dynamic-polymorphic class to wrap the underlying + * static-polymorphic class. */ template Ptr MakeTraceSourceAccessor (T a); diff --git a/src/core/traced-value.h b/src/core/traced-value.h index 837c0536a..79abdd10c 100644 --- a/src/core/traced-value.h +++ b/src/core/traced-value.h @@ -47,7 +47,7 @@ namespace ns3 { * this template: this instance will behave just like * the original class (if it did not export any special method), * and will define Connect/DisconnectWithoutContext methods to work - * with an ns3::TraceSourceAccessor. + * with ns3::MakeTraceSourceAccessor. */ template class TracedValue