/usr/include/ns3.26/ns3/config.h is in libns3-dev 3.26+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "ptr.h"
#include <string>
#include <vector>
/**
* \file
* \ingroup config
* Declaration of the various ns3::Config functions and classes.
*/
namespace ns3 {
class AttributeValue;
class Object;
class CallbackBase;
/**
* \ingroup core
* \defgroup config Configuration
* \brief Configuration of simulation parameters and tracing.
*/
/**
* \ingroup config
* Namespace for the various functions implementing the Config system.
*/
namespace Config {
/**
* \ingroup config
* Reset the initial value of every attribute as well as the value of every
* global to what they were before any call to SetDefault and SetGlobal.
*/
void Reset (void);
/**
* \ingroup config
* \param [in] path A path to match attributes.
* \param [in] value The value to set in all matching attributes.
*
* This function will attempt to find attributes which
* match the input path and will then set their value to the input
* value.
*/
void Set (std::string path, const AttributeValue &value);
/**
* \ingroup config
* \param [in] name The full name of the attribute
* \param [in] value The value to set.
*
* This method overrides the initial value of the
* matching attribute. This method cannot fail: it will
* crash if the input attribute name or value is invalid.
*/
void SetDefault (std::string name, const AttributeValue &value);
/**
* \ingroup config
* \param [in] name The full name of the attribute
* \param [in] value The value to set.
* \returns \c true if the value was set successfully, false otherwise.
*
* This method overrides the initial value of the
* matching attribute.
*/
bool SetDefaultFailSafe (std::string name, const AttributeValue &value);
/**
* \ingroup config
* \param [in] name The name of the requested GlobalValue.
* \param [in] value The value to set
*
* This method is equivalent to GlobalValue::Bind
*/
void SetGlobal (std::string name, const AttributeValue &value);
/**
* \ingroup config
* \param [in] name The name of the requested GlobalValue.
* \param [in] value The value to set
* \return \c true if the GlobalValue could be set.
*
* This method is equivalent to GlobalValue::BindFailSafe
*/
bool SetGlobalFailSafe (std::string name, const AttributeValue &value);
/**
* \ingroup config
* \param [in] path A path to match trace sources.
* \param [in] cb The callback to connect to the matching trace sources.
*
* This function will attempt to find all trace sources which
* match the input path and will then connect the input callback
* to them.
*/
void ConnectWithoutContext (std::string path, const CallbackBase &cb);
/**
* \ingroup config
* \param [in] path A path to match trace sources.
* \param [in] cb The callback to disconnect to the matching trace sources.
*
* This function undoes the work of Config::Connect.
*/
void DisconnectWithoutContext (std::string path, const CallbackBase &cb);
/**
* \ingroup config
* \param [in] path A path to match trace sources.
* \param [in] cb The callback to connect to the matching trace sources.
*
* This function will attempt to find all trace sources which
* match the input path and will then connect the input callback
* to them in such a way that the callback will receive an extra
* context string upon trace event notification.
*/
void Connect (std::string path, const CallbackBase &cb);
/**
* \ingroup config
* \param [in] path A path to match trace sources.
* \param [in] cb The callback to connect to the matching trace sources.
*
* This function undoes the work of Config::ConnectWithContext.
*/
void Disconnect (std::string path, const CallbackBase &cb);
/**
* \ingroup config
* \brief hold a set of objects which match a specific search string.
*
* This class also allows you to perform a set of configuration operations
* on the set of matching objects stored in the container. Specifically,
* it is possible to perform bulk Connects and Sets.
*/
class MatchContainer
{
public:
/** Const iterator over the objects in this container. */
typedef std::vector<Ptr<Object> >::const_iterator Iterator;
MatchContainer ();
/**
* Constructor used only by implementation.
*
* \param [in] objects The vector of objects to store in this container.
* \param [in] contexts The corresponding contexts.
* \param [in] path The path used for object matching.
*/
MatchContainer (const std::vector<Ptr<Object> > &objects,
const std::vector<std::string> &contexts,
std::string path);
/**
* \returns An iterator which points to the first item in the container
*/
MatchContainer::Iterator Begin (void) const;
/**
* \returns An iterator which points to the last item in the container
*/
MatchContainer::Iterator End (void) const;
/**
* \returns The number of items in the container
*/
uint32_t GetN (void) const;
/**
* \param [in] i Index of item to lookup ([0,n[)
* \returns The item requested.
*/
Ptr<Object> Get (uint32_t i) const;
/**
* \param [in] i Index of item to lookup ([0,n[)
* \returns The fully-qualified matching path associated
* to the requested item.
*
* The matching patch uniquely identifies the requested object.
*/
std::string GetMatchedPath (uint32_t i) const;
/**
* \returns The path used to perform the object matching.
*/
std::string GetPath (void) const;
/**
* \param [in] name Name of attribute to set
* \param [in] value Value to set to the attribute
*
* Set the specified attribute value to all the objects stored in this
* container.
* \sa ns3::Config::Set
*/
void Set (std::string name, const AttributeValue &value);
/**
* \param [in] name The name of the trace source to connect to
* \param [in] cb The sink to connect to the trace source
*
* Connect the specified sink to all the objects stored in this
* container.
* \sa ns3::Config::Connect
*/
void Connect (std::string name, const CallbackBase &cb);
/**
* \param [in] name The name of the trace source to connect to
* \param [in] cb The sink to connect to the trace source
*
* Connect the specified sink to all the objects stored in this
* container.
* \sa ns3::Config::ConnectWithoutContext
*/
void ConnectWithoutContext (std::string name, const CallbackBase &cb);
/**
* \param [in] name The name of the trace source to disconnect from
* \param [in] cb The sink to disconnect from the trace source
*
* Disconnect the specified sink from all the objects stored in this
* container.
* \sa ns3::Config::Disconnect
*/
void Disconnect (std::string name, const CallbackBase &cb);
/**
* \param [in] name The name of the trace source to disconnect from
* \param [in] cb The sink to disconnect from the trace source
*
* Disconnect the specified sink from all the objects stored in this
* container.
* \sa ns3::Config::DisconnectWithoutContext
*/
void DisconnectWithoutContext (std::string name, const CallbackBase &cb);
private:
/** The list of objects in this container. */
std::vector<Ptr<Object> > m_objects;
/** The context for each object. */
std::vector<std::string> m_contexts;
/** The path used to perform the object matching. */
std::string m_path;
};
/**
* \ingroup config
* \param [in] path The path to perform a match against
* \returns A container which contains all the objects which match the input
* path.
*/
MatchContainer LookupMatches (std::string path);
/**
* \ingroup config
* \param [in] obj A new root object
*
* Each root object is used during path matching as
* the root of the path by Config::Connect, and Config::Set.
*/
void RegisterRootNamespaceObject (Ptr<Object> obj);
/**
* \ingroup config
* \param [in] obj A new root object
*
* This function undoes the work of Config::RegisterRootNamespaceObject.
*/
void UnregisterRootNamespaceObject (Ptr<Object> obj);
/**
* \ingroup config
* \returns The number of registered root namespace objects.
*/
uint32_t GetRootNamespaceObjectN (void);
/**
* \ingroup config
* \param [in] i The index of the requested object.
* \returns The requested root namespace object
*/
Ptr<Object> GetRootNamespaceObject (uint32_t i);
} // namespace Config
} // namespace ns3
#endif /* CONFIG_H */
|