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