A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19#ifndef CONFIG_H
20#define CONFIG_H
21
22#include "ptr.h"
23
24#include <string>
25#include <vector>
26
33namespace ns3
34{
35
36class AttributeValue;
37class Object;
38class CallbackBase;
39
50namespace Config
51{
52
58void Reset();
59
70void Set(std::string path, const AttributeValue& value);
81bool SetFailSafe(std::string path, const AttributeValue& value);
91void SetDefault(std::string name, const AttributeValue& value);
101bool SetDefaultFailSafe(std::string name, const AttributeValue& value);
109void SetGlobal(std::string name, const AttributeValue& value);
118bool SetGlobalFailSafe(std::string name, const AttributeValue& value);
130void ConnectWithoutContext(std::string path, const CallbackBase& cb);
142bool ConnectWithoutContextFailSafe(std::string path, const CallbackBase& cb);
150void DisconnectWithoutContext(std::string path, const CallbackBase& cb);
164void Connect(std::string path, const CallbackBase& cb);
176bool ConnectFailSafe(std::string path, const CallbackBase& cb);
184void Disconnect(std::string path, const CallbackBase& cb);
185
195{
196 public:
198 typedef std::vector<Ptr<Object>>::const_iterator Iterator;
207 MatchContainer(const std::vector<Ptr<Object>>& objects,
208 const std::vector<std::string>& contexts,
209 std::string path);
210
216
218 {
219 return Begin();
220 }
221
228
230 {
231 return End();
232 }
233
239 std::size_t GetN() const;
240
241 std::size_t size() const
242 {
243 return GetN();
244 }
245
251 Ptr<Object> Get(std::size_t i) const;
259 std::string GetMatchedPath(uint32_t i) const;
263 std::string GetPath() const;
264
275 void Set(std::string name, const AttributeValue& value);
285 bool SetFailSafe(std::string name, const AttributeValue& value);
296 void Connect(std::string name, const CallbackBase& cb);
306 bool ConnectFailSafe(std::string name, const CallbackBase& cb);
317 void ConnectWithoutContext(std::string name, const CallbackBase& cb);
327 bool ConnectWithoutContextFailSafe(std::string name, const CallbackBase& cb);
336 void Disconnect(std::string name, const CallbackBase& cb);
345 void DisconnectWithoutContext(std::string name, const CallbackBase& cb);
346
347 private:
349 std::vector<Ptr<Object>> m_objects;
351 std::vector<std::string> m_contexts;
353 std::string m_path;
354};
355
362MatchContainer LookupMatches(std::string path);
363
379
384std::size_t GetRootNamespaceObjectN();
385
392
393} // namespace Config
394
395} // namespace ns3
396
397#endif /* CONFIG_H */
Hold a value for an Attribute.
Definition: attribute.h:70
Base class for Callback class.
Definition: callback.h:360
hold a set of objects which match a specific search string.
Definition: config.h:195
bool SetFailSafe(std::string name, const AttributeValue &value)
Definition: config.cc:115
void Connect(std::string name, const CallbackBase &cb)
Definition: config.cc:128
void DisconnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: config.cc:187
void Set(std::string name, const AttributeValue &value)
Definition: config.cc:103
Ptr< Object > Get(std::size_t i) const
Definition: config.cc:82
void Disconnect(std::string name, const CallbackBase &cb)
Definition: config.cc:174
std::string GetMatchedPath(uint32_t i) const
Definition: config.cc:89
MatchContainer::Iterator End() const
Definition: config.cc:68
MatchContainer::Iterator begin() const
Definition: config.h:217
bool ConnectFailSafe(std::string name, const CallbackBase &cb)
Definition: config.cc:137
std::string GetPath() const
Definition: config.cc:96
bool ConnectWithoutContextFailSafe(std::string name, const CallbackBase &cb)
Definition: config.cc:161
std::size_t size() const
Definition: config.h:241
std::string m_path
The path used to perform the object matching.
Definition: config.h:353
void ConnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: config.cc:152
std::size_t GetN() const
Definition: config.cc:75
std::vector< Ptr< Object > >::const_iterator Iterator
Const iterator over the objects in this container.
Definition: config.h:198
MatchContainer::Iterator end() const
Definition: config.h:229
std::vector< Ptr< Object > > m_objects
The list of objects in this container.
Definition: config.h:349
MatchContainer::Iterator Begin() const
Definition: config.cc:61
std::vector< std::string > m_contexts
The context for each object.
Definition: config.h:351
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
void Reset()
Reset the initial value of every attribute as well as the value of every global to what they were bef...
Definition: config.cc:856
void SetGlobal(std::string name, const AttributeValue &value)
Definition: config.cc:937
bool SetFailSafe(std::string path, const AttributeValue &value)
Definition: config.cc:884
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:891
void Disconnect(std::string path, const CallbackBase &cb)
Definition: config.cc:992
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:975
MatchContainer LookupMatches(std::string path)
Definition: config.cc:999
void DisconnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:968
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:951
bool ConnectFailSafe(std::string path, const CallbackBase &cb)
Definition: config.cc:985
void UnregisterRootNamespaceObject(Ptr< Object > obj)
Definition: config.cc:1013
Ptr< Object > GetRootNamespaceObject(uint32_t i)
Definition: config.cc:1027
bool SetGlobalFailSafe(std::string name, const AttributeValue &value)
Definition: config.cc:944
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:877
void RegisterRootNamespaceObject(Ptr< Object > obj)
Definition: config.cc:1006
std::size_t GetRootNamespaceObjectN()
Definition: config.cc:1020
bool SetDefaultFailSafe(std::string fullName, const AttributeValue &value)
Definition: config.cc:901
bool ConnectWithoutContextFailSafe(std::string path, const CallbackBase &cb)
Definition: config.cc:961
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Ptr smart pointer declaration and implementation.