LEFT | RIGHT |
(no file at all) | |
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 OBJECT_BASE_H | 20 #ifndef OBJECT_BASE_H |
21 #define OBJECT_BASE_H | 21 #define OBJECT_BASE_H |
22 | 22 |
23 #include "type-id.h" | 23 #include "type-id.h" |
24 #include "callback.h" | 24 #include "callback.h" |
25 #include <string> | 25 #include <string> |
26 #include <list> | 26 #include <list> |
| 27 |
| 28 #include "ns3/ns3-module.h" |
| 29 #define NS3_MODULE NS3_CORE_MODULE |
| 30 #include "ns3/ns3-export.h" |
| 31 |
27 | 32 |
28 /** | 33 /** |
29 * \file | 34 * \file |
30 * \ingroup object | 35 * \ingroup object |
31 * ns3::ObjectBase declaration and | 36 * ns3::ObjectBase declaration and |
32 * NS_OBJECT_ENSURE_REGISTERED() madro definition. | 37 * NS_OBJECT_ENSURE_REGISTERED() madro definition. |
33 */ | 38 */ |
34 | 39 |
35 /** | 40 /** |
36 * \ingroup object | 41 * \ingroup object |
(...skipping 20 matching lines...) Expand all Loading... |
57 * \ingroup object | 62 * \ingroup object |
58 * \brief Explicitly instantiate a template class and register the resulting | 63 * \brief Explicitly instantiate a template class and register the resulting |
59 * instance with the TypeId system. | 64 * instance with the TypeId system. |
60 * | 65 * |
61 * This macro should be invoked once for every required instance of a template | 66 * This macro should be invoked once for every required instance of a template |
62 * class which derives from the Object class and defines a new GetTypeId method. | 67 * class which derives from the Object class and defines a new GetTypeId method. |
63 * | 68 * |
64 * If the template class is in a namespace, then the macro call should also be | 69 * If the template class is in a namespace, then the macro call should also be |
65 * in the namespace. | 70 * in the namespace. |
66 */ | 71 */ |
| 72 #ifdef _WIN32 |
| 73 #define NS_OBJECT_TEMPLATE_CLASS_DEFINE_LIB(type,param,lib) \ |
| 74 template class lib type<param>; \ |
| 75 template <> lib std::string DoGetTypeParamName<type<param> > () \ |
| 76 { \ |
| 77 return #param; \ |
| 78 } \ |
| 79 static struct Object ## type ## param ## Registrationclass \ |
| 80 { \ |
| 81 Object ## type ## param ## Registrationclass () { \ |
| 82 ns3::TypeId tid = type<param>::GetTypeId (); \ |
| 83 tid.SetSize (sizeof (type<param>)); \ |
| 84 tid.GetParent (); \ |
| 85 } \ |
| 86 } Object ## type ## param ## RegistrationVariable |
| 87 #else |
| 88 #define NS_OBJECT_TEMPLATE_CLASS_DEFINE_LIB(type,param,lib) \ |
| 89 NS_OBJECT_TEMPLATE_CLASS_DEFINE(type,param) |
| 90 #endif |
| 91 |
67 #define NS_OBJECT_TEMPLATE_CLASS_DEFINE(type,param) \ | 92 #define NS_OBJECT_TEMPLATE_CLASS_DEFINE(type,param) \ |
68 template class type<param>; \ | 93 template class type<param>; \ |
69 template <> std::string DoGetTypeParamName<type<param> > () \ | 94 template <> std::string DoGetTypeParamName<type<param> > () \ |
70 { \ | 95 { \ |
71 return #param; \ | 96 return #param; \ |
72 } \ | 97 } \ |
73 static struct Object ## type ## param ## RegistrationClass \ | 98 static struct Object ## type ## param ## RegistrationClass \ |
74 { \ | 99 { \ |
75 Object ## type ## param ## RegistrationClass () { \ | 100 Object ## type ## param ## RegistrationClass () { \ |
76 ns3::TypeId tid = type<param>::GetTypeId (); \ | 101 ns3::TypeId tid = type<param>::GetTypeId (); \ |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 /** | 134 /** |
110 * \ingroup object | 135 * \ingroup object |
111 * | 136 * |
112 * \brief Anchor the ns-3 type and attribute system. | 137 * \brief Anchor the ns-3 type and attribute system. |
113 * | 138 * |
114 * Every class which wants to integrate in the ns-3 type and attribute | 139 * Every class which wants to integrate in the ns-3 type and attribute |
115 * system should derive from this base class. This base class provides: | 140 * system should derive from this base class. This base class provides: |
116 * - A way to associate an ns3::TypeId to each object instance. | 141 * - A way to associate an ns3::TypeId to each object instance. |
117 * - A way to set and get the attributes registered in the ns3::TypeId. | 142 * - A way to set and get the attributes registered in the ns3::TypeId. |
118 */ | 143 */ |
119 class ObjectBase | 144 class NS3_EXPORT ObjectBase |
120 { | 145 { |
121 public: | 146 public: |
122 /** | 147 /** |
123 * Get the type ID. | 148 * Get the type ID. |
124 * \return The object TypeId. | 149 * \return The object TypeId. |
125 */ | 150 */ |
126 static TypeId GetTypeId (void); | 151 static TypeId GetTypeId (void); |
127 | 152 |
128 /** | 153 /** |
129 * Virtual destructor. | 154 * Virtual destructor. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 */ | 304 */ |
280 bool DoSet (Ptr<const AttributeAccessor> spec, | 305 bool DoSet (Ptr<const AttributeAccessor> spec, |
281 Ptr<const AttributeChecker> checker,· | 306 Ptr<const AttributeChecker> checker,· |
282 const AttributeValue &value); | 307 const AttributeValue &value); |
283 | 308 |
284 }; | 309 }; |
285 | 310 |
286 } // namespace ns3 | 311 } // namespace ns3 |
287 | 312 |
288 #endif /* OBJECT_BASE_H */ | 313 #endif /* OBJECT_BASE_H */ |
LEFT | RIGHT |