A Discrete-Event Network Simulator
API
config.h
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
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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
22 
23 #include "ptr.h"
24 #include <string>
25 #include <vector>
26 
33 namespace ns3 {
34 
35 class AttributeValue;
36 class Object;
37 class CallbackBase;
38 
49 namespace Config {
50 
56 void Reset (void);
57 
67 void Set (std::string path, const AttributeValue &value);
77 void SetDefault (std::string name, const AttributeValue &value);
87 bool SetDefaultFailSafe (std::string name, const AttributeValue &value);
95 void SetGlobal (std::string name, const AttributeValue &value);
103 bool SetGlobalFailSafe (std::string name, const AttributeValue &value);
113 void ConnectWithoutContext (std::string path, const CallbackBase &cb);
121 void DisconnectWithoutContext (std::string path, const CallbackBase &cb);
132 void Connect (std::string path, const CallbackBase &cb);
140 void Disconnect (std::string path, const CallbackBase &cb);
141 
151 {
152 public:
153  typedef std::vector<Ptr<Object> >::const_iterator Iterator;
154  MatchContainer ();
155  // constructor used only by implementation.
156  MatchContainer (const std::vector<Ptr<Object> > &objects,
157  const std::vector<std::string> &contexts,
158  std::string path);
159 
163  MatchContainer::Iterator Begin (void) const;
167  MatchContainer::Iterator End (void) const;
171  uint32_t GetN (void) const;
176  Ptr<Object> Get (uint32_t i) const;
184  std::string GetMatchedPath (uint32_t i) const;
188  std::string GetPath (void) const;
189 
198  void Set (std::string name, const AttributeValue &value);
207  void Connect (std::string name, const CallbackBase &cb);
216  void ConnectWithoutContext (std::string name, const CallbackBase &cb);
225  void Disconnect (std::string name, const CallbackBase &cb);
234  void DisconnectWithoutContext (std::string name, const CallbackBase &cb);
235 private:
236  std::vector<Ptr<Object> > m_objects;
237  std::vector<std::string> m_contexts;
238  std::string m_path;
239 };
240 
247 MatchContainer LookupMatches (std::string path);
248 
264 
269 uint32_t GetRootNamespaceObjectN (void);
270 
277 
278 } // namespace Config
279 
280 } // namespace ns3
281 
282 #endif /* CONFIG_H */
bool SetDefaultFailSafe(std::string fullName, const AttributeValue &value)
Definition: config.cc:691
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:678
bool SetGlobalFailSafe(std::string name, const AttributeValue &value)
Definition: config.cc:728
void UnregisterRootNamespaceObject(Ptr< Object > obj)
Definition: config.cc:767
Smart pointer implementation.
Hold a value for an Attribute.
Definition: attribute.h:68
Base class for Callback class.
Definition: callback.h:906
std::string GetMatchedPath(uint32_t i) const
Definition: config.cc:81
void Disconnect(std::string name, const CallbackBase &cb)
Definition: config.cc:127
void DisconnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:738
void RegisterRootNamespaceObject(Ptr< Object > obj)
Definition: config.cc:761
MatchContainer::Iterator End(void) const
Definition: config.cc:63
void ConnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: config.cc:116
Ptr< Object > GetRootNamespaceObject(uint32_t i)
Definition: config.cc:779
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:733
uint32_t GetRootNamespaceObjectN(void)
Definition: config.cc:773
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:744
uint32_t GetN(void) const
Definition: config.cc:69
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< Object > Get(uint32_t i) const
Definition: config.cc:75
hold a set of objects which match a specific search string.
Definition: config.h:150
std::vector< Ptr< Object > > m_objects
Definition: config.h:236
void Connect(std::string name, const CallbackBase &cb)
Definition: config.cc:104
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:658
Config::MatchContainer LookupMatches(std::string path)
Definition: config.cc:755
void DisconnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: config.cc:139
void SetGlobal(std::string name, const AttributeValue &value)
Definition: config.cc:723
std::vector< std::string > m_contexts
Definition: config.h:237
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:683
std::vector< Ptr< Object > >::const_iterator Iterator
Definition: config.h:153
void Set(std::string name, const AttributeValue &value)
Definition: config.cc:94
MatchContainer::Iterator Begin(void) const
Definition: config.cc:57
void Disconnect(std::string path, const CallbackBase &cb)
Definition: config.cc:750
std::string GetPath(void) const
Definition: config.cc:87