diff --git a/src/core/config.h b/src/core/config.h index 9da9b03b9..54e095024 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -111,26 +111,97 @@ void Connect (std::string path, const CallbackBase &cb); */ void Disconnect (std::string path, const CallbackBase &cb); +/** + * \brief hold a set of objects which match a specific search string. + * + * This class also allows you to perform a set of configuration operations + * on the set of matching objects stored in the container. Specifically, + * it is possible to perform bulk Connects and Sets. + */ class MatchContainer { public: typedef std::vector >::const_iterator Iterator; MatchContainer (); + // constructor used only by implementation. MatchContainer (const std::vector > &objects, const std::vector &contexts, std::string path); + /** + * \returns an iterator which points to the first item in the container + */ MatchContainer::Iterator Begin (void) const; + /** + * \returns an iterator which points to the last item in the container + */ MatchContainer::Iterator End (void) const; + /** + * \returns the number of items in the container + */ uint32_t GetN (void) const; + /** + * \param i index of item to lookup ([0,n[) + * \returns the item requested. + */ Ptr Get (uint32_t i) const; + /** + * \param i index of item to lookup ([0,n[) + * \returns the fully-qualified matching path associated + * to the requested item. + * + * The matching patch uniquely identifies the requested object. + */ std::string GetMatchedPath (uint32_t i) const; + /** + * \returns the path used to perform the object matching. + */ std::string GetPath (void) const; + /** + * \param name name of attribute to set + * \param value value to set to the attribute + * + * Set the specified attribute value to all the objects stored in this + * container. + * \sa ns3::Config::Set + */ void Set (std::string name, const AttributeValue &value); + /** + * \param name the name of the trace source to connect to + * \param cb the sink to connect to the trace source + * + * Connect the specified sink to all the objects stored in this + * container. + * \sa ns3::Config::Connect + */ void Connect (std::string name, const CallbackBase &cb); + /** + * \param name the name of the trace source to connect to + * \param cb the sink to connect to the trace source + * + * Connect the specified sink to all the objects stored in this + * container. + * \sa ns3::Config::ConnectWithoutContext + */ void ConnectWithoutContext (std::string name, const CallbackBase &cb); + /** + * \param name the name of the trace source to disconnect from + * \param cb the sink to disconnect from the trace source + * + * Disconnect the specified sink from all the objects stored in this + * container. + * \sa ns3::Config::Disconnect + */ void Disconnect (std::string name, const CallbackBase &cb); + /** + * \param name the name of the trace source to disconnect from + * \param cb the sink to disconnect from the trace source + * + * Disconnect the specified sink from all the objects stored in this + * container. + * \sa ns3::Config::DisconnectWithoutContext + */ void DisconnectWithoutContext (std::string name, const CallbackBase &cb); private: std::vector > m_objects; @@ -138,6 +209,11 @@ private: std::string m_path; }; +/** + * \param path the path to perform a match against + * \returns a container which contains all the objects which match the input + * path. + */ MatchContainer LookupMatches (std::string path); /**