A Discrete-Event Network Simulator
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  *
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
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * GNU General Public License for more details.
13  *
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
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #ifndef CONFIG_H
21 #define CONFIG_H
23 #include "ptr.h"
24 #include <string>
25 #include <vector>
33 namespace ns3 {
35 class AttributeValue;
36 class Object;
37 class CallbackBase;
49 namespace Config {
56 void Reset (void);
67 void Set (std::string path, const AttributeValue &value);
72 bool SetFailSafe (std::string path, const AttributeValue &value);
82 void SetDefault (std::string name, const AttributeValue &value);
92 bool SetDefaultFailSafe (std::string name, const AttributeValue &value);
100 void SetGlobal (std::string name, const AttributeValue &value);
109 bool SetGlobalFailSafe (std::string name, const AttributeValue &value);
119 void ConnectWithoutContext (std::string path, const CallbackBase &cb);
124 bool ConnectWithoutContextFailSafe (std::string path, const CallbackBase &cb);
132 void DisconnectWithoutContext (std::string path, const CallbackBase &cb);
143 void Connect (std::string path, const CallbackBase &cb);
148 bool ConnectFailSafe (std::string path, const CallbackBase &cb);
156 void Disconnect (std::string path, const CallbackBase &cb);
167 {
168 public:
170  typedef std::vector<Ptr<Object> >::const_iterator Iterator;
171  MatchContainer ();
179  MatchContainer (const std::vector<Ptr<Object> > &objects,
180  const std::vector<std::string> &contexts,
181  std::string path);
186  MatchContainer::Iterator Begin (void) const;
190  MatchContainer::Iterator End (void) const;
194  std::size_t GetN (void) const;
199  Ptr<Object> Get (std::size_t i) const;
207  std::string GetMatchedPath (uint32_t i) const;
211  std::string GetPath (void) const;
221  void Set (std::string name, const AttributeValue &value);
226  bool SetFailSafe (std::string name, const AttributeValue &value);
235  void Connect (std::string name, const CallbackBase &cb);
240  bool ConnectFailSafe (std::string name, const CallbackBase &cb);
249  void ConnectWithoutContext (std::string name, const CallbackBase &cb);
254  bool ConnectWithoutContextFailSafe (std::string name, const CallbackBase &cb);
263  void Disconnect (std::string name, const CallbackBase &cb);
272  void DisconnectWithoutContext (std::string name, const CallbackBase &cb);
274 private:
276  std::vector<Ptr<Object> > m_objects;
278  std::vector<std::string> m_contexts;
280  std::string m_path;
281 };
289 MatchContainer LookupMatches (std::string path);
311 std::size_t GetRootNamespaceObjectN (void);
320 } // namespace Config
322 } // namespace ns3
324 #endif /* CONFIG_H */
std::string GetMatchedPath(uint32_t i) const
Definition: config.cc:81
bool ConnectWithoutContextFailSafe(std::string name, const CallbackBase &cb)
Definition: config.cc:147
bool SetDefaultFailSafe(std::string fullName, const AttributeValue &value)
Definition: config.cc:857
bool SetFailSafe(std::string path, const AttributeValue &value)
Definition: config.cc:844
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:839
bool SetGlobalFailSafe(std::string name, const AttributeValue &value)
Definition: config.cc:894
void UnregisterRootNamespaceObject(Ptr< Object > obj)
Definition: config.cc:947
ns3::Ptr smart pointer declaration and implementation.
Hold a value for an Attribute.
Definition: attribute.h:68
Base class for Callback class.
Definition: callback.h:1195
void Disconnect(std::string name, const CallbackBase &cb)
Definition: config.cc:159
void DisconnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:909
Ptr< Object > Get(std::size_t i) const
Definition: config.cc:75
std::size_t GetN(void) const
Definition: config.cc:69
void RegisterRootNamespaceObject(Ptr< Object > obj)
Definition: config.cc:941
bool ConnectFailSafe(std::string name, const CallbackBase &cb)
Definition: config.cc:125
void ConnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: config.cc:139
Ptr< Object > GetRootNamespaceObject(uint32_t i)
Definition: config.cc:959
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:899
bool SetFailSafe(std::string name, const AttributeValue &value)
Definition: config.cc:105
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:915
MatchContainer::Iterator Begin(void) const
Definition: config.cc:57
bool ConnectWithoutContextFailSafe(std::string path, const CallbackBase &cb)
Definition: config.cc:904
std::string m_path
The path used to perform the object matching.
Definition: config.h:280
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::size_t GetRootNamespaceObjectN(void)
Definition: config.cc:953
bool ConnectFailSafe(std::string path, const CallbackBase &cb)
Definition: config.cc:924
hold a set of objects which match a specific search string.
Definition: config.h:166
std::vector< Ptr< Object > > m_objects
The list of objects in this container.
Definition: config.h:276
void Connect(std::string name, const CallbackBase &cb)
Definition: config.cc:117
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
Definition: config.cc:820
MatchContainer LookupMatches(std::string path)
Definition: config.cc:935
void DisconnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: config.cc:171
void SetGlobal(std::string name, const AttributeValue &value)
Definition: config.cc:889
std::vector< std::string > m_contexts
The context for each object.
Definition: config.h:278
MatchContainer::Iterator End(void) const
Definition: config.cc:63
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
std::vector< Ptr< Object > >::const_iterator Iterator
Const iterator over the objects in this container.
Definition: config.h:170
void Set(std::string name, const AttributeValue &value)
Definition: config.cc:94
void Disconnect(std::string path, const CallbackBase &cb)
Definition: config.cc:930
std::string GetPath(void) const
Definition: config.cc:87