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 
68 void Set (std::string path, const AttributeValue &value);
75 bool SetFailSafe (std::string path, const AttributeValue &value);
85 void SetDefault (std::string name, const AttributeValue &value);
95 bool SetDefaultFailSafe (std::string name, const AttributeValue &value);
103 void SetGlobal (std::string name, const AttributeValue &value);
112 bool SetGlobalFailSafe (std::string name, const AttributeValue &value);
124 void ConnectWithoutContext (std::string path, const CallbackBase &cb);
132 bool ConnectWithoutContextFailSafe (std::string path, const CallbackBase &cb);
140 void DisconnectWithoutContext (std::string path, const CallbackBase &cb);
154 void Connect (std::string path, const CallbackBase &cb);
162 bool ConnectFailSafe (std::string path, const CallbackBase &cb);
170 void Disconnect (std::string path, const CallbackBase &cb);
171 
181 {
182 public:
184  typedef std::vector<Ptr<Object> >::const_iterator Iterator;
185  MatchContainer ();
193  MatchContainer (const std::vector<Ptr<Object> > &objects,
194  const std::vector<std::string> &contexts,
195  std::string path);
196 
200  MatchContainer::Iterator Begin (void) const;
204  MatchContainer::Iterator End (void) const;
208  std::size_t GetN (void) const;
213  Ptr<Object> Get (std::size_t i) const;
221  std::string GetMatchedPath (uint32_t i) const;
225  std::string GetPath (void) const;
226 
237  void Set (std::string name, const AttributeValue &value);
244  bool SetFailSafe (std::string name, const AttributeValue &value);
255  void Connect (std::string name, const CallbackBase &cb);
262  bool ConnectFailSafe (std::string name, const CallbackBase &cb);
273  void ConnectWithoutContext (std::string name, const CallbackBase &cb);
280  bool ConnectWithoutContextFailSafe (std::string name, const CallbackBase &cb);
289  void Disconnect (std::string name, const CallbackBase &cb);
298  void DisconnectWithoutContext (std::string name, const CallbackBase &cb);
299 
300 private:
302  std::vector<Ptr<Object> > m_objects;
304  std::vector<std::string> m_contexts;
306  std::string m_path;
307 };
308 
315 MatchContainer LookupMatches (std::string path);
316 
332 
337 std::size_t GetRootNamespaceObjectN (void);
338 
345 
346 } // namespace Config
347 
348 } // namespace ns3
349 
350 #endif /* CONFIG_H */
ns3::Config::Set
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:839
ns3::Config::MatchContainer::SetFailSafe
bool SetFailSafe(std::string name, const AttributeValue &value)
Set the specified attribute value to all the objects stored in this container.
Definition: config.cc:105
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Config::MatchContainer::Begin
MatchContainer::Iterator Begin(void) const
Definition: config.cc:57
ns3::Config::MatchContainer::m_path
std::string m_path
The path used to perform the object matching.
Definition: config.h:306
ns3::Config::MatchContainer::m_objects
std::vector< Ptr< Object > > m_objects
The list of objects in this container.
Definition: config.h:302
ns3::Config::MatchContainer::Connect
void Connect(std::string name, const CallbackBase &cb)
Definition: config.cc:117
ns3::Config::MatchContainer::DisconnectWithoutContext
void DisconnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: config.cc:171
ns3::AttributeValue
Hold a value for an Attribute.
Definition: attribute.h:69
ns3::Config::GetRootNamespaceObject
Ptr< Object > GetRootNamespaceObject(uint32_t i)
Definition: config.cc:964
ns3::Config::Reset
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
ns3::Config::RegisterRootNamespaceObject
void RegisterRootNamespaceObject(Ptr< Object > obj)
Definition: config.cc:946
ns3::Config::LookupMatches
MatchContainer LookupMatches(std::string path)
Definition: config.cc:940
ns3::Config::MatchContainer::Iterator
std::vector< Ptr< Object > >::const_iterator Iterator
Const iterator over the objects in this container.
Definition: config.h:184
ns3::Config::MatchContainer::m_contexts
std::vector< std::string > m_contexts
The context for each object.
Definition: config.h:304
ns3::Config::MatchContainer
hold a set of objects which match a specific search string.
Definition: config.h:181
ns3::Config::SetGlobalFailSafe
bool SetGlobalFailSafe(std::string name, const AttributeValue &value)
Definition: config.cc:896
ns3::Config::MatchContainer::End
MatchContainer::Iterator End(void) const
Definition: config.cc:63
ns3::Ptr< Object >
ns3::Config::ConnectWithoutContext
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:901
ns3::Config::GetRootNamespaceObjectN
std::size_t GetRootNamespaceObjectN(void)
Definition: config.cc:958
ns3::Config::MatchContainer::GetMatchedPath
std::string GetMatchedPath(uint32_t i) const
Definition: config.cc:81
ns3::Config::MatchContainer::ConnectWithoutContextFailSafe
bool ConnectWithoutContextFailSafe(std::string name, const CallbackBase &cb)
Connect the specified sink to all the objects stored in this container.
Definition: config.cc:147
ns3::Config::MatchContainer::Set
void Set(std::string name, const AttributeValue &value)
Definition: config.cc:94
ns3::Config::ConnectWithoutContextFailSafe
bool ConnectWithoutContextFailSafe(std::string path, const CallbackBase &cb)
This function will attempt to find all trace sources which match the input path and will then connect...
Definition: config.cc:909
ns3::Config::ConnectFailSafe
bool ConnectFailSafe(std::string path, const CallbackBase &cb)
This function will attempt to find all trace sources which match the input path and will then connect...
Definition: config.cc:929
ns3::Config::UnregisterRootNamespaceObject
void UnregisterRootNamespaceObject(Ptr< Object > obj)
Definition: config.cc:952
ns3::Config::DisconnectWithoutContext
void DisconnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:914
ns3::Config::MatchContainer::GetPath
std::string GetPath(void) const
Definition: config.cc:87
ns3::Config::MatchContainer::GetN
std::size_t GetN(void) const
Definition: config.cc:69
ns3::Config::Connect
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:920
ns3::Config::SetDefaultFailSafe
bool SetDefaultFailSafe(std::string fullName, const AttributeValue &value)
Definition: config.cc:857
ns3::Config::MatchContainer::Disconnect
void Disconnect(std::string name, const CallbackBase &cb)
Definition: config.cc:159
ns3::Config::MatchContainer::Get
Ptr< Object > Get(std::size_t i) const
Definition: config.cc:75
ns3::CallbackBase
Base class for Callback class.
Definition: callback.h:1196
ns3::Config::SetFailSafe
bool SetFailSafe(std::string path, const AttributeValue &value)
This function will attempt to find attributes which match the input path and will then set their valu...
Definition: config.cc:844
ns3::Config::SetGlobal
void SetGlobal(std::string name, const AttributeValue &value)
Definition: config.cc:891
ns3::Config::SetDefault
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
ns3::Config::MatchContainer::ConnectFailSafe
bool ConnectFailSafe(std::string name, const CallbackBase &cb)
Connect the specified sink to all the objects stored in this container.
Definition: config.cc:125
ptr.h
ns3::Ptr smart pointer declaration and implementation.
ns3::Config::Disconnect
void Disconnect(std::string path, const CallbackBase &cb)
Definition: config.cc:935
ns3::Config::MatchContainer::MatchContainer
MatchContainer()
Definition: config.cc:43
ns3::Config::MatchContainer::ConnectWithoutContext
void ConnectWithoutContext(std::string name, const CallbackBase &cb)
Definition: config.cc:139