A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
27 namespace ns3 {
28 
29 class AttributeValue;
30 class Object;
31 class CallbackBase;
32 
37 namespace Config {
38 
43 void Reset (void);
44 
53 void Set (std::string path, const AttributeValue &value);
62 void SetDefault (std::string name, const AttributeValue &value);
71 bool SetDefaultFailSafe (std::string name, const AttributeValue &value);
78 void SetGlobal (std::string name, const AttributeValue &value);
85 bool SetGlobalFailSafe (std::string name, const AttributeValue &value);
94 void ConnectWithoutContext (std::string path, const CallbackBase &cb);
101 void DisconnectWithoutContext (std::string path, const CallbackBase &cb);
111 void Connect (std::string path, const CallbackBase &cb);
118 void Disconnect (std::string path, const CallbackBase &cb);
119 
128 {
129 public:
130  typedef std::vector<Ptr<Object> >::const_iterator Iterator;
131  MatchContainer ();
132  // constructor used only by implementation.
133  MatchContainer (const std::vector<Ptr<Object> > &objects,
134  const std::vector<std::string> &contexts,
135  std::string path);
136 
140  MatchContainer::Iterator Begin (void) const;
144  MatchContainer::Iterator End (void) const;
148  uint32_t GetN (void) const;
153  Ptr<Object> Get (uint32_t i) const;
161  std::string GetMatchedPath (uint32_t i) const;
165  std::string GetPath (void) const;
166 
175  void Set (std::string name, const AttributeValue &value);
184  void Connect (std::string name, const CallbackBase &cb);
193  void ConnectWithoutContext (std::string name, const CallbackBase &cb);
202  void Disconnect (std::string name, const CallbackBase &cb);
211  void DisconnectWithoutContext (std::string name, const CallbackBase &cb);
212 private:
213  std::vector<Ptr<Object> > m_objects;
214  std::vector<std::string> m_contexts;
215  std::string m_path;
216 };
217 
223 MatchContainer LookupMatches (std::string path);
224 
238 
242 uint32_t GetRootNamespaceObjectN (void);
243 
249 
250 } // namespace Config
251 
252 } // namespace ns3
253 
254 #endif /* CONFIG_H */
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:642
Hold a value for an Attribute.
Definition: attribute.h:56
void Disconnect(std::string path, const CallbackBase &cb)
Definition: config.cc:734
Base class for Callback class.
Definition: callback.h:848
std::string GetMatchedPath(uint32_t i) const
Definition: config.cc:75
void Disconnect(std::string name, const CallbackBase &cb)
Definition: config.cc:121
void UnregisterRootNamespaceObject(Ptr< Object > obj)
Definition: config.cc:751
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:662
Ptr< Object > GetRootNamespaceObject(uint32_t i)
Definition: config.cc:763
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:728
MatchContainer::Iterator End(void) const
Definition: config.cc:57
bool SetDefaultFailSafe(std::string fullName, const AttributeValue &value)
Definition: config.cc:675
Config::MatchContainer LookupMatches(std::string path)
Definition: config.cc:739
void ConnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: config.cc:110
uint32_t GetN(void) const
Definition: config.cc:63
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:667
Ptr< Object > Get(uint32_t i) const
Definition: config.cc:69
hold a set of objects which match a specific search string.
Definition: config.h:127
std::vector< Ptr< Object > > m_objects
Definition: config.h:213
void Connect(std::string name, const CallbackBase &cb)
Definition: config.cc:98
void RegisterRootNamespaceObject(Ptr< Object > obj)
Definition: config.cc:745
void DisconnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: config.cc:133
bool SetGlobalFailSafe(std::string name, const AttributeValue &value)
Definition: config.cc:712
void DisconnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:722
std::vector< std::string > m_contexts
Definition: config.h:214
std::vector< Ptr< Object > >::const_iterator Iterator
Definition: config.h:130
uint32_t GetRootNamespaceObjectN(void)
Definition: config.cc:757
void Set(std::string name, const AttributeValue &value)
Definition: config.cc:88
MatchContainer::Iterator Begin(void) const
Definition: config.cc:51
std::string GetPath(void) const
Definition: config.cc:81
void SetGlobal(std::string name, const AttributeValue &value)
Definition: config.cc:707
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:717