src/core/config.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 16 Oct 2008 12:53:05 +0200
changeset 3752 5ab2feb083a0
parent 3190 51fe9001a679
child 3763 e46e361a4262
permissions -rw-r--r--
bug 202: header file conflict
     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 NS3_CONFIG_H
    21 #define NS3_CONFIG_H
    22 
    23 #include "ptr.h"
    24 #include <string>
    25 
    26 namespace ns3 {
    27 
    28 class AttributeValue;
    29 class Object;
    30 class CallbackBase;
    31 
    32 /**
    33  * \brief Configuration of simulation parameters and tracing
    34  * \ingroup core
    35  */
    36 namespace Config {
    37 
    38 /**
    39  * \param path a path to match attributes.
    40  * \param value the value to set in all matching attributes.
    41  *
    42  * This function will attempt to find attributes which
    43  * match the input path and will then set their value to the input
    44  * value.
    45  */
    46 void Set (std::string path, const AttributeValue &value);
    47 /**
    48  * \param name the full name of the attribute
    49  * \param value the value to set.
    50  *
    51  * This method overrides the initial value of the 
    52  * matching attribute. This method cannot fail: it will
    53  * crash if the input attribute name or value is invalid.
    54  */
    55 void SetDefault (std::string name, const AttributeValue &value);
    56 /**
    57  * \param name the full name of the attribute
    58  * \param value the value to set.
    59  * \returns true if the value was set successfully, false otherwise.
    60  *
    61  * This method overrides the initial value of the 
    62  * matching attribute. 
    63  */
    64 bool SetDefaultFailSafe (std::string name, const AttributeValue &value);
    65 /**
    66  * \param name the name of the requested GlobalValue.
    67  * \param value the value to set
    68  *
    69  * This method is equivalent to GlobalValue::Bind
    70  */
    71 void SetGlobal (std::string name, const AttributeValue &value);
    72 /**
    73  * \param name the name of the requested GlobalValue.
    74  * \param value the value to set
    75  *
    76  * This method is equivalent to GlobalValue::BindFailSafe
    77  */
    78 bool SetGlobalFailSafe (std::string name, const AttributeValue &value);
    79 /**
    80  * \param path a path to match trace sources.
    81  * \param cb the callback to connect to the matching trace sources.
    82  *
    83  * This function will attempt to find all trace sources which
    84  * match the input path and will then connect the input callback
    85  * to them.
    86  */
    87 void ConnectWithoutContext (std::string path, const CallbackBase &cb);
    88 /**
    89  * \param path a path to match trace sources.
    90  * \param cb the callback to disconnect to the matching trace sources.
    91  *
    92  * This function undoes the work of Config::Connect.
    93  */
    94 void DisconnectWithoutContext (std::string path, const CallbackBase &cb);
    95 /**
    96  * \param path a path to match trace sources.
    97  * \param cb the callback to connect to the matching trace sources.
    98  *
    99  * This function will attempt to find all trace sources which
   100  * match the input path and will then connect the input callback
   101  * to them in such a way that the callback will receive an extra
   102  * context string upon trace event notification.
   103  */
   104 void Connect (std::string path, const CallbackBase &cb);
   105 /**
   106  * \param path a path to match trace sources.
   107  * \param cb the callback to connect to the matching trace sources.
   108  *
   109  * This function undoes the work of Config::ConnectWithContext.
   110  */
   111 void Disconnect (std::string path, const CallbackBase &cb);
   112 
   113 /**
   114  * \param obj a new root object
   115  *
   116  * Each root object is used during path matching as
   117  * the root of the path by Config::Connect, and Config::Set.
   118  */
   119 void RegisterRootNamespaceObject (Ptr<Object> obj);
   120 /**
   121  * \param obj a new root object
   122  *
   123  * This function undoes the work of Config::RegisterRootNamespaceObject.
   124  */
   125 void UnregisterRootNamespaceObject (Ptr<Object> obj);
   126 
   127 /**
   128  * \returns the number of registered root namespace objects.
   129  */
   130 uint32_t GetRootNamespaceObjectN (void);
   131 
   132 /**
   133  * \param i the index of the requested object.
   134  * \returns the requested root namespace object
   135  */
   136 Ptr<Object> GetRootNamespaceObject (uint32_t i);
   137 
   138 } // namespace Config
   139 
   140 } // namespace ns3
   141 
   142 #endif /* NS3_CONFIG_H */