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