mathieu@2586: /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ mathieu@2586: /* mathieu@2586: * Copyright (c) 2008 INRIA mathieu@2586: * mathieu@2586: * This program is free software; you can redistribute it and/or modify mathieu@2586: * it under the terms of the GNU General Public License version 2 as mathieu@2586: * published by the Free Software Foundation; mathieu@2586: * mathieu@2586: * This program is distributed in the hope that it will be useful, mathieu@2586: * but WITHOUT ANY WARRANTY; without even the implied warranty of mathieu@2586: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the mathieu@2586: * GNU General Public License for more details. mathieu@2586: * mathieu@2586: * You should have received a copy of the GNU General Public License mathieu@2586: * along with this program; if not, write to the Free Software mathieu@2586: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA mathieu@2586: * mathieu@2586: * Authors: Mathieu Lacage mathieu@2586: */ mathieu@2474: #ifndef CONFIG_H mathieu@2474: #define CONFIG_H mathieu@2474: mathieu@2474: #include "attribute.h" mathieu@2474: #include "ptr.h" mathieu@2474: #include "object.h" mathieu@2474: #include mathieu@2474: mathieu@2474: namespace ns3 { mathieu@2474: mathieu@2474: namespace Config { mathieu@2474: mathieu@2585: /** mathieu@2585: * \param path a path to match attributes. mathieu@2585: * \param value the value to set in all matching attributes. mathieu@2585: * mathieu@2585: * This function will attempt to find attributes which mathieu@2585: * match the input path and will then set their value to the input mathieu@2585: * value. mathieu@2585: */ mathieu@2474: void Set (std::string path, Attribute value); mathieu@2585: /** mathieu@2585: * \param name the full name of the attribute mathieu@2585: * \param value the value to set. mathieu@2585: * mathieu@2585: * This method overrides the initial value of the mathieu@2585: * matching attribute. This method cannot fail: it will mathieu@2585: * crash if the input attribute name or value is invalid. mathieu@2585: */ mathieu@2474: void SetDefault (std::string name, Attribute value); mathieu@2585: /** mathieu@2585: * \param name the full name of the attribute mathieu@2585: * \param value the value to set. mathieu@2585: * \returns true if the value was set successfully, false otherwise. mathieu@2585: * mathieu@2585: * This method overrides the initial value of the mathieu@2585: * matching attribute. mathieu@2585: */ mathieu@2570: bool SetDefaultFailSafe (std::string name, Attribute value); mathieu@2585: /** mathieu@2585: * \param name the name of the requested GlobalValue. mathieu@2585: * \param value the value to set mathieu@2585: * mathieu@2585: * This method is equivalent to GlobalValue::Bind mathieu@2585: */ mathieu@2474: void SetGlobal (std::string name, Attribute value); mathieu@2585: /** mathieu@2585: * \param name the name of the requested GlobalValue. mathieu@2585: * \param value the value to set mathieu@2585: * mathieu@2585: * This method is equivalent to GlobalValue::BindFailSafe mathieu@2585: */ mathieu@2570: bool SetGlobalFailSafe (std::string name, Attribute value); mathieu@2585: /** mathieu@2585: * \param path a path to match trace sources. mathieu@2585: * \param cb the callback to connect to the matching trace sources. mathieu@2585: * mathieu@2585: * This function will attempt to find all trace sources which mathieu@2585: * match the input path and will then connect the input callback mathieu@2585: * to them. mathieu@2585: */ mathieu@2594: void ConnectWithoutContext (std::string path, const CallbackBase &cb); mathieu@2585: /** mathieu@2585: * \param path a path to match trace sources. mathieu@2585: * \param cb the callback to disconnect to the matching trace sources. mathieu@2585: * mathieu@2585: * This function undoes the work of Config::Connect. mathieu@2585: */ mathieu@2594: void DisconnectWithoutContext (std::string path, const CallbackBase &cb); mathieu@2585: /** mathieu@2585: * \param path a path to match trace sources. mathieu@2585: * \param cb the callback to connect to the matching trace sources. mathieu@2585: * mathieu@2585: * This function will attempt to find all trace sources which mathieu@2585: * match the input path and will then connect the input callback mathieu@2585: * to them in such a way that the callback will receive an extra mathieu@2585: * context string upon trace event notification. mathieu@2585: */ mathieu@2594: void Connect (std::string path, const CallbackBase &cb); mathieu@2585: /** mathieu@2585: * \param path a path to match trace sources. mathieu@2585: * \param cb the callback to connect to the matching trace sources. mathieu@2585: * mathieu@2585: * This function undoes the work of Config::ConnectWithContext. mathieu@2585: */ mathieu@2594: void Disconnect (std::string path, const CallbackBase &cb); mathieu@2474: mathieu@2585: /** mathieu@2585: * \param obj a new root object mathieu@2585: * mathieu@2585: * Each root object is used during path matching as mathieu@2585: * the root of the path by Config::Connect, and Config::Set. mathieu@2585: */ mathieu@2474: void RegisterRootNamespaceObject (Ptr obj); mathieu@2585: /** mathieu@2585: * \param obj a new root object mathieu@2585: * mathieu@2585: * This function undoes the work of Config::RegisterRootNamespaceObject. mathieu@2585: */ mathieu@2532: void UnregisterRootNamespaceObject (Ptr obj); mathieu@2474: mathieu@2941: /** mathieu@2941: * \returns the number of registered root namespace objects. mathieu@2941: */ mathieu@2941: uint32_t GetRootNamespaceObjectN (void); mathieu@2941: mathieu@2941: /** mathieu@2941: * \param i the index of the requested object. mathieu@2941: * \returns the requested root namespace object mathieu@2941: */ mathieu@2941: Ptr GetRootNamespaceObject (uint32_t i); mathieu@2941: mathieu@2474: } // namespace Config mathieu@2474: mathieu@2474: } // namespace ns3 mathieu@2474: mathieu@2474: #endif /* CONFIG_H */