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) 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_FACTORY_H | 20 #ifndef OBJECT_FACTORY_H |
21 #define OBJECT_FACTORY_H | 21 #define OBJECT_FACTORY_H |
22 | 22 |
23 #include "attribute-construction-list.h" | 23 #include "attribute-construction-list.h" |
24 #include "object.h" | 24 #include "object.h" |
25 #include "type-id.h" | 25 #include "type-id.h" |
26 | 26 |
| 27 #include "ns3/ns3-module.h" |
| 28 #define NS3_MODULE NS3_CORE_MODULE |
| 29 #include "ns3/ns3-export.h" |
| 30 |
27 /** | 31 /** |
28 * \file | 32 * \file |
29 * \ingroup object | 33 * \ingroup object |
30 * ns3::ObjectFactory class declaration. | 34 * ns3::ObjectFactory class declaration. |
31 */ | 35 */ |
32 | 36 |
33 namespace ns3 { | 37 namespace ns3 { |
34 | 38 |
35 class AttributeValue; | 39 class AttributeValue; |
36 | 40 |
37 /** | 41 /** |
38 * \ingroup object | 42 * \ingroup object |
39 * | 43 * |
40 * \brief Instantiate subclasses of ns3::Object. | 44 * \brief Instantiate subclasses of ns3::Object. |
41 * | 45 * |
42 * This class can also hold a set of attributes to set | 46 * This class can also hold a set of attributes to set |
43 * automatically during the object construction. | 47 * automatically during the object construction. |
44 * | 48 * |
45 * \see attribute_ObjectFactory | 49 * \see attribute_ObjectFactory |
46 */ | 50 */ |
47 class ObjectFactory | 51 class NS3_EXPORT ObjectFactory |
48 { | 52 { |
49 public: | 53 public: |
50 /** | 54 /** |
51 * Default constructor. | 55 * Default constructor. |
52 * | 56 * |
53 * This factory is not capable of constructing a real Object | 57 * This factory is not capable of constructing a real Object |
54 * until it has at least a TypeId. | 58 * until it has at least a TypeId. |
55 */ | 59 */ |
56 ObjectFactory (); | 60 ObjectFactory (); |
57 /** | 61 /** |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 /** | 113 /** |
110 * Print the factory configuration on an output stream. | 114 * Print the factory configuration on an output stream. |
111 * | 115 * |
112 * The configuration will be printed as a string with the form | 116 * The configuration will be printed as a string with the form |
113 * "<TypeId-name>[<attribute-name>=<attribute-value>|...]" | 117 * "<TypeId-name>[<attribute-name>=<attribute-value>|...]" |
114 * | 118 * |
115 * \param [in,out] os The stream. | 119 * \param [in,out] os The stream. |
116 * \param [in] factory The ObjectFactory. | 120 * \param [in] factory The ObjectFactory. |
117 * \returns The stream. | 121 * \returns The stream. |
118 */ | 122 */ |
119 friend std::ostream & operator << (std::ostream &os, const ObjectFactory &fact
ory); | 123 friend NS3_EXPORT std::ostream & operator << (std::ostream &os, const ObjectFa
ctory &factory); |
120 /** | 124 /** |
121 * Read a factory configuration from an input stream. | 125 * Read a factory configuration from an input stream. |
122 * | 126 * |
123 * The configuration should be in the form | 127 * The configuration should be in the form |
124 * "<TypeId-name>[<attribute-name>=<attribute-value>|...]" | 128 * "<TypeId-name>[<attribute-name>=<attribute-value>|...]" |
125 * | 129 * |
126 * \param [in,out] is The input stream. | 130 * \param [in,out] is The input stream. |
127 * \param [out] factory The factory to configure as described by the stream. | 131 * \param [out] factory The factory to configure as described by the stream. |
128 * \return The stream. | 132 * \return The stream. |
129 */ | 133 */ |
130 friend std::istream & operator >> (std::istream &is, ObjectFactory &factory); | 134 friend NS3_EXPORT std::istream & operator >> (std::istream &is, ObjectFactory
&factory); |
131 | 135 |
132 /** The TypeId this factory will create. */ | 136 /** The TypeId this factory will create. */ |
133 TypeId m_tid; | 137 TypeId m_tid; |
134 /** | 138 /** |
135 * The list of attributes and values to be used in constructing | 139 * The list of attributes and values to be used in constructing |
136 * objects by this factory. | 140 * objects by this factory. |
137 */ | 141 */ |
138 AttributeConstructionList m_parameters;·· | 142 AttributeConstructionList m_parameters;·· |
139 }; | 143 }; |
140 | 144 |
141 std::ostream & operator << (std::ostream &os, const ObjectFactory &factory); | 145 NS3_EXPORT std::ostream & operator << (std::ostream &os, const ObjectFactory &fa
ctory); |
142 std::istream & operator >> (std::istream &is, ObjectFactory &factory); | 146 NS3_EXPORT std::istream & operator >> (std::istream &is, ObjectFactory &factory)
; |
143 | 147 |
144 | 148 |
145 /** | 149 /** |
146 * \ingroup object | 150 * \ingroup object |
147 * Allocate an Object on the heap and initialize with a set of attributes. | 151 * Allocate an Object on the heap and initialize with a set of attributes. |
148 * | 152 * |
149 * \tparam T \explicit The requested Object type. | 153 * \tparam T \explicit The requested Object type. |
150 * \param [in] n1 Name of attribute | 154 * \param [in] n1 Name of attribute |
151 * \param [in] v1 Value of attribute | 155 * \param [in] v1 Value of attribute |
152 * \param [in] n2 Name of attribute | 156 * \param [in] n2 Name of attribute |
(...skipping 22 matching lines...) Expand all Loading... |
175 std::string n3 = "", const AttributeValue & v3 = EmptyAttributeValue (), | 179 std::string n3 = "", const AttributeValue & v3 = EmptyAttributeValue (), |
176 std::string n4 = "", const AttributeValue & v4 = EmptyAttributeValue (), | 180 std::string n4 = "", const AttributeValue & v4 = EmptyAttributeValue (), |
177 std::string n5 = "", const AttributeValue & v5 = EmptyAttributeValue (), | 181 std::string n5 = "", const AttributeValue & v5 = EmptyAttributeValue (), |
178 std::string n6 = "", const AttributeValue & v6 = EmptyAttributeValue (), | 182 std::string n6 = "", const AttributeValue & v6 = EmptyAttributeValue (), |
179 std::string n7 = "", const AttributeValue & v7 = EmptyAttributeValue (), | 183 std::string n7 = "", const AttributeValue & v7 = EmptyAttributeValue (), |
180 std::string n8 = "", const AttributeValue & v8 = EmptyAttributeValue (), | 184 std::string n8 = "", const AttributeValue & v8 = EmptyAttributeValue (), |
181 std::string n9 = "", const AttributeValue & v9 = EmptyAttributeValue () | 185 std::string n9 = "", const AttributeValue & v9 = EmptyAttributeValue () |
182 ); | 186 ); |
183 | 187 |
184 | 188 |
185 #ifdef _WIN32 | 189 ATTRIBUTE_HELPER_HEADER_LIB (ObjectFactory, NS3_EXPORT); |
186 ATTRIBUTE_HELPER_HEADER_LIB (ObjectFactory,NS3CORELIB); | |
187 #else | |
188 ATTRIBUTE_HELPER_HEADER (ObjectFactory); | |
189 #endif | |
190 | 190 |
191 } // namespace ns3 | 191 } // namespace ns3 |
192 | 192 |
193 | 193 |
194 /*************************************************************** | 194 /*************************************************************** |
195 * Implementation of the templates declared above. | 195 * Implementation of the templates declared above. |
196 ***************************************************************/ | 196 ***************************************************************/ |
197 | 197 |
198 namespace ns3 { | 198 namespace ns3 { |
199 | 199 |
(...skipping 28 matching lines...) Expand all Loading... |
228 factory.Set(n7, v7); | 228 factory.Set(n7, v7); |
229 factory.Set(n8, v8); | 229 factory.Set(n8, v8); |
230 factory.Set(n9, v9); | 230 factory.Set(n9, v9); |
231 return factory.Create<T> (); | 231 return factory.Create<T> (); |
232 } | 232 } |
233 | 233 |
234 | 234 |
235 } // namespace ns3 | 235 } // namespace ns3 |
236 | 236 |
237 #endif /* OBJECT_FACTORY_H */ | 237 #endif /* OBJECT_FACTORY_H */ |
LEFT | RIGHT |