src/core/model/object-ptr-container.h
changeset 11096 e57bfdb4f12c
parent 11036 1e03af4311bd
child 11136 03bf8fa63bda
equal deleted inserted replaced
11095:be1aa0c5ac72 11096:e57bfdb4f12c
    26 #include "attribute.h"
    26 #include "attribute.h"
    27 
    27 
    28 namespace ns3 {
    28 namespace ns3 {
    29 
    29 
    30 /**
    30 /**
    31  * \ingroup object
    31  * \ingroup attribute_ObjectPtrContainer
    32  * 
    32  * 
    33  * \brief contain a set of ns3::Object pointers.
    33  * \brief Container for a set of ns3::Object pointers.
    34  *
    34  *
    35  * This class it used to get attribute access to an array of
    35  * This class it used to get attribute access to an array of
    36  * ns3::Object pointers.
    36  * ns3::Object pointers.
    37  */
    37  */
    38 class ObjectPtrContainerValue : public AttributeValue
    38 class ObjectPtrContainerValue : public AttributeValue
    43 
    43 
    44   /** Default constructor. */
    44   /** Default constructor. */
    45   ObjectPtrContainerValue ();
    45   ObjectPtrContainerValue ();
    46 
    46 
    47   /**
    47   /**
    48    * \returns an iterator to the first object contained in this set
    48    * Get an iterator to the first Object.
       
    49    *
       
    50    * \returns An iterator to the first Object.
    49    */
    51    */
    50   Iterator Begin (void) const;
    52   Iterator Begin (void) const;
    51   /**
    53   /**
    52    * \returns an iterator to the last object contained in this set
    54    * Get an iterator to the _past-the-end_ Object.
       
    55    *
       
    56    * \returns An iterator to the _past-the-end_ Object.
    53    */
    57    */
    54   Iterator End (void) const;
    58   Iterator End (void) const;
    55   /**
    59   /**
    56    * \returns the number of objects contained in this set.
    60    * Get the number of Objects.
       
    61    *
       
    62    * \returns The number of objects.
    57    */
    63    */
    58   uint32_t GetN (void) const;
    64   uint32_t GetN (void) const;
    59   /**
    65   /**
    60    * \param i the index of the requested object.
    66    * Get a specific Object.
    61    * \returns the requested object
    67    *
       
    68    * \param i The index of the requested object.
       
    69    * \returns The requested object
    62    */
    70    */
    63   Ptr<Object> Get (uint32_t i) const;
    71   Ptr<Object> Get (uint32_t i) const;
    64 
    72 
       
    73   /**
       
    74    * Get a copy of this container.
       
    75    *
       
    76    * \returns A copy of this container.
       
    77    */
    65   virtual Ptr<AttributeValue> Copy (void) const;
    78   virtual Ptr<AttributeValue> Copy (void) const;
       
    79   /**
       
    80    * Serialize each of the Object pointers to a string.
       
    81    *
       
    82    * Note this serializes the Ptr values, not the Objects themselves.
       
    83    *
       
    84    * \param checker The checker to use (currently not used.)
       
    85    * \returns The string form of the Objects.
       
    86    */
    66   virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
    87   virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
       
    88   /**
       
    89    * Deserialize from a string. (Not implemented; raises a fatal error.)
       
    90    *
       
    91    * \param value The serialized string form.
       
    92    * \param checker The checker to use.
       
    93    * \returns \c true.
       
    94    */
    67   virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
    95   virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
    68 
    96 
    69 private:
    97 private:
    70   friend class ObjectPtrContainerAccessor;
    98   friend class ObjectPtrContainerAccessor;
    71   /** The container implementation. */
    99   /** The container implementation. */
   172 };
   200 };
   173 
   201 
   174 } // namespace internal
   202 } // namespace internal
   175 
   203 
   176   
   204   
   177 /** AttributeAccessor implementation for ObjectPtrContainerValue. */
   205 /**
       
   206  * \ingroup attribute_ObjectPtrContainer
       
   207  * AttributeAccessor implementation for ObjectPtrContainerValue.
       
   208  */
   178 class ObjectPtrContainerAccessor : public AttributeAccessor
   209 class ObjectPtrContainerAccessor : public AttributeAccessor
   179 {
   210 {
   180 public:
   211 public:
   181   virtual bool Set (ObjectBase * object, const AttributeValue &value) const;
   212   virtual bool Set (ObjectBase * object, const AttributeValue &value) const;
   182   virtual bool Get (const ObjectBase * object, AttributeValue &value) const;
   213   virtual bool Get (const ObjectBase * object, AttributeValue &value) const;