LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2007 INRIA, Mathieu Lacage | 3 * Copyright (c) 2007 INRIA, Mathieu Lacage |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Authors: Mathieu Lacage <mathieu.lacage@gmail.com> | 18 * Authors: Mathieu Lacage <mathieu.lacage@gmail.com> |
19 */ | 19 */ |
20 #ifndef OBJECT_PTR_CONTAINER_H | 20 #ifndef OBJECT_PTR_CONTAINER_H |
21 #define OBJECT_PTR_CONTAINER_H | 21 #define OBJECT_PTR_CONTAINER_H |
22 | 22 |
23 #include <map> | 23 #include <map> |
24 #include "object.h" | 24 #include "object.h" |
25 #include "ptr.h" | 25 #include "ptr.h" |
26 #include "attribute.h" | 26 #include "attribute.h" |
27 | 27 |
| 28 #include "ns3/ns3-module.h" |
| 29 #define NS3_MODULE NS3_CORE_MODULE |
| 30 #include "ns3/ns3-export.h" |
| 31 |
28 /** | 32 /** |
29 * \file | 33 * \file |
30 * \ingroup attribute_ObjectPtrContainer | 34 * \ingroup attribute_ObjectPtrContainer |
31 * ns3::ObjectPtrContainerValue attribute value declarations and template implem
entations. | 35 * ns3::ObjectPtrContainerValue attribute value declarations and template implem
entations. |
32 */ | 36 */ |
33 | 37 |
34 | 38 |
35 namespace ns3 { | 39 namespace ns3 { |
36 | 40 |
37 /** | 41 /** |
38 * \ingroup attribute_ObjectPtrContainer | 42 * \ingroup attribute_ObjectPtrContainer |
39 *· | 43 *· |
40 * \brief Container for a set of ns3::Object pointers. | 44 * \brief Container for a set of ns3::Object pointers. |
41 * | 45 * |
42 * This class it used to get attribute access to an array of | 46 * This class it used to get attribute access to an array of |
43 * ns3::Object pointers. | 47 * ns3::Object pointers. |
44 */ | 48 */ |
45 class ObjectPtrContainerValue : public AttributeValue | 49 class NS3_EXPORT ObjectPtrContainerValue : public AttributeValue |
46 { | 50 { |
47 public: | 51 public: |
48 /** Iterator type for traversing this container. */ | 52 /** Iterator type for traversing this container. */ |
49 typedef std::map<std::size_t, Ptr<Object> >::const_iterator Iterator; | 53 typedef std::map<std::size_t, Ptr<Object> >::const_iterator Iterator; |
50 | 54 |
51 /** Default constructor. */ | 55 /** Default constructor. */ |
52 ObjectPtrContainerValue (); | 56 ObjectPtrContainerValue (); |
53 | 57 |
54 /** | 58 /** |
55 * Get an iterator to the first Object. | 59 * Get an iterator to the first Object. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 * from the container. | 144 * from the container. |
141 * \param [in] getN The class method to return the number of objects | 145 * \param [in] getN The class method to return the number of objects |
142 * in the container. | 146 * in the container. |
143 * \return The AttributeAccessor. | 147 * \return The AttributeAccessor. |
144 */ | 148 */ |
145 template <typename T, typename U, typename INDEX> | 149 template <typename T, typename U, typename INDEX> |
146 Ptr<const AttributeAccessor> | 150 Ptr<const AttributeAccessor> |
147 MakeObjectPtrContainerAccessor (INDEX (T::*getN)(void) const, | 151 MakeObjectPtrContainerAccessor (INDEX (T::*getN)(void) const, |
148 Ptr<U> (T::*get)(INDEX) const); | 152 Ptr<U> (T::*get)(INDEX) const); |
149 | 153 |
150 class ObjectPtrContainerChecker : public AttributeChecker | 154 class NS3_EXPORT ObjectPtrContainerChecker : public AttributeChecker |
151 { | 155 { |
152 public: | 156 public: |
153 /** | 157 /** |
154 * Get the TypeId of the container class type. | 158 * Get the TypeId of the container class type. |
155 * \returns The class TypeId. | 159 * \returns The class TypeId. |
156 */ | 160 */ |
157 virtual TypeId GetItemTypeId (void) const = 0; | 161 virtual TypeId GetItemTypeId (void) const = 0; |
158 }; | 162 }; |
159 | 163 |
160 template <typename T> | 164 template <typename T> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 210 } |
207 }; | 211 }; |
208 | 212 |
209 } // namespace internal | 213 } // namespace internal |
210 | 214 |
211 ·· | 215 ·· |
212 /** | 216 /** |
213 * \ingroup attribute_ObjectPtrContainer | 217 * \ingroup attribute_ObjectPtrContainer |
214 * AttributeAccessor implementation for ObjectPtrContainerValue. | 218 * AttributeAccessor implementation for ObjectPtrContainerValue. |
215 */ | 219 */ |
216 class ObjectPtrContainerAccessor : public AttributeAccessor | 220 class NS3_EXPORT ObjectPtrContainerAccessor : public AttributeAccessor |
217 { | 221 { |
218 public: | 222 public: |
219 virtual bool Set (ObjectBase * object, const AttributeValue &value) const; | 223 virtual bool Set (ObjectBase * object, const AttributeValue &value) const; |
220 virtual bool Get (const ObjectBase * object, AttributeValue &value) const; | 224 virtual bool Get (const ObjectBase * object, AttributeValue &value) const; |
221 virtual bool HasGetter (void) const; | 225 virtual bool HasGetter (void) const; |
222 virtual bool HasSetter (void) const; | 226 virtual bool HasSetter (void) const; |
223 private: | 227 private: |
224 /** | 228 /** |
225 * Get the number of instances in the container. | 229 * Get the number of instances in the container. |
226 * | 230 * |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 template <typename T> | 284 template <typename T> |
281 Ptr<const AttributeChecker> MakeObjectPtrContainerChecker (void) | 285 Ptr<const AttributeChecker> MakeObjectPtrContainerChecker (void) |
282 { | 286 { |
283 return Create<internal::ObjectPtrContainerChecker<T> > (); | 287 return Create<internal::ObjectPtrContainerChecker<T> > (); |
284 } | 288 } |
285 | 289 |
286 | 290 |
287 } // namespace ns3 | 291 } // namespace ns3 |
288 | 292 |
289 #endif /* OBJECT_PTR_CONTAINER_H */ | 293 #endif /* OBJECT_PTR_CONTAINER_H */ |
LEFT | RIGHT |