OLD | NEW |
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) 2008 INRIA | 3 * Copyright (c) 2008 INRIA |
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@sophia.inria.fr> | 18 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
19 */ | 19 */ |
20 #ifndef NS_POINTER_H | 20 #ifndef NS_POINTER_H |
21 #define NS_POINTER_H | 21 #define NS_POINTER_H |
22 | 22 |
23 #include "attribute.h" | 23 #include "attribute.h" |
24 #include "object.h" | 24 #include "object.h" |
25 | 25 |
| 26 #include "ns3/ns3-module.h" |
| 27 #define NS3_MODULE NS3_CORE_MODULE |
| 28 #include "ns3/ns3-export.h" |
| 29 |
26 /** | 30 /** |
27 * \file | 31 * \file |
28 * \ingroup attribute_Pointer | 32 * \ingroup attribute_Pointer |
29 * ns3::PointerValue attribute value declarations and template implementations. | 33 * ns3::PointerValue attribute value declarations and template implementations. |
30 */ | 34 */ |
31 | 35 |
32 namespace ns3 { | 36 namespace ns3 { |
33 | 37 |
34 // Additional docs for class PointerValue: | 38 // Additional docs for class PointerValue: |
35 /** Hold objects of type Ptr<T>. */ | 39 /** Hold objects of type Ptr<T>. */ |
36 class PointerValue : public AttributeValue | 40 class NS3_EXPORT PointerValue : public AttributeValue |
37 { | 41 { |
38 public: | 42 public: |
39 PointerValue (); | 43 PointerValue (); |
40 ·· | 44 ·· |
41 /** | 45 /** |
42 * Construct this PointerValue by referencing an explicit Object. | 46 * Construct this PointerValue by referencing an explicit Object. |
43 * | 47 * |
44 * \param [in] object The object to begin with. | 48 * \param [in] object The object to begin with. |
45 */ | 49 */ |
46 PointerValue (Ptr<Object> object); | 50 PointerValue (Ptr<Object> object); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 91 |
88 virtual Ptr<AttributeValue> Copy (void) const; | 92 virtual Ptr<AttributeValue> Copy (void) const; |
89 virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) co
nst; | 93 virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) co
nst; |
90 virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChec
ker> checker); | 94 virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChec
ker> checker); |
91 | 95 |
92 private: | 96 private: |
93 Ptr<Object> m_value; | 97 Ptr<Object> m_value; |
94 }; | 98 }; |
95 | 99 |
96 | 100 |
97 class PointerChecker : public AttributeChecker· | 101 class NS3_EXPORT PointerChecker : public AttributeChecker· |
98 { | 102 { |
99 public: | 103 public: |
100 | 104 |
101 /** | 105 /** |
102 * Get the TypeId of the base type. | 106 * Get the TypeId of the base type. |
103 * \returns The base TypeId. | 107 * \returns The base TypeId. |
104 */ | 108 */ |
105 virtual TypeId GetPointeeTypeId (void) const = 0; | 109 virtual TypeId GetPointeeTypeId (void) const = 0; |
106 }; | 110 }; |
107 ·· | 111 ·· |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 Ptr<T> ptr = dynamic_cast<T*> (PeekPointer (m_value)); | 214 Ptr<T> ptr = dynamic_cast<T*> (PeekPointer (m_value)); |
211 if (ptr == 0) | 215 if (ptr == 0) |
212 { | 216 { |
213 return false; | 217 return false; |
214 } | 218 } |
215 v = ptr; | 219 v = ptr; |
216 return true; | 220 return true; |
217 } | 221 } |
218 | 222 |
219 | 223 |
220 ATTRIBUTE_ACCESSOR_DEFINE (Pointer); | 224 ATTRIBUTE_ACCESSOR_DEFINE_LIB (Pointer, NS3_EXPORT); |
221 | 225 |
222 template <typename T> | 226 template <typename T> |
223 Ptr<AttributeChecker> | 227 Ptr<AttributeChecker> |
224 MakePointerChecker (void) | 228 MakePointerChecker (void) |
225 { | 229 { |
226 return Create<internal::PointerChecker<T> > (); | 230 return Create<internal::PointerChecker<T> > (); |
227 } | 231 } |
228 | 232 |
229 | 233 |
230 } // namespace ns3 | 234 } // namespace ns3 |
231 | 235 |
232 #endif /* NS_POINTER_H */ | 236 #endif /* NS_POINTER_H */ |
OLD | NEW |