src/core/config.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 11 Mar 2008 13:46:22 -0700
changeset 2594 a8f89acd17a1
parent 2586 50d78910a997
child 2941 e1ff74674f87
permissions -rw-r--r--
Config::Connect -> Config::ConnectWithoutContext && Config::ConnectWithContext -> Config::Connect
     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 "attribute.h"
    24 #include "ptr.h"
    25 #include "object.h"
    26 #include <string>
    27 
    28 namespace ns3 {
    29 
    30 namespace Config {
    31 
    32 /**
    33  * \param path a path to match attributes.
    34  * \param value the value to set in all matching attributes.
    35  *
    36  * This function will attempt to find attributes which
    37  * match the input path and will then set their value to the input
    38  * value.
    39  */
    40 void Set (std::string path, Attribute value);
    41 /**
    42  * \param name the full name of the attribute
    43  * \param value the value to set.
    44  *
    45  * This method overrides the initial value of the 
    46  * matching attribute. This method cannot fail: it will
    47  * crash if the input attribute name or value is invalid.
    48  */
    49 void SetDefault (std::string name, Attribute value);
    50 /**
    51  * \param name the full name of the attribute
    52  * \param value the value to set.
    53  * \returns true if the value was set successfully, false otherwise.
    54  *
    55  * This method overrides the initial value of the 
    56  * matching attribute. 
    57  */
    58 bool SetDefaultFailSafe (std::string name, Attribute value);
    59 /**
    60  * \param name the name of the requested GlobalValue.
    61  * \param value the value to set
    62  *
    63  * This method is equivalent to GlobalValue::Bind
    64  */
    65 void SetGlobal (std::string name, Attribute value);
    66 /**
    67  * \param name the name of the requested GlobalValue.
    68  * \param value the value to set
    69  *
    70  * This method is equivalent to GlobalValue::BindFailSafe
    71  */
    72 bool SetGlobalFailSafe (std::string name, Attribute value);
    73 /**
    74  * \param path a path to match trace sources.
    75  * \param cb the callback to connect to the matching trace sources.
    76  *
    77  * This function will attempt to find all trace sources which
    78  * match the input path and will then connect the input callback
    79  * to them.
    80  */
    81 void ConnectWithoutContext (std::string path, const CallbackBase &cb);
    82 /**
    83  * \param path a path to match trace sources.
    84  * \param cb the callback to disconnect to the matching trace sources.
    85  *
    86  * This function undoes the work of Config::Connect.
    87  */
    88 void DisconnectWithoutContext (std::string path, const CallbackBase &cb);
    89 /**
    90  * \param path a path to match trace sources.
    91  * \param cb the callback to connect to the matching trace sources.
    92  *
    93  * This function will attempt to find all trace sources which
    94  * match the input path and will then connect the input callback
    95  * to them in such a way that the callback will receive an extra
    96  * context string upon trace event notification.
    97  */
    98 void Connect (std::string path, const CallbackBase &cb);
    99 /**
   100  * \param path a path to match trace sources.
   101  * \param cb the callback to connect to the matching trace sources.
   102  *
   103  * This function undoes the work of Config::ConnectWithContext.
   104  */
   105 void Disconnect (std::string path, const CallbackBase &cb);
   106 
   107 /**
   108  * \param obj a new root object
   109  *
   110  * Each root object is used during path matching as
   111  * the root of the path by Config::Connect, and Config::Set.
   112  */
   113 void RegisterRootNamespaceObject (Ptr<Object> obj);
   114 /**
   115  * \param obj a new root object
   116  *
   117  * This function undoes the work of Config::RegisterRootNamespaceObject.
   118  */
   119 void UnregisterRootNamespaceObject (Ptr<Object> obj);
   120 
   121 } // namespace Config
   122 
   123 } // namespace ns3
   124 
   125 #endif /* CONFIG_H */