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
mathieu@2586
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
mathieu@2586
     2
/*
mathieu@2586
     3
 * Copyright (c) 2008 INRIA
mathieu@2586
     4
 *
mathieu@2586
     5
 * This program is free software; you can redistribute it and/or modify
mathieu@2586
     6
 * it under the terms of the GNU General Public License version 2 as
mathieu@2586
     7
 * published by the Free Software Foundation;
mathieu@2586
     8
 *
mathieu@2586
     9
 * This program is distributed in the hope that it will be useful,
mathieu@2586
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
mathieu@2586
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
mathieu@2586
    12
 * GNU General Public License for more details.
mathieu@2586
    13
 *
mathieu@2586
    14
 * You should have received a copy of the GNU General Public License
mathieu@2586
    15
 * along with this program; if not, write to the Free Software
mathieu@2586
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
mathieu@2586
    17
 *
mathieu@2586
    18
 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
mathieu@2586
    19
 */
mathieu@3752
    20
#ifndef NS3_CONFIG_H
mathieu@3752
    21
#define NS3_CONFIG_H
mathieu@2474
    22
mathieu@2474
    23
#include "ptr.h"
mathieu@2474
    24
#include <string>
mathieu@2474
    25
mathieu@2474
    26
namespace ns3 {
mathieu@2474
    27
mathieu@2965
    28
class AttributeValue;
mathieu@2965
    29
class Object;
mathieu@2965
    30
class CallbackBase;
mathieu@2965
    31
mathieu@3190
    32
/**
mathieu@3190
    33
 * \brief Configuration of simulation parameters and tracing
mathieu@3190
    34
 * \ingroup core
mathieu@3190
    35
 */
mathieu@2474
    36
namespace Config {
mathieu@2474
    37
mathieu@2585
    38
/**
mathieu@2585
    39
 * \param path a path to match attributes.
mathieu@2585
    40
 * \param value the value to set in all matching attributes.
mathieu@2585
    41
 *
mathieu@2585
    42
 * This function will attempt to find attributes which
mathieu@2585
    43
 * match the input path and will then set their value to the input
mathieu@2585
    44
 * value.
mathieu@2585
    45
 */
mathieu@2965
    46
void Set (std::string path, const AttributeValue &value);
mathieu@2585
    47
/**
mathieu@2585
    48
 * \param name the full name of the attribute
mathieu@2585
    49
 * \param value the value to set.
mathieu@2585
    50
 *
mathieu@2585
    51
 * This method overrides the initial value of the 
mathieu@2585
    52
 * matching attribute. This method cannot fail: it will
mathieu@2585
    53
 * crash if the input attribute name or value is invalid.
mathieu@2585
    54
 */
mathieu@2965
    55
void SetDefault (std::string name, const AttributeValue &value);
mathieu@2585
    56
/**
mathieu@2585
    57
 * \param name the full name of the attribute
mathieu@2585
    58
 * \param value the value to set.
mathieu@2585
    59
 * \returns true if the value was set successfully, false otherwise.
mathieu@2585
    60
 *
mathieu@2585
    61
 * This method overrides the initial value of the 
mathieu@2585
    62
 * matching attribute. 
mathieu@2585
    63
 */
mathieu@2965
    64
bool SetDefaultFailSafe (std::string name, const AttributeValue &value);
mathieu@2585
    65
/**
mathieu@2585
    66
 * \param name the name of the requested GlobalValue.
mathieu@2585
    67
 * \param value the value to set
mathieu@2585
    68
 *
mathieu@2585
    69
 * This method is equivalent to GlobalValue::Bind
mathieu@2585
    70
 */
mathieu@2965
    71
void SetGlobal (std::string name, const AttributeValue &value);
mathieu@2585
    72
/**
mathieu@2585
    73
 * \param name the name of the requested GlobalValue.
mathieu@2585
    74
 * \param value the value to set
mathieu@2585
    75
 *
mathieu@2585
    76
 * This method is equivalent to GlobalValue::BindFailSafe
mathieu@2585
    77
 */
mathieu@2965
    78
bool SetGlobalFailSafe (std::string name, const AttributeValue &value);
mathieu@2585
    79
/**
mathieu@2585
    80
 * \param path a path to match trace sources.
mathieu@2585
    81
 * \param cb the callback to connect to the matching trace sources.
mathieu@2585
    82
 *
mathieu@2585
    83
 * This function will attempt to find all trace sources which
mathieu@2585
    84
 * match the input path and will then connect the input callback
mathieu@2585
    85
 * to them.
mathieu@2585
    86
 */
mathieu@2594
    87
void ConnectWithoutContext (std::string path, const CallbackBase &cb);
mathieu@2585
    88
/**
mathieu@2585
    89
 * \param path a path to match trace sources.
mathieu@2585
    90
 * \param cb the callback to disconnect to the matching trace sources.
mathieu@2585
    91
 *
mathieu@2585
    92
 * This function undoes the work of Config::Connect.
mathieu@2585
    93
 */
mathieu@2594
    94
void DisconnectWithoutContext (std::string path, const CallbackBase &cb);
mathieu@2585
    95
/**
mathieu@2585
    96
 * \param path a path to match trace sources.
mathieu@2585
    97
 * \param cb the callback to connect to the matching trace sources.
mathieu@2585
    98
 *
mathieu@2585
    99
 * This function will attempt to find all trace sources which
mathieu@2585
   100
 * match the input path and will then connect the input callback
mathieu@2585
   101
 * to them in such a way that the callback will receive an extra
mathieu@2585
   102
 * context string upon trace event notification.
mathieu@2585
   103
 */
mathieu@2594
   104
void Connect (std::string path, const CallbackBase &cb);
mathieu@2585
   105
/**
mathieu@2585
   106
 * \param path a path to match trace sources.
mathieu@2585
   107
 * \param cb the callback to connect to the matching trace sources.
mathieu@2585
   108
 *
mathieu@2585
   109
 * This function undoes the work of Config::ConnectWithContext.
mathieu@2585
   110
 */
mathieu@2594
   111
void Disconnect (std::string path, const CallbackBase &cb);
mathieu@2474
   112
mathieu@2585
   113
/**
mathieu@2585
   114
 * \param obj a new root object
mathieu@2585
   115
 *
mathieu@2585
   116
 * Each root object is used during path matching as
mathieu@2585
   117
 * the root of the path by Config::Connect, and Config::Set.
mathieu@2585
   118
 */
mathieu@2474
   119
void RegisterRootNamespaceObject (Ptr<Object> obj);
mathieu@2585
   120
/**
mathieu@2585
   121
 * \param obj a new root object
mathieu@2585
   122
 *
mathieu@2585
   123
 * This function undoes the work of Config::RegisterRootNamespaceObject.
mathieu@2585
   124
 */
mathieu@2532
   125
void UnregisterRootNamespaceObject (Ptr<Object> obj);
mathieu@2474
   126
mathieu@2941
   127
/**
mathieu@2941
   128
 * \returns the number of registered root namespace objects.
mathieu@2941
   129
 */
mathieu@2941
   130
uint32_t GetRootNamespaceObjectN (void);
mathieu@2941
   131
mathieu@2941
   132
/**
mathieu@2941
   133
 * \param i the index of the requested object.
mathieu@2941
   134
 * \returns the requested root namespace object
mathieu@2941
   135
 */
mathieu@2941
   136
Ptr<Object> GetRootNamespaceObject (uint32_t i);
mathieu@2941
   137
mathieu@2474
   138
} // namespace Config
mathieu@2474
   139
mathieu@2474
   140
} // namespace ns3
mathieu@2474
   141
mathieu@3752
   142
#endif /* NS3_CONFIG_H */