--- a/doc/doxygen.conf Mon Oct 29 13:40:25 2007 -0700
+++ b/doc/doxygen.conf Thu Nov 08 17:05:37 2007 -0800
@@ -1,4 +1,4 @@
-# Doxyfile 1.4.4
+# Doxyfile 1.5.4
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
@@ -14,10 +14,18 @@
# Project related configuration options
#---------------------------------------------------------------------------
+# This tag specifies the encoding used for all characters in the config file that
+# follow. The default is UTF-8 which is also the encoding used for all text before
+# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into
+# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of
+# possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
-PROJECT_NAME = "NS-3"
+PROJECT_NAME = "NS-3 "
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
@@ -45,24 +53,14 @@
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
-# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
-# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
-# Swedish, and Ukrainian.
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian,
+# Italian, Japanese, Japanese-en (Japanese with English messages), Korean,
+# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian,
+# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
OUTPUT_LANGUAGE = English
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
@@ -135,11 +133,19 @@
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explicit @brief command for a brief description.
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
JAVADOC_AUTOBRIEF = NO
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
# comments) as a brief description. This used to be the default behaviour.
@@ -161,13 +167,6 @@
INHERIT_DOCS = YES
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
# a new page for each member. If set to NO, the documentation of a member will
# be part of the file/class/namespace that contains it.
@@ -195,13 +194,40 @@
OPTIMIZE_OUTPUT_FOR_C = NO
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
-# only. Doxygen will then generate output that is more tailored for Java.
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for Java.
# For instance, namespaces will be presented as packages, qualified scopes
# will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
+# include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
# the same type (for instance a group of public functions) to be put as a
# subgroup of that type (e.g. under the Public Functions section). Set it to
@@ -210,6 +236,16 @@
SUBGROUPING = YES
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is
+# documented as struct with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code where the coding convention is that all structs are
+# typedef'ed and only the typedef is referenced never the struct's name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
@@ -244,6 +280,13 @@
EXTRACT_LOCAL_METHODS = NO
+# If this flag is set to YES, the members of anonymous namespaces will be extracted
+# and appear in the documentation as a namespace called 'anonymous_namespace{file}',
+# where file will be replaced with the base name of the file that contains the anonymous
+# namespace. By default anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
@@ -376,7 +419,7 @@
# If the sources in your project are distributed over multiple directories
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is YES.
+# in the documentation. The default is NO.
SHOW_DIRECTORIES = NO
@@ -385,7 +428,7 @@
# version control system). Doxygen will invoke the program by executing (via
# popen()) the command <command> <input-file>, where <command> is the value of
# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the progam writes to standard output
+# provided by doxygen. Whatever the program writes to standard output
# is used as the file version. See the manual for examples.
FILE_VERSION_FILTER =
@@ -433,7 +476,7 @@
# $version, which will be replaced by the version of the file (if it could
# be obtained via FILE_VERSION_FILTER)
-WARN_FORMAT = "$file:$line: $text"
+WARN_FORMAT = "$file:$line: $text "
# The WARN_LOGFILE tag can be used to specify a file to which warning
# and error messages should be written. If left blank the output is written
@@ -450,16 +493,27 @@
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = src doc/main.txt doc/trace-source-list.h doc/tracing.h
+INPUT = src \
+ doc/main.txt \
+ doc/trace-source-list.h \
+ doc/tracing.h
+
+# This tag can be used to specify the character encoding of the source files that
+# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
+# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding.
+# See http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested:
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-FILE_PATTERNS = *.h *.tcc
+FILE_PATTERNS = *.h \
+ *.tcc
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
@@ -471,13 +525,12 @@
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
-EXCLUDE = \
- src/routing/olsr/olsr-state.h \
- src/routing/olsr/repositories.h \
- src/routing/olsr/routing-table.h \
- src/simulator/high-precision.h \
- src/simulator/high-precision-128.h \
- src/simulator/high-precision-double.h
+EXCLUDE = src/routing/olsr/olsr-state.h \
+ src/routing/olsr/repositories.h \
+ src/routing/olsr/routing-table.h \
+ src/simulator/high-precision.h \
+ src/simulator/high-precision-128.h \
+ src/simulator/high-precision-double.h
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded
@@ -493,6 +546,13 @@
EXCLUDE_PATTERNS =
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the output.
+# The symbol name can be a fully qualified name, a word, or if the wildcard * is used,
+# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
# the \include command).
@@ -551,7 +611,9 @@
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
# be generated. Documented entities will be cross-referenced with these sources.
# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
+# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH
+# then you must also enable this option. If you don't then doxygen will produce
+# a warning and turn it on anyway
SOURCE_BROWSER = NO
@@ -578,6 +640,13 @@
REFERENCES_RELATION = YES
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
# If the USE_HTAGS tag is set to YES then the references to source code
# will point to the HTML generated by the htags(1) tool instead of doxygen
# built-in source browser. The htags tool is part of GNU's global source
@@ -670,6 +739,14 @@
GENERATE_HTMLHELP = NO
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You
# can add a path in front of the file if the result should not be
@@ -972,7 +1049,7 @@
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+# PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = NO
@@ -1002,7 +1079,9 @@
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
-PREDEFINED = RUN_SELF_TESTS NS3_DEBUG_ENABLE NS3_ASSERT_ENABLE NS3_LOG_ENABLE
+PREDEFINED = RUN_SELF_TESTS \
+ NS3_ASSERT_ENABLE \
+ NS3_LOG_ENABLE
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
@@ -1075,6 +1154,14 @@
CLASS_DIAGRAMS = YES
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to
+# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to
+# specify the directory where the mscgen tool resides. If left empty the tool is assumed to
+# be found in the default search path.
+
+MSCGEN_PATH =
+
# If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented
# or is not a class.
@@ -1132,7 +1219,7 @@
INCLUDED_BY_GRAPH = YES
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
+# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
# generate a call dependency graph for every global function or class method.
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable call graphs for selected
@@ -1140,6 +1227,14 @@
CALL_GRAPH = NO
+# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
+# generate a caller dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will graphical hierarchy of all classes instead of a textual one.
@@ -1169,31 +1264,23 @@
DOTFILE_DIRS =
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
+# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the number
+# of direct children of the root node in a graph is already larger than
+# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
+DOT_GRAPH_MAX_NODES = 50
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable
# from the root by following a path via at most 3 edges will be shown. Nodes
# that lay further from the root node will be omitted. Note that setting this
# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that a graph may be further truncated if the graph's
-# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
-# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
-# the graph is not depth-constrained.
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
MAX_DOT_GRAPH_DEPTH = 0
--- a/doc/main.txt Mon Oct 29 13:40:25 2007 -0700
+++ b/doc/main.txt Thu Nov 08 17:05:37 2007 -0800
@@ -18,7 +18,7 @@
* - a Functor class: ns3::Callback
* - an os-independent interface to get access to the elapsed wall clock time: ns3::SystemWallClockMs
* - a class to register regression tests with the test manager: ns3::Test and ns3::TestManager
- * - debugging facilities: \ref debugging, \ref assert, \ref error
+ * - debugging facilities: \ref logging, \ref assert, \ref error
* - \ref randomvariable
* - \ref config
* - a base class for objects which need to support reference counting
--- a/doc/tracing.h Mon Oct 29 13:40:25 2007 -0700
+++ b/doc/tracing.h Thu Nov 08 17:05:37 2007 -0800
@@ -497,6 +497,8 @@
* };
* // called from MyModel::GetTraceResolver
* MyModelTraceType (enum Type type);
+ * // needed for by the tracing subsystem.
+ * MyModelTraceType ();
* // called from trace sink
* enum Type Get (void) const;
* // needed by the tracing subsystem
@@ -513,10 +515,14 @@
* \endcode
* The implementation does not require much thinking:
* \code
+ * MyModelTraceType::MyModelTraceType ()
+ * : m_type (RX)
+ * {// an arbitrary default value.
+ * }
* MyModelTraceType::MyModelTraceType (enum Type type)
* : m_type (type)
* {}
- * enum Type
+ * enum MyModelTraceType::Type
* MyModelTraceType::Get (void) const
* {
* return m_type;
@@ -531,14 +537,14 @@
* }
* void
* MyModelTraceType::Print (std::ostream &os) const
- * (
+ * {
* // this method is invoked by the print function of a TraceContext
* // if it contains an instance of this TraceContextElement.
* switch (m_type) {
* case RX: os << "rx"; break;
* // ...
* }
- * )
+ * }
* std::string
* MyModelTraceType::GetTypeName (void) const
* {
--- a/samples/main-debug-other.cc Mon Oct 29 13:40:25 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-#include "ns3/debug.h"
-
-NS_DEBUG_COMPONENT_DEFINE ("MyComponentB");
-
-namespace foo {
-
-void OneFunction (void)
-{
- NS_DEBUG ("OneFunction debug");
-}
-
-}; // namespace foo
--- a/samples/main-debug.cc Mon Oct 29 13:40:25 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-#include "ns3/debug.h"
-#include "ns3/assert.h"
-
-NS_DEBUG_COMPONENT_DEFINE ("MyComponentA");
-
-// declare other function
-namespace foo {
-void OneFunction (void);
-}
-
-int main (int argc, int argv)
-{
- NS_DEBUG ("nargc="<<argc);
-
- foo::OneFunction ();
-
- NS_DEBUG ("other debug output");
-
- int a;
- a = 0;
-
- NS_ASSERT (a == 0);
- NS_ASSERT_MSG (a == 0, "my msg");
- NS_ASSERT (a != 0);
- NS_ASSERT_MSG (a != 0, "my 2 msg");
-}
--- a/samples/main-grid-topology.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/samples/main-grid-topology.cc Thu Nov 08 17:05:37 2007 -0800
@@ -41,7 +41,7 @@
Ptr<Object> object = *j;
Ptr<MobilityModel> position = object->QueryInterface<MobilityModel> (MobilityModel::iid);
NS_ASSERT (position != 0);
- Position pos = position->Get ();
+ Vector pos = position->GetPosition ();
std::cout << "x=" << pos.x << ", y=" << pos.y << ", z=" << pos.z << std::endl;
}
--- a/samples/main-random-topology.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/samples/main-random-topology.cc Thu Nov 08 17:05:37 2007 -0800
@@ -17,7 +17,7 @@
static void
CourseChange (const TraceContext &context, Ptr<const MobilityModel> position)
{
- Position pos = position->Get ();
+ Vector pos = position->GetPosition ();
std::cout << Simulator::Now () << ", pos=" << position << ", x=" << pos.x << ", y=" << pos.y
<< ", z=" << pos.z << std::endl;
}
--- a/samples/main-random-walk.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/samples/main-random-walk.cc Thu Nov 08 17:05:37 2007 -0800
@@ -18,11 +18,11 @@
static void
CourseChange (ns3::TraceContext const&, Ptr<const MobilityModel> mobility)
{
- Position pos = mobility->Get ();
- Speed vel = mobility->GetSpeed ();
+ Vector pos = mobility->GetPosition ();
+ Vector vel = mobility->GetVelocity ();
std::cout << Simulator::Now () << ", model=" << mobility << ", POS: x=" << pos.x << ", y=" << pos.y
- << ", z=" << pos.z << "; VEL:" << vel.dx << ", y=" << vel.dy
- << ", z=" << vel.dz << std::endl;
+ << ", z=" << pos.z << "; VEL:" << vel.x << ", y=" << vel.y
+ << ", z=" << vel.z << std::endl;
}
int main (int argc, char *argv[])
--- a/samples/wscript Mon Oct 29 13:40:25 2007 -0700
+++ b/samples/wscript Thu Nov 08 17:05:37 2007 -0800
@@ -1,9 +1,6 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def build(bld):
- obj = bld.create_ns3_program('main-debug')
- obj.source = ['main-debug.cc', 'main-debug-other.cc']
-
obj = bld.create_ns3_program('main-callback')
obj.source = 'main-callback.cc'
--- a/src/core/command-line.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/core/command-line.cc Thu Nov 08 17:05:37 2007 -0800
@@ -20,7 +20,6 @@
*/
#include "command-line.h"
-#include "ns3/debug.h"
#include <unistd.h>
namespace ns3 {
--- a/src/core/debug.cc Mon Oct 29 13:40:25 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include <list>
-#include <utility>
-#include <iostream>
-#include "debug.h"
-#include "assert.h"
-#include "ns3/core-config.h"
-#include "fatal-error.h"
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-namespace ns3 {
-
-typedef std::list<std::pair <std::string, DebugComponent *> > ComponentList;
-typedef std::list<std::pair <std::string, DebugComponent *> >::iterator ComponentListI;
-
-static
-ComponentList *GetComponentList (void)
-{
- static ComponentList components;
- return &components;
-}
-
-
-static bool g_firstDebug = true;
-
-void
-DebugComponentEnableEnvVar (void)
-{
-#ifdef HAVE_GETENV
- char *envVar = getenv("NS_DEBUG");
- if (envVar == 0)
- {
- return;
- }
- bool allFound = true;
- std::string env = envVar;
- std::string::size_type cur = 0;
- std::string::size_type next = 0;
- while (true)
- {
- next = env.find_first_of (";", cur);
- std::string tmp = std::string (env, cur, next);
- {
- /* The following code is a workaround for a bug in the g++
- * c++ string library. Its goal is to remove any trailing ';'
- * from the string even though there should not be any in
- * it. This code should be safe even if the bug is not there.
- */
- std::string::size_type trailing = tmp.find_first_of (";");
- tmp = tmp.substr (0, trailing);
- }
- if (tmp.size () == 0)
- {
- break;
- }
- bool found = false;
- ComponentList *components = GetComponentList ();
- for (ComponentListI i = components->begin ();
- i != components->end ();
- i++)
- {
- if (i->first.compare (tmp) == 0)
- {
- found = true;
- i->second->Enable ();
- break;
- }
- }
- if (!found)
- {
- allFound = false;
- }
- if (next == std::string::npos)
- {
- break;
- }
- cur = next + 1;
- if (cur >= env.size ())
- {
- break;
- }
- }
- if (allFound)
- {
- g_firstDebug = true;
- }
-
-#endif
-}
-
-
-DebugComponent::DebugComponent (char const * name)
- : m_isEnabled (false)
-{
- ComponentList *components = GetComponentList ();
- for (ComponentListI i = components->begin ();
- i != components->end ();
- i++)
- {
- NS_ASSERT (i->first != name);
- }
- components->push_back (std::make_pair (name, this));
-}
-bool
-DebugComponent::IsEnabled (void)
-{
- if (g_firstDebug)
- {
- DebugComponentEnableEnvVar ();
- }
- return m_isEnabled;
-}
-void
-DebugComponent::Enable (void)
-{
- m_isEnabled = true;
-}
-void
-DebugComponent::Disable (void)
-{
- m_isEnabled = false;
-}
-
-void
-DebugComponentEnable (char const *name)
-{
- ComponentList *components = GetComponentList ();
- for (ComponentListI i = components->begin ();
- i != components->end ();
- i++)
- {
- if (i->first.compare (name) == 0)
- {
- i->second->Enable ();
- break;
- }
- }
-}
-void
-DebugComponentDisable (char const *name)
-{
- ComponentList *components = GetComponentList ();
- for (ComponentListI i = components->begin ();
- i != components->end ();
- i++)
- {
- if (i->first.compare (name) == 0)
- {
- i->second->Disable ();
- break;
- }
- }
-}
-
-
-void
-DebugComponentPrintList (void)
-{
- ComponentList *components = GetComponentList ();
- for (ComponentListI i = components->begin ();
- i != components->end ();
- i++)
- {
- std::cout << i->first << "=" << (i->second->IsEnabled ()?"enabled":"disabled") << std::endl;
- }
-}
-
-}; // namespace ns3
-
-
--- a/src/core/debug.h Mon Oct 29 13:40:25 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef DEBUG_H
-#define DEBUG_H
-
-/**
- * \defgroup debugging Debugging
- * \brief Debugging functions and macros
- *
- * - DEBUG functionality: macros which allow developers to
- * send information out on screen only in debugging builds.
- * All debug messages are disabled by default. To enable
- * selected debug messages, use the ns3::DebugComponentEnable
- * function. Alternatively, you can use the NS_DEBUG
- * environment variable to define a ';'-separated list of
- * messages to enable. For example, NS_DEBUG=a;b;c;DAFD;GH
- * would enable the components 'a', 'b', 'c', 'DAFD', and, 'GH'.
- */
-
-namespace ns3 {
-
-/**
- * \param name a debug component name
- * \ingroup debugging
- *
- * Enable the debugging output associated with that debug component.
- * The debugging output can be later disabled with a call
- * to ns3::DebugComponentDisable.
- */
-void DebugComponentEnable (char const *name);
-/**
- * \param name a debug component name
- * \ingroup debugging
- *
- * Disable the debugging output associated with that debug component.
- * The debugging output can be later re-enabled with a call
- * to ns3::DebugComponentEnable.
- */
-void DebugComponentDisable (char const *name);
-/**
- * \ingroup debugging
- * Print the list of debugging messages available.
- */
-void DebugComponentPrintList (void);
-
-class DebugComponent {
-public:
- DebugComponent (char const *name);
- bool IsEnabled (void);
- void Enable (void);
- void Disable (void);
-private:
- bool m_isEnabled;
-};
-
-}; // namespace ns3
-
-
-#ifdef NS3_DEBUG_ENABLE
-
-#include <string>
-#include <iostream>
-
-
-/**
- * \ingroup debugging
- * \param name a string
- *
- * Define a Debug component with a specific name. This macro
- * should be used at the top of every file in which you want
- * to use the NS_DEBUG macro. This macro defines a new
- * "debug component" which can be later selectively enabled
- * or disabled with the ns3::DebugComponentEnable and
- * ns3::DebugComponentDisable functions or with the NS_DEBUG
- * environment variable.
- */
-#define NS_DEBUG_COMPONENT_DEFINE(name) \
- static ns3::DebugComponent g_debug = ns3::DebugComponent (name)
-
-/**
- * \ingroup debugging
- * \param msg message to output
- *
- * Generate debugging output in the "debug component" of the
- * current file. i.e., every call to NS_DEBUG from within
- * a file implicitely generates out within the component
- * defined with the NS_DEBUG_COMPONENT_DEFINE macro in the
- * same file.
- */
-#define NS_DEBUG(msg) \
- do \
- { \
- if (g_debug.IsEnabled ()) \
- { \
- std::cerr << msg << std::endl; \
- } \
- } \
- while (false)
-
-/**
- * \ingroup debugging
- * \param msg message to output
- *
- * Generate debugging output unconditionally in all
- * debug builds.
- */
-#define NS_DEBUG_UNCOND(msg) \
- do \
- { \
- std::cerr << msg << std::endl; \
- } \
- while (false)
-
-#else /* NS3_DEBUG_ENABLE */
-
-#define NS_DEBUG_COMPONENT_DEFINE(name)
-#define NS_DEBUG(x)
-#define NS_DEBUG_UNCOND(msg)
-
-#endif /* NS3_DEBUG_ENABLE */
-
-#endif /* DEBUG_H */
--- a/src/core/random-variable.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/core/random-variable.cc Thu Nov 08 17:05:37 2007 -0800
@@ -42,7 +42,6 @@
//-----------------------------------------------------------------------------
// RandomVariable methods
-uint32_t RandomVariable::runNumber = 0;
bool RandomVariable::initialized = false; // True if RngStream seed set
bool RandomVariable::useDevRandom = false; // True if use /dev/random
bool RandomVariable::globalSeedSet = false; // True if GlobalSeed called
@@ -50,6 +49,7 @@
uint32_t RandomVariable::globalSeed[6];
unsigned long RandomVariable::heuristic_sequence;
RngStream* RandomVariable::m_static_generator = 0;
+uint32_t RandomVariable::runNumber = 0;
//the static object random_variable_initializer initializes the static members
//of RandomVariable
@@ -58,9 +58,9 @@
public:
RandomVariableInitializer()
{
- RandomVariable::Initialize(); // sets the static package seed
- RandomVariable::m_static_generator = new RngStream();
- RandomVariable::m_static_generator->InitializeStream();
+// RandomVariable::Initialize(); // sets the static package seed
+// RandomVariable::m_static_generator = new RngStream();
+// RandomVariable::m_static_generator->InitializeStream();
}
~RandomVariableInitializer()
{
@@ -69,15 +69,20 @@
} random_variable_initializer;
RandomVariable::RandomVariable()
+ : m_generator(NULL)
{
- m_generator = new RngStream();
- m_generator->InitializeStream();
- m_generator->ResetNthSubstream(RandomVariable::runNumber);
+// m_generator = new RngStream();
+// m_generator->InitializeStream();
+// m_generator->ResetNthSubstream(RandomVariable::runNumber);
}
RandomVariable::RandomVariable(const RandomVariable& r)
+ :m_generator(0)
{
- m_generator = new RngStream(*r.m_generator);
+ if(r.m_generator)
+ {
+ m_generator = new RngStream(*r.m_generator);
+ }
}
RandomVariable::~RandomVariable()
@@ -97,6 +102,12 @@
void RandomVariable::GetSeed(uint32_t seed[6])
{
+ if(!m_generator)
+ {
+ m_generator = new RngStream();
+ m_generator->InitializeStream();
+ m_generator->ResetNthSubstream(RandomVariable::runNumber);
+ }
m_generator->GetState(seed);
}
@@ -202,6 +213,16 @@
double UniformVariable::GetValue()
{
+ if(!RandomVariable::initialized)
+ {
+ RandomVariable::Initialize();
+ }
+ if(!m_generator)
+ {
+ m_generator = new RngStream();
+ m_generator->InitializeStream();
+ m_generator->ResetNthSubstream(RandomVariable::runNumber);
+ }
return m_min + m_generator->RandU01() * (m_max - m_min);
}
@@ -212,6 +233,12 @@
double UniformVariable::GetSingleValue(double s, double l)
{
+ if(!RandomVariable::m_static_generator)
+ {
+ RandomVariable::Initialize(); // sets the static package seed
+ RandomVariable::m_static_generator = new RngStream();
+ RandomVariable::m_static_generator->InitializeStream();
+ }
return s + m_static_generator->RandU01() * (l - s);;
}
@@ -305,6 +332,16 @@
double ExponentialVariable::GetValue()
{
+ if(!RandomVariable::initialized)
+ {
+ RandomVariable::Initialize();
+ }
+ if(!m_generator)
+ {
+ m_generator = new RngStream();
+ m_generator->InitializeStream();
+ m_generator->ResetNthSubstream(RandomVariable::runNumber);
+ }
double r = -m_mean*log(m_generator->RandU01());
if (m_bound != 0 && r > m_bound) return m_bound;
return r;
@@ -316,6 +353,12 @@
}
double ExponentialVariable::GetSingleValue(double m, double b/*=0*/)
{
+ if(!RandomVariable::m_static_generator)
+ {
+ RandomVariable::Initialize(); // sets the static package seed
+ RandomVariable::m_static_generator = new RngStream();
+ RandomVariable::m_static_generator->InitializeStream();
+ }
double r = -m*log(m_static_generator->RandU01());
if (b != 0 && r > b) return b;
return r;
@@ -341,6 +384,16 @@
double ParetoVariable::GetValue()
{
+ if(!RandomVariable::initialized)
+ {
+ RandomVariable::Initialize();
+ }
+ if(!m_generator)
+ {
+ m_generator = new RngStream();
+ m_generator->InitializeStream();
+ m_generator->ResetNthSubstream(RandomVariable::runNumber);
+ }
double scale = m_mean * ( m_shape - 1.0) / m_shape;
double r = (scale * ( 1.0 / pow(m_generator->RandU01(), 1.0 / m_shape)));
if (m_bound != 0 && r > m_bound) return m_bound;
@@ -354,6 +407,12 @@
double ParetoVariable::GetSingleValue(double m, double s, double b/*=0*/)
{
+ if(!RandomVariable::m_static_generator)
+ {
+ RandomVariable::Initialize(); // sets the static package seed
+ RandomVariable::m_static_generator = new RngStream();
+ RandomVariable::m_static_generator->InitializeStream();
+ }
double scale = m * ( s - 1.0) / s;
double r = (scale * ( 1.0 / pow(m_static_generator->RandU01(), 1.0 / s)));
if (b != 0 && r > b) return b;
@@ -375,6 +434,16 @@
double WeibullVariable::GetValue()
{
+ if(!RandomVariable::initialized)
+ {
+ RandomVariable::Initialize();
+ }
+ if(!m_generator)
+ {
+ m_generator = new RngStream();
+ m_generator->InitializeStream();
+ m_generator->ResetNthSubstream(RandomVariable::runNumber);
+ }
double exponent = 1.0 / m_alpha;
double r = m_mean * pow( -log(m_generator->RandU01()), exponent);
if (m_bound != 0 && r > m_bound) return m_bound;
@@ -388,6 +457,12 @@
double WeibullVariable::GetSingleValue(double m, double s, double b/*=0*/)
{
+ if(!RandomVariable::m_static_generator)
+ {
+ RandomVariable::Initialize(); // sets the static package seed
+ RandomVariable::m_static_generator = new RngStream();
+ RandomVariable::m_static_generator->InitializeStream();
+ }
double exponent = 1.0 / s;
double r = m * pow( -log(m_static_generator->RandU01()), exponent);
if (b != 0 && r > b) return b;
@@ -412,6 +487,16 @@
double NormalVariable::GetValue()
{
+ if(!RandomVariable::initialized)
+ {
+ RandomVariable::Initialize();
+ }
+ if(!m_generator)
+ {
+ m_generator = new RngStream();
+ m_generator->InitializeStream();
+ m_generator->ResetNthSubstream(RandomVariable::runNumber);
+ }
if (m_nextValid)
{ // use previously generated
m_nextValid = false;
@@ -445,6 +530,12 @@
double NormalVariable::GetSingleValue(double m, double v, double b)
{
+ if(!RandomVariable::m_static_generator)
+ {
+ RandomVariable::Initialize(); // sets the static package seed
+ RandomVariable::m_static_generator = new RngStream();
+ RandomVariable::m_static_generator->InitializeStream();
+ }
if (m_static_nextValid)
{ // use previously generated
m_static_nextValid = false;
@@ -495,6 +586,16 @@
double EmpiricalVariable::GetValue()
{ // Return a value from the empirical distribution
// This code based (loosely) on code by Bruce Mah (Thanks Bruce!)
+ if(!RandomVariable::initialized)
+ {
+ RandomVariable::Initialize();
+ }
+ if(!m_generator)
+ {
+ m_generator = new RngStream();
+ m_generator->InitializeStream();
+ m_generator->ResetNthSubstream(RandomVariable::runNumber);
+ }
if (emp.size() == 0) return 0.0; // HuH? No empirical data
if (!validated) Validate(); // Insure in non-decreasing
double r = m_generator->RandU01();
@@ -642,6 +743,16 @@
double
LogNormalVariable::GetValue ()
{
+ if(!RandomVariable::initialized)
+ {
+ RandomVariable::Initialize();
+ }
+ if(!m_generator)
+ {
+ m_generator = new RngStream();
+ m_generator->InitializeStream();
+ m_generator->ResetNthSubstream(RandomVariable::runNumber);
+ }
double u, v, r2, normal, z;
do
@@ -665,6 +776,12 @@
double LogNormalVariable::GetSingleValue (double mu, double sigma)
{
+ if(!RandomVariable::m_static_generator)
+ {
+ RandomVariable::Initialize(); // sets the static package seed
+ RandomVariable::m_static_generator = new RngStream();
+ RandomVariable::m_static_generator->InitializeStream();
+ }
double u, v, r2, normal, z;
do
{
@@ -698,6 +815,16 @@
double TriangularVariable::GetValue()
{
+ if(!RandomVariable::initialized)
+ {
+ RandomVariable::Initialize();
+ }
+ if(!m_generator)
+ {
+ m_generator = new RngStream();
+ m_generator->InitializeStream();
+ m_generator->ResetNthSubstream(RandomVariable::runNumber);
+ }
double u = m_generator->RandU01();
if(u <= (m_mode - m_min) / (m_max - m_min) )
return m_min + sqrt(u * (m_max - m_min) * (m_mode - m_min) );
@@ -712,6 +839,12 @@
double TriangularVariable::GetSingleValue(double s, double l, double mean)
{
+ if(!RandomVariable::m_static_generator)
+ {
+ RandomVariable::Initialize(); // sets the static package seed
+ RandomVariable::m_static_generator = new RngStream();
+ RandomVariable::m_static_generator->InitializeStream();
+ }
double mode = 3.0*mean-s-l;
double u = m_static_generator->RandU01();
if(u <= (mode - s) / (l - s) )
--- a/src/core/random-variable.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/core/random-variable.h Thu Nov 08 17:05:37 2007 -0800
@@ -71,7 +71,7 @@
* \brief Returns a random double from the underlying distribution
* \return A floating point random value
*/
- virtual double GetValue() = 0;
+ virtual double GetValue() = 0;
/**
* \brief Returns a random integer integer from the underlying distribution
@@ -173,19 +173,19 @@
*/
static void SetRunNumber(uint32_t n);
private:
- static void Initialize(); // Initialize the RNG system
static void GetRandomSeeds(uint32_t seeds[6]);
private:
- static bool initialized; // True if package seed is set
static bool useDevRandom; // True if using /dev/random desired
static bool globalSeedSet; // True if global seed has been specified
static int devRandom; // File handle for /dev/random
static uint32_t globalSeed[6]; // The global seed to use
- static uint32_t runNumber;
friend class RandomVariableInitializer;
protected:
static unsigned long heuristic_sequence;
static RngStream* m_static_generator;
+ static uint32_t runNumber;
+ static void Initialize(); // Initialize the RNG system
+ static bool initialized; // True if package seed is set
RngStream* m_generator; //underlying generator being wrapped
};
--- a/src/core/wscript Mon Oct 29 13:40:25 2007 -0700
+++ b/src/core/wscript Thu Nov 08 17:05:37 2007 -0800
@@ -29,7 +29,6 @@
core = bld.create_ns3_module('core')
core.source = [
'callback-test.cc',
- 'debug.cc',
'log.cc',
'breakpoint.cc',
'ptr.cc',
@@ -70,7 +69,6 @@
'callback.h',
'ptr.h',
'object.h',
- 'debug.h',
'log.h',
'assert.h',
'breakpoint.h',
--- a/src/mobility/grid-topology.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/grid-topology.cc Thu Nov 08 17:05:37 2007 -0800
@@ -46,7 +46,7 @@
Ptr<MobilityModel> mobility = ComponentManager::Create<MobilityModel> (m_positionClassId,
MobilityModel::iid);
object->AddInterface (mobility);
- mobility->Set (Position (x, y, 0.0));
+ mobility->SetPosition (Vector (x, y, 0.0));
}
void
@@ -58,7 +58,7 @@
Ptr<MobilityModel> mobility = ComponentManager::Create<MobilityModel> (m_positionClassId,
MobilityModel::iid);
object->AddInterface (mobility);
- mobility->Set (Position (x, y, 0.0));
+ mobility->SetPosition (Vector (x, y, 0.0));
}
--- a/src/mobility/hierarchical-mobility-model.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/hierarchical-mobility-model.cc Thu Nov 08 17:05:37 2007 -0800
@@ -56,34 +56,34 @@
return m_parent;
}
-Position
-HierarchicalMobilityModel::DoGet (void) const
+Vector
+HierarchicalMobilityModel::DoGetPosition (void) const
{
- Position parentPosition = m_parent->Get ();
- Position childPosition = m_child->Get ();
- return Position (parentPosition.x + childPosition.x,
+ Vector parentPosition = m_parent->GetPosition ();
+ Vector childPosition = m_child->GetPosition ();
+ return Vector (parentPosition.x + childPosition.x,
parentPosition.y + childPosition.y,
parentPosition.z + childPosition.z);
}
void
-HierarchicalMobilityModel::DoSet (const Position &position)
+HierarchicalMobilityModel::DoSetPosition (const Vector &position)
{
- // This implementation of DoSet is really an arbitraty choice.
+ // This implementation of DoSetPosition is really an arbitraty choice.
// anything else would have been ok.
- Position parentPosition = m_parent->Get ();
- Position childPosition (position.x - parentPosition.x,
+ Vector parentPosition = m_parent->GetPosition ();
+ Vector childPosition (position.x - parentPosition.x,
position.y - parentPosition.y,
position.z - parentPosition.z);
- m_child->Set (childPosition);
+ m_child->SetPosition (childPosition);
}
-Speed
-HierarchicalMobilityModel::DoGetSpeed (void) const
+Vector
+HierarchicalMobilityModel::DoGetVelocity (void) const
{
- Speed parentSpeed = m_parent->GetSpeed ();
- Speed childSpeed = m_child->GetSpeed ();
- Speed speed (parentSpeed.dx + childSpeed.dx,
- parentSpeed.dy + childSpeed.dy,
- parentSpeed.dz + childSpeed.dz);
+ Vector parentSpeed = m_parent->GetVelocity ();
+ Vector childSpeed = m_child->GetVelocity ();
+ Vector speed (parentSpeed.x + childSpeed.x,
+ parentSpeed.y + childSpeed.y,
+ parentSpeed.z + childSpeed.z);
return speed;
}
--- a/src/mobility/hierarchical-mobility-model.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/hierarchical-mobility-model.h Thu Nov 08 17:05:37 2007 -0800
@@ -58,9 +58,9 @@
Ptr<MobilityModel> GetParent (void) const;
private:
- virtual Position DoGet (void) const;
- virtual void DoSet (const Position &position);
- virtual Speed DoGetSpeed (void) const;
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
void ParentChanged (const TraceContext &context, Ptr<const MobilityModel> model);
void ChildChanged (const TraceContext &context, Ptr<const MobilityModel> model);
--- a/src/mobility/mobility-model.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/mobility-model.cc Thu Nov 08 17:05:37 2007 -0800
@@ -33,28 +33,28 @@
MobilityModel::~MobilityModel ()
{}
-Position
-MobilityModel::Get (void) const
+Vector
+MobilityModel::GetPosition (void) const
{
- return DoGet ();
+ return DoGetPosition ();
}
-Speed
-MobilityModel::GetSpeed (void) const
+Vector
+MobilityModel::GetVelocity (void) const
{
- return DoGetSpeed ();
+ return DoGetVelocity ();
}
void
-MobilityModel::Set (const Position &position)
+MobilityModel::SetPosition (const Vector &position)
{
- DoSet (position);
+ DoSetPosition (position);
}
double
MobilityModel::GetDistanceFrom (Ptr<const MobilityModel> other) const
{
- Position oPosition = other->DoGet ();
- Position position = DoGet ();
+ Vector oPosition = other->DoGetPosition ();
+ Vector position = DoGetPosition ();
return CalculateDistance (position, oPosition);
}
--- a/src/mobility/mobility-model.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/mobility-model.h Thu Nov 08 17:05:37 2007 -0800
@@ -21,8 +21,7 @@
#define MOBILITY_MODEL_H
#include "ns3/object.h"
-#include "position.h"
-#include "speed.h"
+#include "vector.h"
namespace ns3 {
@@ -43,15 +42,15 @@
/**
* \returns the current position
*/
- Position Get (void) const;
+ Vector GetPosition (void) const;
/**
* \param position the position to set.
*/
- void Set (const Position &position);
+ void SetPosition (const Vector &position);
/**
- * \returns the current position.
+ * \returns the current velocity.
*/
- Speed GetSpeed (void) const;
+ Vector GetVelocity (void) const;
/**
* \param position a reference to another mobility model
* \returns the distance between the two objects. Unit is meters.
@@ -70,21 +69,21 @@
* Concrete subclasses of this base class must
* implement this method.
*/
- virtual Position DoGet (void) const = 0;
+ virtual Vector DoGetPosition (void) const = 0;
/**
* \param position the position to set.
*
* Concrete subclasses of this base class must
* implement this method.
*/
- virtual void DoSet (const Position &position) = 0;
+ virtual void DoSetPosition (const Vector &position) = 0;
/**
- * \returns the current speed.
+ * \returns the current velocity.
*
* Concrete subclasses of this base class must
* implement this method.
*/
- virtual Speed DoGetSpeed (void) const = 0;
+ virtual Vector DoGetVelocity (void) const = 0;
};
}; // namespace ns3
--- a/src/mobility/ns2-mobility-file-topology.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/ns2-mobility-file-topology.cc Thu Nov 08 17:05:37 2007 -0800
@@ -20,14 +20,14 @@
*/
#include <fstream>
#include <sstream>
-#include "ns3/debug.h"
+#include "ns3/log.h"
#include "ns3/simulator.h"
#include "ns3/node-list.h"
#include "ns3/node.h"
#include "ns2-mobility-file-topology.h"
#include "static-speed-mobility-model.h"
-NS_DEBUG_COMPONENT_DEFINE ("Ns2MobilityFileTopology");
+NS_LOG_COMPONENT_DEFINE ("Ns2MobilityFileTopology");
namespace ns3 {
@@ -97,27 +97,27 @@
{
double value = ReadDouble (line.substr (endNodeId + 9, std::string::npos));
std::string coordinate = line.substr (endNodeId + 6, 1);
- Position position = model->Get ();
+ Vector position = model->GetPosition ();
if (coordinate == "X")
{
position.x = value;
- NS_DEBUG ("X=" << value);
+ NS_LOG_DEBUG ("X=" << value);
}
else if (coordinate == "Y")
{
position.y = value;
- NS_DEBUG ("Y=" << value);
+ NS_LOG_DEBUG ("Y=" << value);
}
else if (coordinate == "Z")
{
position.z = value;
- NS_DEBUG ("Z=" << value);
+ NS_LOG_DEBUG ("Z=" << value);
}
else
{
continue;
}
- model->Set (position);
+ model->SetPosition (position);
}
else
{
@@ -127,9 +127,9 @@
double xSpeed = ReadDouble (line.substr (endNodeId + 10, xSpeedEnd - endNodeId - 10));
double ySpeed = ReadDouble (line.substr (xSpeedEnd + 1, ySpeedEnd - xSpeedEnd - 1));
double zSpeed = ReadDouble (line.substr (ySpeedEnd + 1, std::string::npos));
- NS_DEBUG ("at=" << at << "xSpeed=" << xSpeed << ", ySpeed=" << ySpeed << ", zSpeed=" << zSpeed);
+ NS_LOG_DEBUG ("at=" << at << "xSpeed=" << xSpeed << ", ySpeed=" << ySpeed << ", zSpeed=" << zSpeed);
Simulator::Schedule (Seconds (at), &StaticSpeedMobilityModel::SetSpeed, model,
- Speed (xSpeed, ySpeed, zSpeed));
+ Vector (xSpeed, ySpeed, zSpeed));
}
}
file.close();
--- a/src/mobility/position.cc Mon Oct 29 13:40:25 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "position.h"
-#include <cmath>
-
-namespace ns3 {
-
-
-Position::Position (double _x, double _y, double _z)
- : x (_x),
- y (_y),
- z (_z)
-{}
-
-Position::Position ()
- : x (0.0),
- y (0.0),
- z (0.0)
-{}
-
-double
-CalculateDistance (const Position &a, const Position &b)
-{
- double dx = b.x - a.x;
- double dy = b.y - a.y;
- double dz = b.z - a.z;
- double distance = std::sqrt (dx * dx + dy * dy + dz * dz);
- return distance;
-}
-
-} // namespace ns3
--- a/src/mobility/position.h Mon Oct 29 13:40:25 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef POSITION_H
-#define POSITION_H
-
-namespace ns3 {
-
-/**
- * \brief a 3d cartesian position vector
- *
- * Unit is meters.
- */
-class Position
-{
-public:
- /**
- * \param _x x coordinate of position vector
- * \param _y y coordinate of position vector
- * \param _z z coordinate of position vector
- *
- * Create position vector (_x, _y, _z)
- */
- Position (double _x, double _y, double _z);
- /**
- * Create position vector (0.0, 0.0, 0.0)
- */
- Position ();
- /**
- * x coordinate of position vector
- */
- double x;
- /**
- * y coordinate of position vector
- */
- double y;
- /**
- * z coordinate of position vector
- */
- double z;
-};
-
-double CalculateDistance (const Position &a, const Position &b);
-
-} // namespace ns3
-
-#endif /* POSITION_H */
--- a/src/mobility/random-direction-2d-mobility-model.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/random-direction-2d-mobility-model.cc Thu Nov 08 17:05:37 2007 -0800
@@ -153,12 +153,12 @@
{
NS_LOG_FUNCTION;
double speed = m_parameters->m_speedVariable->GetValue ();
- const Speed vector (std::cos (direction) * speed,
- std::sin (direction) * speed,
- 0.0);
- Position position = m_helper.GetCurrentPosition (m_parameters->m_bounds);
+ const Vector vector (std::cos (direction) * speed,
+ std::sin (direction) * speed,
+ 0.0);
+ Vector position = m_helper.GetCurrentPosition (m_parameters->m_bounds);
m_helper.Reset (vector);
- Position next = m_parameters->m_bounds.CalculateIntersection (position, vector);
+ Vector next = m_parameters->m_bounds.CalculateIntersection (position, vector);
Time delay = Seconds (CalculateDistance (position, next) / speed);
m_event = Simulator::Schedule (delay,
&RandomDirection2dMobilityModel::BeginPause, this);
@@ -169,7 +169,7 @@
{
double direction = UniformVariable::GetSingleValue (0, PI);
- Position position = m_helper.GetCurrentPosition (m_parameters->m_bounds);
+ Vector position = m_helper.GetCurrentPosition (m_parameters->m_bounds);
switch (m_parameters->m_bounds.GetClosestSide (position))
{
case Rectangle::RIGHT:
@@ -187,22 +187,22 @@
}
SetDirectionAndSpeed (direction);
}
-Position
-RandomDirection2dMobilityModel::DoGet (void) const
+Vector
+RandomDirection2dMobilityModel::DoGetPosition (void) const
{
return m_helper.GetCurrentPosition (m_parameters->m_bounds);
}
void
-RandomDirection2dMobilityModel::DoSet (const Position &position)
+RandomDirection2dMobilityModel::DoSetPosition (const Vector &position)
{
m_helper.InitializePosition (position);
Simulator::Remove (m_event);
m_event = Simulator::ScheduleNow (&RandomDirection2dMobilityModel::Start, this);
}
-Speed
-RandomDirection2dMobilityModel::DoGetSpeed (void) const
+Vector
+RandomDirection2dMobilityModel::DoGetVelocity (void) const
{
- return m_helper.GetSpeed ();
+ return m_helper.GetVelocity ();
}
--- a/src/mobility/random-direction-2d-mobility-model.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/random-direction-2d-mobility-model.h Thu Nov 08 17:05:37 2007 -0800
@@ -106,9 +106,9 @@
void SetDirectionAndSpeed (double direction);
void InitializeDirectionAndSpeed (void);
virtual void DoDispose (void);
- virtual Position DoGet (void) const;
- virtual void DoSet (const Position &position);
- virtual Speed DoGetSpeed (void) const;
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
static const double PI;
Ptr<RandomDirection2dMobilityModelParameters> m_parameters;
--- a/src/mobility/random-position.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/random-position.cc Thu Nov 08 17:05:37 2007 -0800
@@ -91,12 +91,12 @@
m_x = 0;
m_y = 0;
}
-Position
+Vector
RandomRectanglePosition::Get (void) const
{
double x = m_x->GetValue ();
double y = m_y->GetValue ();
- return Position (x, y, 0.0);
+ return Vector (x, y, 0.0);
}
RandomDiscPosition::RandomDiscPosition ()
@@ -120,7 +120,7 @@
m_theta = 0;
m_rho = 0;
}
-Position
+Vector
RandomDiscPosition::Get (void) const
{
double theta = m_theta->GetValue ();
@@ -128,7 +128,7 @@
double x = m_x + std::cos (theta) * rho;
double y = m_y + std::sin (theta) * rho;
NS_LOG_DEBUG ("Disc position x=" << x << ", y=" << y);
- return Position (x, y, 0.0);
+ return Vector (x, y, 0.0);
}
--- a/src/mobility/random-position.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/random-position.h Thu Nov 08 17:05:37 2007 -0800
@@ -22,7 +22,7 @@
#include "ns3/object.h"
#include "ns3/component-manager.h"
-#include "position.h"
+#include "vector.h"
namespace ns3 {
@@ -42,7 +42,7 @@
/**
* \returns the next randomly-choosen position.
*/
- virtual Position Get (void) const = 0;
+ virtual Vector Get (void) const = 0;
};
/**
@@ -67,7 +67,7 @@
RandomRectanglePosition (const RandomVariable &x,
const RandomVariable &y);
virtual ~RandomRectanglePosition ();
- virtual Position Get (void) const;
+ virtual Vector Get (void) const;
private:
RandomVariable *m_x;
RandomVariable *m_y;
@@ -102,7 +102,7 @@
const RandomVariable &rho,
double x, double y);
virtual ~RandomDiscPosition ();
- virtual Position Get (void) const;
+ virtual Vector Get (void) const;
private:
RandomVariable *m_theta;
RandomVariable *m_rho;
--- a/src/mobility/random-topology.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/random-topology.cc Thu Nov 08 17:05:37 2007 -0800
@@ -70,8 +70,8 @@
Ptr<MobilityModel> mobility = ComponentManager::Create<MobilityModel> (m_mobilityModel,
MobilityModel::iid);
object->AddInterface (mobility);
- Position position = m_positionModel->Get ();
- mobility->Set (position);
+ Vector position = m_positionModel->Get ();
+ mobility->SetPosition (position);
}
--- a/src/mobility/random-walk-2d-mobility-model.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/random-walk-2d-mobility-model.cc Thu Nov 08 17:05:37 2007 -0800
@@ -24,10 +24,10 @@
#include "ns3/rectangle-default-value.h"
#include "ns3/random-variable-default-value.h"
#include "ns3/simulator.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
#include <cmath>
-NS_DEBUG_COMPONENT_DEFINE ("RandomWalk2d");
+NS_LOG_COMPONENT_DEFINE ("RandomWalk2d");
namespace ns3 {
@@ -143,9 +143,9 @@
{
double speed = m_parameters->m_speed->GetValue ();
double direction = m_parameters->m_direction->GetValue ();
- Speed vector (std::cos (direction) * speed,
- std::sin (direction) * speed,
- 0.0);
+ Vector vector (std::cos (direction) * speed,
+ std::sin (direction) * speed,
+ 0.0);
m_helper.Reset (vector);
Time delayLeft;
@@ -163,11 +163,11 @@
void
RandomWalk2dMobilityModel::DoWalk (Time delayLeft)
{
- Position position = m_helper.GetCurrentPosition ();
- Speed speed = m_helper.GetSpeed ();
- Position nextPosition = position;
- nextPosition.x += speed.dx * delayLeft.GetSeconds ();
- nextPosition.y += speed.dy * delayLeft.GetSeconds ();
+ Vector position = m_helper.GetCurrentPosition ();
+ Vector speed = m_helper.GetVelocity ();
+ Vector nextPosition = position;
+ nextPosition.x += speed.x * delayLeft.GetSeconds ();
+ nextPosition.y += speed.y * delayLeft.GetSeconds ();
if (m_parameters->m_bounds.IsInside (nextPosition))
{
m_event = Simulator::Schedule (delayLeft, &RandomWalk2dMobilityModel::Start, this);
@@ -175,7 +175,7 @@
else
{
nextPosition = m_parameters->m_bounds.CalculateIntersection (position, speed);
- Time delay = Seconds ((nextPosition.x - position.x) / speed.dx);
+ Time delay = Seconds ((nextPosition.x - position.x) / speed.x);
m_event = Simulator::Schedule (delay, &RandomWalk2dMobilityModel::Rebound, this,
delayLeft - delay);
}
@@ -185,17 +185,17 @@
void
RandomWalk2dMobilityModel::Rebound (Time delayLeft)
{
- Position position = m_helper.GetCurrentPosition (m_parameters->m_bounds);
- Speed speed = m_helper.GetSpeed ();
+ Vector position = m_helper.GetCurrentPosition (m_parameters->m_bounds);
+ Vector speed = m_helper.GetVelocity ();
switch (m_parameters->m_bounds.GetClosestSide (position))
{
case Rectangle::RIGHT:
case Rectangle::LEFT:
- speed.dx = - speed.dx;
+ speed.x = - speed.x;
break;
case Rectangle::TOP:
case Rectangle::BOTTOM:
- speed.dy = - speed.dy;
+ speed.y = - speed.y;
break;
}
m_helper.Reset (speed);
@@ -209,23 +209,23 @@
// chain up
MobilityModel::DoDispose ();
}
-Position
-RandomWalk2dMobilityModel::DoGet (void) const
+Vector
+RandomWalk2dMobilityModel::DoGetPosition (void) const
{
return m_helper.GetCurrentPosition (m_parameters->m_bounds);
}
void
-RandomWalk2dMobilityModel::DoSet (const Position &position)
+RandomWalk2dMobilityModel::DoSetPosition (const Vector &position)
{
NS_ASSERT (m_parameters->m_bounds.IsInside (position));
m_helper.InitializePosition (position);
Simulator::Remove (m_event);
m_event = Simulator::ScheduleNow (&RandomWalk2dMobilityModel::Start, this);
}
-Speed
-RandomWalk2dMobilityModel::DoGetSpeed (void) const
+Vector
+RandomWalk2dMobilityModel::DoGetVelocity (void) const
{
- return m_helper.GetSpeed ();
+ return m_helper.GetVelocity ();
}
--- a/src/mobility/random-walk-2d-mobility-model.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/random-walk-2d-mobility-model.h Thu Nov 08 17:05:37 2007 -0800
@@ -132,9 +132,9 @@
void Rebound (Time timeLeft);
void DoWalk (Time timeLeft);
virtual void DoDispose (void);
- virtual Position DoGet (void) const;
- virtual void DoSet (const Position &position);
- virtual Speed DoGetSpeed (void) const;
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
StaticSpeedHelper m_helper;
EventId m_event;
--- a/src/mobility/random-waypoint-mobility-model.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/random-waypoint-mobility-model.cc Thu Nov 08 17:05:37 2007 -0800
@@ -117,15 +117,15 @@
void
RandomWaypointMobilityModel::BeginWalk (void)
{
- Position m_current = m_helper.GetCurrentPosition ();
- Position destination = m_parameters->m_position->Get ();
+ Vector m_current = m_helper.GetCurrentPosition ();
+ Vector destination = m_parameters->m_position->Get ();
double speed = m_parameters->m_speed->GetValue ();
double dx = (destination.x - m_current.x);
double dy = (destination.y - m_current.y);
double dz = (destination.z - m_current.z);
double k = speed / std::sqrt (dx*dx + dy*dy + dz*dz);
- m_helper.Reset (Speed (k*dx, k*dy, k*dz));
+ m_helper.Reset (Vector (k*dx, k*dy, k*dz));
Time travelDelay = Seconds (CalculateDistance (destination, m_current) / speed);
m_event = Simulator::Schedule (travelDelay,
&RandomWaypointMobilityModel::Start, this);
@@ -141,22 +141,22 @@
m_event = Simulator::Schedule (pause, &RandomWaypointMobilityModel::BeginWalk, this);
}
-Position
-RandomWaypointMobilityModel::DoGet (void) const
+Vector
+RandomWaypointMobilityModel::DoGetPosition (void) const
{
return m_helper.GetCurrentPosition ();
}
void
-RandomWaypointMobilityModel::DoSet (const Position &position)
+RandomWaypointMobilityModel::DoSetPosition (const Vector &position)
{
m_helper.InitializePosition (position);
Simulator::Remove (m_event);
Simulator::ScheduleNow (&RandomWaypointMobilityModel::Start, this);
}
-Speed
-RandomWaypointMobilityModel::DoGetSpeed (void) const
+Vector
+RandomWaypointMobilityModel::DoGetVelocity (void) const
{
- return m_helper.GetSpeed ();
+ return m_helper.GetVelocity ();
}
--- a/src/mobility/random-waypoint-mobility-model.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/random-waypoint-mobility-model.h Thu Nov 08 17:05:37 2007 -0800
@@ -98,9 +98,9 @@
private:
void Start (void);
void BeginWalk (void);
- virtual Position DoGet (void) const;
- virtual void DoSet (const Position &position);
- virtual Speed DoGetSpeed (void) const;
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
StaticSpeedHelper m_helper;
Ptr<RandomWaypointMobilityModelParameters> m_parameters;
--- a/src/mobility/rectangle.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/rectangle.cc Thu Nov 08 17:05:37 2007 -0800
@@ -18,8 +18,7 @@
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "rectangle.h"
-#include "position.h"
-#include "speed.h"
+#include "vector.h"
#include "ns3/assert.h"
#include <cmath>
#include <algorithm>
@@ -42,7 +41,7 @@
{}
bool
-Rectangle::IsInside (const Position &position) const
+Rectangle::IsInside (const Vector &position) const
{
return
position.x <= this->xMax && position.x >= this->xMin &&
@@ -50,7 +49,7 @@
}
Rectangle::Side
-Rectangle::GetClosestSide (const Position &position) const
+Rectangle::GetClosestSide (const Vector &position) const
{
double xMinDist = std::abs (position.x - this->xMin);
double xMaxDist = std::abs (this->xMax - position.x);
@@ -82,38 +81,38 @@
}
}
-Position
-Rectangle::CalculateIntersection (const Position ¤t, const Speed &speed) const
+Vector
+Rectangle::CalculateIntersection (const Vector ¤t, const Vector &speed) const
{
- double xMaxY = current.y + (this->xMax - current.x) / speed.dx * speed.dy;
- double xMinY = current.y + (this->xMin - current.x) / speed.dx * speed.dy;
- double yMaxX = current.x + (this->yMax - current.y) / speed.dy * speed.dx;
- double yMinX = current.x + (this->yMin - current.y) / speed.dy * speed.dx;
+ double xMaxY = current.y + (this->xMax - current.x) / speed.x * speed.y;
+ double xMinY = current.y + (this->xMin - current.x) / speed.x * speed.y;
+ double yMaxX = current.x + (this->yMax - current.y) / speed.y * speed.x;
+ double yMinX = current.x + (this->yMin - current.y) / speed.y * speed.x;
bool xMaxYOk = (xMaxY <= this->yMax && xMaxY >= this->yMin);
bool xMinYOk = (xMinY <= this->yMax && xMinY >= this->yMin);
bool yMaxXOk = (yMaxX <= this->xMax && yMaxX >= this->xMin);
bool yMinXOk = (yMinX <= this->xMax && yMinX >= this->xMin);
- if (xMaxYOk && speed.dx >= 0)
+ if (xMaxYOk && speed.x >= 0)
{
- return Position (this->xMax, xMaxY, 0.0);
+ return Vector (this->xMax, xMaxY, 0.0);
}
- else if (xMinYOk && speed.dx <= 0)
+ else if (xMinYOk && speed.x <= 0)
{
- return Position (this->xMin, xMinY, 0.0);
+ return Vector (this->xMin, xMinY, 0.0);
}
- else if (yMaxXOk && speed.dy >= 0)
+ else if (yMaxXOk && speed.y >= 0)
{
- return Position (yMaxX, this->yMax, 0.0);
+ return Vector (yMaxX, this->yMax, 0.0);
}
- else if (yMinXOk && speed.dy <= 0)
+ else if (yMinXOk && speed.y <= 0)
{
- return Position (yMinX, this->yMin, 0.0);
+ return Vector (yMinX, this->yMin, 0.0);
}
else
{
NS_ASSERT (false);
// quiet compiler
- return Position (0.0, 0.0, 0.0);
+ return Vector (0.0, 0.0, 0.0);
}
}
--- a/src/mobility/rectangle.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/rectangle.h Thu Nov 08 17:05:37 2007 -0800
@@ -22,8 +22,7 @@
namespace ns3 {
-class Position;
-class Speed;
+class Vector;
/**
* \brief a 2d rectangle
@@ -51,9 +50,9 @@
* Create a zero-sized rectangle located at coordinates (0.0,0.0)
*/
Rectangle ();
- bool IsInside (const Position &position) const;
- Side GetClosestSide (const Position &position) const;
- Position CalculateIntersection (const Position ¤t, const Speed &speed) const;
+ bool IsInside (const Vector &position) const;
+ Side GetClosestSide (const Vector &position) const;
+ Vector CalculateIntersection (const Vector ¤t, const Vector &speed) const;
double xMin;
double xMax;
--- a/src/mobility/speed.cc Mon Oct 29 13:40:25 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "speed.h"
-
-namespace ns3 {
-
-Speed::Speed (double _dx, double _dy, double _dz)
- : dx (_dx),
- dy (_dy),
- dz (_dz)
-{}
-
-Speed::Speed ()
- : dx (0.0),
- dy (0.0),
- dz (0.0)
-{}
-
-} // namespace ns3
--- a/src/mobility/speed.h Mon Oct 29 13:40:25 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef SPEED_H
-#define SPEED_H
-
-namespace ns3 {
-
-/**
- * \brief keep track of 3d cartesian speed vectors
- *
- * Unit is meters/s.
- */
-class Speed
-{
-public:
- /**
- * \param _dx x coordinate of speed vector
- * \param _dy y coordinate of speed vector
- * \param _dz z coordinate of speed vector
- *
- * Create speed vector (_dx, _dy, _dz)
- */
- Speed (double _dx, double _dy, double _dz);
- /**
- * Create speed vector (0.0, 0.0, 0.0)
- */
- Speed ();
- /**
- * x coordinate of speed vector
- */
- double dx;
- /**
- * y coordinate of speed vector
- */
- double dy;
- /**
- * z coordinate of speed vector
- */
- double dz;
-};
-
-} // namespace ns3
-
-#endif /* SPEED_H */
--- a/src/mobility/static-mobility-model.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/static-mobility-model.cc Thu Nov 08 17:05:37 2007 -0800
@@ -28,7 +28,7 @@
{
SetInterfaceId (StaticMobilityModel::iid);
}
-StaticMobilityModel::StaticMobilityModel (const Position &position)
+StaticMobilityModel::StaticMobilityModel (const Vector &position)
: m_position (position)
{
SetInterfaceId (StaticMobilityModel::iid);
@@ -36,21 +36,21 @@
StaticMobilityModel::~StaticMobilityModel ()
{}
-Position
-StaticMobilityModel::DoGet (void) const
+Vector
+StaticMobilityModel::DoGetPosition (void) const
{
return m_position;
}
void
-StaticMobilityModel::DoSet (const Position &position)
+StaticMobilityModel::DoSetPosition (const Vector &position)
{
m_position = position;
NotifyCourseChange ();
}
-Speed
-StaticMobilityModel::DoGetSpeed (void) const
+Vector
+StaticMobilityModel::DoGetVelocity (void) const
{
- return Speed ();
+ return Vector (0.0, 0.0, 0.0);
}
}; // namespace ns3
--- a/src/mobility/static-mobility-model.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/static-mobility-model.h Thu Nov 08 17:05:37 2007 -0800
@@ -44,15 +44,15 @@
* Create a position located at coordinates (x,y,z).
* Unit is meters
*/
- StaticMobilityModel (const Position &position);
+ StaticMobilityModel (const Vector &position);
virtual ~StaticMobilityModel ();
private:
- virtual Position DoGet (void) const;
- virtual void DoSet (const Position &position);
- virtual Speed DoGetSpeed (void) const;
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
- Position m_position;
+ Vector m_position;
};
}; // namespace ns3
--- a/src/mobility/static-speed-helper.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/static-speed-helper.cc Thu Nov 08 17:05:37 2007 -0800
@@ -25,40 +25,40 @@
StaticSpeedHelper::StaticSpeedHelper ()
{}
-StaticSpeedHelper::StaticSpeedHelper (const Position &position)
+StaticSpeedHelper::StaticSpeedHelper (const Vector &position)
: m_position (position)
{}
-StaticSpeedHelper::StaticSpeedHelper (const Position &position,
- const Speed &speed)
+StaticSpeedHelper::StaticSpeedHelper (const Vector &position,
+ const Vector &speed)
: m_position (position),
m_speed (speed),
m_paused (true)
{}
void
-StaticSpeedHelper::InitializePosition (const Position &position)
+StaticSpeedHelper::InitializePosition (const Vector &position)
{
m_position = position;
- m_speed.dx = 0.0;
- m_speed.dy = 0.0;
- m_speed.dz = 0.0;
+ m_speed.x = 0.0;
+ m_speed.y = 0.0;
+ m_speed.z = 0.0;
m_lastUpdate = Simulator::Now ();
m_paused = true;
}
-Position
+Vector
StaticSpeedHelper::GetCurrentPosition (void) const
{
Update ();
return m_position;
}
-Speed
-StaticSpeedHelper::GetSpeed (void) const
+Vector
+StaticSpeedHelper::GetVelocity (void) const
{
- return m_paused? Speed (0, 0, 0) : m_speed;
+ return m_paused? Vector (0.0, 0.0, 0.0) : m_speed;
}
void
-StaticSpeedHelper::SetSpeed (const Speed &speed)
+StaticSpeedHelper::SetSpeed (const Vector &speed)
{
Update ();
m_speed = speed;
@@ -76,13 +76,13 @@
Time deltaTime = now - m_lastUpdate;
m_lastUpdate = now;
double deltaS = deltaTime.GetSeconds ();
- m_position.x += m_speed.dx * deltaS;
- m_position.y += m_speed.dy * deltaS;
- m_position.z += m_speed.dz * deltaS;
+ m_position.x += m_speed.x * deltaS;
+ m_position.y += m_speed.y * deltaS;
+ m_position.z += m_speed.z * deltaS;
}
void
-StaticSpeedHelper::Reset (const Speed &speed)
+StaticSpeedHelper::Reset (const Vector &speed)
{
Update ();
m_speed = speed;
@@ -98,7 +98,7 @@
m_position.y = std::max (bounds.yMin, m_position.y);
}
-Position
+Vector
StaticSpeedHelper::GetCurrentPosition (const Rectangle &bounds) const
{
UpdateFull (bounds);
--- a/src/mobility/static-speed-helper.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/static-speed-helper.h Thu Nov 08 17:05:37 2007 -0800
@@ -21,8 +21,7 @@
#define STATIC_SPEED_HELPER_H
#include "ns3/nstime.h"
-#include "position.h"
-#include "speed.h"
+#include "vector.h"
namespace ns3 {
@@ -32,16 +31,16 @@
{
public:
StaticSpeedHelper ();
- StaticSpeedHelper (const Position &position);
- StaticSpeedHelper (const Position &position,
- const Speed &speed);
- void InitializePosition (const Position &position);
+ StaticSpeedHelper (const Vector &position);
+ StaticSpeedHelper (const Vector &position,
+ const Vector &speed);
+ void InitializePosition (const Vector &position);
- void Reset (const Speed &speed);
- Position GetCurrentPosition (const Rectangle &bounds) const;
- Position GetCurrentPosition (void) const;
- Speed GetSpeed (void) const;
- void SetSpeed (const Speed &speed);
+ void Reset (const Vector &speed);
+ Vector GetCurrentPosition (const Rectangle &bounds) const;
+ Vector GetCurrentPosition (void) const;
+ Vector GetVelocity (void) const;
+ void SetSpeed (const Vector &speed);
void Pause (void);
void Unpause (void);
@@ -49,8 +48,8 @@
void Update (void) const;
void UpdateFull (const Rectangle &rectangle) const;
mutable Time m_lastUpdate;
- mutable Position m_position;
- Speed m_speed;
+ mutable Vector m_position;
+ Vector m_speed;
bool m_paused;
};
--- a/src/mobility/static-speed-mobility-model.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/static-speed-mobility-model.cc Thu Nov 08 17:05:37 2007 -0800
@@ -33,13 +33,13 @@
{
SetInterfaceId (StaticSpeedMobilityModel::iid);
}
-StaticSpeedMobilityModel::StaticSpeedMobilityModel (const Position &position)
+StaticSpeedMobilityModel::StaticSpeedMobilityModel (const Vector &position)
: m_helper (position)
{
SetInterfaceId (StaticSpeedMobilityModel::iid);
}
-StaticSpeedMobilityModel::StaticSpeedMobilityModel (const Position &position,
- const Speed &speed)
+StaticSpeedMobilityModel::StaticSpeedMobilityModel (const Vector &position,
+ const Vector &speed)
: m_helper (position, speed)
{
SetInterfaceId (StaticSpeedMobilityModel::iid);
@@ -49,28 +49,28 @@
{}
void
-StaticSpeedMobilityModel::SetSpeed (const Speed speed)
+StaticSpeedMobilityModel::SetSpeed (const Vector &speed)
{
m_helper.SetSpeed (speed);
NotifyCourseChange ();
}
-Position
-StaticSpeedMobilityModel::DoGet (void) const
+Vector
+StaticSpeedMobilityModel::DoGetPosition (void) const
{
return m_helper.GetCurrentPosition ();
}
void
-StaticSpeedMobilityModel::DoSet (const Position &position)
+StaticSpeedMobilityModel::DoSetPosition (const Vector &position)
{
m_helper.InitializePosition (position);
NotifyCourseChange ();
}
-Speed
-StaticSpeedMobilityModel::DoGetSpeed (void) const
+Vector
+StaticSpeedMobilityModel::DoGetVelocity (void) const
{
- return m_helper.GetSpeed ();
+ return m_helper.GetVelocity ();
}
}; // namespace ns3
--- a/src/mobility/static-speed-mobility-model.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/static-speed-mobility-model.h Thu Nov 08 17:05:37 2007 -0800
@@ -25,7 +25,6 @@
#include "ns3/nstime.h"
#include "ns3/component-manager.h"
#include "static-speed-helper.h"
-#include "speed.h"
namespace ns3 {
@@ -48,15 +47,15 @@
* Create a position located at coordinates (x,y,z) with
* speed (0,0,0).
*/
- StaticSpeedMobilityModel (const Position &position);
+ StaticSpeedMobilityModel (const Vector &position);
/**
*
* Create a position located at coordinates (x,y,z) with
* speed (dx,dy,dz).
* Unit is meters and meters/s
*/
- StaticSpeedMobilityModel (const Position &position,
- const Speed &speed);
+ StaticSpeedMobilityModel (const Vector &position,
+ const Vector &speed);
virtual ~StaticSpeedMobilityModel ();
/**
@@ -65,11 +64,11 @@
* Set the current speed now to (dx,dy,dz)
* Unit is meters/s
*/
- void SetSpeed (const Speed speed);
+ void SetSpeed (const Vector &speed);
private:
- virtual Position DoGet (void) const;
- virtual void DoSet (const Position &position);
- virtual Speed DoGetSpeed (void) const;
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
void Update (void) const;
StaticSpeedHelper m_helper;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/vector.cc Thu Nov 08 17:05:37 2007 -0800
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "vector.h"
+#include <cmath>
+
+namespace ns3 {
+
+
+Vector::Vector (double _x, double _y, double _z)
+ : x (_x),
+ y (_y),
+ z (_z)
+{}
+
+Vector::Vector ()
+ : x (0.0),
+ y (0.0),
+ z (0.0)
+{}
+
+double
+CalculateDistance (const Vector &a, const Vector &b)
+{
+ double dx = b.x - a.x;
+ double dy = b.y - a.y;
+ double dz = b.z - a.z;
+ double distance = std::sqrt (dx * dx + dy * dy + dz * dz);
+ return distance;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/vector.h Thu Nov 08 17:05:37 2007 -0800
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef VECTOR_H
+#define VECTOR_H
+
+namespace ns3 {
+
+/**
+ * \brief a 3d cartesian position vector
+ *
+ * Unit is meters.
+ */
+class Vector
+{
+public:
+ /**
+ * \param _x x coordinate of vector vector
+ * \param _y y coordinate of vector vector
+ * \param _z z coordinate of vector vector
+ *
+ * Create vector vector (_x, _y, _z)
+ */
+ Vector (double _x, double _y, double _z);
+ /**
+ * Create vector vector (0.0, 0.0, 0.0)
+ */
+ Vector ();
+ /**
+ * x coordinate of vector vector
+ */
+ double x;
+ /**
+ * y coordinate of vector vector
+ */
+ double y;
+ /**
+ * z coordinate of vector vector
+ */
+ double z;
+};
+
+double CalculateDistance (const Vector &a, const Vector &b);
+
+} // namespace ns3
+
+#endif /* VECTOR_H */
--- a/src/mobility/wscript Mon Oct 29 13:40:25 2007 -0700
+++ b/src/mobility/wscript Thu Nov 08 17:05:37 2007 -0800
@@ -3,16 +3,15 @@
def build(bld):
mobility = bld.create_ns3_module('mobility', ['core', 'simulator'])
mobility.source = [
+ 'vector.cc',
'grid-topology.cc',
'hierarchical-mobility-model.cc',
'mobility-model.cc',
'mobility-model-notifier.cc',
- 'position.cc',
'random-position.cc',
'random-topology.cc',
'rectangle.cc',
'rectangle-default-value.cc',
- 'speed.cc',
'static-mobility-model.cc',
'static-speed-helper.cc',
'static-speed-mobility-model.cc',
@@ -24,16 +23,15 @@
headers = bld.create_obj('ns3header')
headers.source = [
+ 'vector.h',
'grid-topology.h',
'hierarchical-mobility-model.h',
'mobility-model.h',
'mobility-model-notifier.h',
- 'position.h',
'random-position.h',
'random-topology.h',
'rectangle.h',
'rectangle-default-value.h',
- 'speed.h',
'static-mobility-model.h',
'static-speed-helper.h',
'static-speed-mobility-model.h',
--- a/src/routing/olsr/olsr-agent-impl.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/routing/olsr/olsr-agent-impl.cc Thu Nov 08 17:05:37 2007 -0800
@@ -34,7 +34,7 @@
#include "ns3/udp.h"
#include "ns3/internet-node.h"
#include "ns3/simulator.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
#include "ns3/random-variable.h"
#include "ns3/inet-socket-address.h"
#include "ns3/composite-trace-resolver.h"
@@ -143,7 +143,7 @@
namespace ns3 {
namespace olsr {
-NS_DEBUG_COMPONENT_DEFINE ("OlsrAgent");
+NS_LOG_COMPONENT_DEFINE ("OlsrAgent");
/********** OLSR class **********/
@@ -232,7 +232,7 @@
NS_ASSERT (m_mainAddress != Ipv4Address ());
}
- NS_DEBUG ("Starting OLSR on node " << m_mainAddress);
+ NS_LOG_DEBUG ("Starting OLSR on node " << m_mainAddress);
m_routingTable = Create<RoutingTable> (m_ipv4, m_mainAddress);
// Add OLSR as routing protocol, with slightly lower priority than
@@ -247,7 +247,7 @@
TcTimerExpire ();
MidTimerExpire ();
- NS_DEBUG ("OLSR on node " << m_mainAddress << " started");
+ NS_LOG_DEBUG ("OLSR on node " << m_mainAddress << " started");
}
void AgentImpl::SetMainInterface (uint32_t interface)
@@ -284,7 +284,7 @@
Ptr<Packet> receivedPacket,
const Address &sourceAddress)
{
- NS_DEBUG ("OLSR node " << m_mainAddress << " received a OLSR packet");
+ NS_LOG_DEBUG ("OLSR node " << m_mainAddress << " received a OLSR packet");
InetSocketAddress inetSourceAddr = InetSocketAddress::ConvertFrom (sourceAddress);
// All routing messages are sent from and to port RT_PORT,
@@ -308,7 +308,7 @@
sizeLeft -= messageHeader.GetSerializedSize ();
- NS_DEBUG ("Olsr Msg received with type "
+ NS_LOG_DEBUG ("Olsr Msg received with type "
<< std::dec << int (messageHeader.GetMessageType ())
<< " TTL=" << int (messageHeader.GetTimeToLive ())
<< " origAddr=" << messageHeader.GetOriginatorAddress ());
@@ -343,29 +343,29 @@
switch (messageHeader.GetMessageType ())
{
case olsr::MessageHeader::HELLO_MESSAGE:
- NS_DEBUG ("OLSR node received HELLO message of size " << messageHeader.GetSerializedSize ());
+ NS_LOG_DEBUG ("OLSR node received HELLO message of size " << messageHeader.GetSerializedSize ());
ProcessHello (messageHeader, m_mainAddress, inetSourceAddr.GetIpv4 ());
break;
case olsr::MessageHeader::TC_MESSAGE:
- NS_DEBUG ("OLSR node received TC message of size " << messageHeader.GetSerializedSize ());
+ NS_LOG_DEBUG ("OLSR node received TC message of size " << messageHeader.GetSerializedSize ());
ProcessTc (messageHeader, inetSourceAddr.GetIpv4 ());
break;
case olsr::MessageHeader::MID_MESSAGE:
- NS_DEBUG ("OLSR node received MID message of size " << messageHeader.GetSerializedSize ());
+ NS_LOG_DEBUG ("OLSR node received MID message of size " << messageHeader.GetSerializedSize ());
ProcessMid (messageHeader, inetSourceAddr.GetIpv4 ());
break;
default:
- NS_DEBUG ("OLSR message type " <<
+ NS_LOG_DEBUG ("OLSR message type " <<
int (messageHeader.GetMessageType ()) <<
" not implemented");
}
}
else
{
- NS_DEBUG ("OLSR message is duplicated, not reading it.");
+ NS_LOG_DEBUG ("OLSR message is duplicated, not reading it.");
// If the message has been considered for forwarding, it should
// not be retransmitted again
@@ -1093,7 +1093,7 @@
AgentImpl::SendPacket (Ptr<Packet> packet,
const MessageList &containedMessages)
{
- NS_DEBUG ("OLSR node " << m_mainAddress << " sending a OLSR packet");
+ NS_LOG_DEBUG ("OLSR node " << m_mainAddress << " sending a OLSR packet");
// Add a header
olsr::PacketHeader header;
@@ -1121,7 +1121,7 @@
Ptr<Packet> packet = Create<Packet> ();
int numMessages = 0;
- NS_DEBUG ("Olsr node " << m_mainAddress << ": SendQueuedMessages");
+ NS_LOG_DEBUG ("Olsr node " << m_mainAddress << ": SendQueuedMessages");
MessageList msglist;
@@ -1249,8 +1249,8 @@
linkMessages.push_back (linkMessage);
}
- NS_DEBUG ("OLSR HELLO message size: " << int (msg.GetSerializedSize ())
- << " (with " << int (linkMessages.size ()) << " link messages)");
+ NS_LOG_DEBUG ("OLSR HELLO message size: " << int (msg.GetSerializedSize ())
+ << " (with " << int (linkMessages.size ()) << " link messages)");
QueueMessage (msg, JITTER);
}
@@ -2113,40 +2113,3 @@
}} // namespace olsr, ns3
-
-#ifdef RUN_SELF_TESTS
-
-
-#include "ns3/test.h"
-
-namespace ns3 {
-
-class OlsrTest : public ns3::Test {
-private:
-public:
- OlsrTest ();
- virtual bool RunTests (void);
-
-
-};
-
-OlsrTest::OlsrTest ()
- : ns3::Test ("Olsr")
-{}
-
-
-bool
-OlsrTest::RunTests (void)
-{
- bool result = true;
-
-
- return result;
-}
-
-static OlsrTest gOlsrTest;
-
-}
-
-
-#endif /* RUN_SELF_TESTS */
--- a/src/routing/olsr/olsr-agent-impl.h Mon Oct 29 13:40:25 2007 -0700
+++ b/src/routing/olsr/olsr-agent-impl.h Thu Nov 08 17:05:37 2007 -0800
@@ -48,8 +48,6 @@
class AgentImpl : public Agent
{
- friend class OlsrTest;
-
public:
AgentImpl (Ptr<Node> node);
--- a/src/routing/olsr/routing-table.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/src/routing/olsr/routing-table.cc Thu Nov 08 17:05:37 2007 -0800
@@ -28,11 +28,11 @@
#include "routing-table.h"
#include "ns3/packet.h"
#include "ns3/ipv4-header.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
namespace ns3 { namespace olsr {
-NS_DEBUG_COMPONENT_DEFINE ("OlsrRoutingTable");
+NS_LOG_COMPONENT_DEFINE ("OlsrRoutingTable");
///
/// \brief Clears the routing table and frees the memory assigned to each one of its entries.
@@ -119,19 +119,19 @@
Ipv4Route route = Ipv4Route::CreateHostRouteTo
(ipHeader.GetDestination (), entry2.nextAddr, entry2.interface);
- NS_DEBUG ("Olsr node" << m_mainAddress
- << ": RouteRequest for dest=" << ipHeader.GetDestination ()
- << " --> destHop=" << entry2.nextAddr
- << " interface=" << entry2.interface);
+ NS_LOG_DEBUG ("Olsr node" << m_mainAddress
+ << ": RouteRequest for dest=" << ipHeader.GetDestination ()
+ << " --> destHop=" << entry2.nextAddr
+ << " interface=" << entry2.interface);
routeReply (true, route, packet, ipHeader);
return true;
}
else
{
- NS_DEBUG ("Olsr node" << m_mainAddress
- << ": RouteRequest for dest=" << ipHeader.GetDestination ()
- << " --> NOT FOUND");
+ NS_LOG_DEBUG ("Olsr node" << m_mainAddress
+ << ": RouteRequest for dest=" << ipHeader.GetDestination ()
+ << " --> NOT FOUND");
return false;
}
}
--- a/tutorial/hello-simulator.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/tutorial/hello-simulator.cc Thu Nov 08 17:05:37 2007 -0800
@@ -15,7 +15,6 @@
*/
#include "ns3/log.h"
-#include "ns3/debug.h"
NS_LOG_COMPONENT_DEFINE ("HelloSimulator");
@@ -24,8 +23,6 @@
int
main (int argc, char *argv[])
{
- DebugComponentEnable ("Log");
-
// LogComponentEnable ("HelloSimulator",
// LogLevel (LOG_LEVEL_INFO | LOG_PREFIX_ALL));
--- a/utils/bench-packets.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/utils/bench-packets.cc Thu Nov 08 17:05:37 2007 -0800
@@ -211,13 +211,19 @@
argc--;
argv++;
}
+ if (n == 0)
+ {
+ std::cerr << "Error-- number of packets must be specified " <<
+ "by command-line argument --n=(number of packets)" << std::endl;
+ exit (1);
+ }
+ std::cout << "Running bench-packets with n=" << n << std::endl;
-
+ Packet::EnableMetadata ();
runBench (&benchPtrA, n, "a");
runBench (&benchPtrB, n, "b");
runBench (&benchPtrC, n, "c");
- Packet::EnableMetadata ();
//runBench (&benchPrint, n, "print");
PacketMetadata::SetOptOne (false);
runBench (&benchPtrA, n, "meta-a");
--- a/utils/mobility-visualizer-model.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/utils/mobility-visualizer-model.cc Thu Nov 08 17:05:37 2007 -0800
@@ -48,15 +48,15 @@
{
Ptr<Node> node = *nodeIter;
Ptr<MobilityModel> mobility = node->QueryInterface<MobilityModel> (MobilityModel::iid);
- Position pos = mobility->Get ();
- Speed vel = mobility->GetSpeed ();
+ Vector pos = mobility->GetPosition ();
+ Vector vel = mobility->GetVelocity ();
NodeUpdate update;
update.node = PeekPointer<Node> (node);
update.x = pos.x;
update.y = pos.y;
- update.vx = vel.dx;
- update.vy = vel.dy;
+ update.vx = vel.x;
+ update.vy = vel.y;
data->updateList.push_back (update);
}
data->time = Simulator::Now ().GetSeconds ();
--- a/utils/run-tests.cc Mon Oct 29 13:40:25 2007 -0700
+++ b/utils/run-tests.cc Thu Nov 08 17:05:37 2007 -0800
@@ -21,11 +21,13 @@
#include "ns3/test.h"
#include "ns3/packet-metadata.h"
+#include "ns3/random-variable.h"
int main (int argc, char *argv[])
{
#ifdef RUN_SELF_TESTS
+ ns3::RandomVariable::UseGlobalSeed(1,2,3,4,5,6);
ns3::PacketMetadata::Enable ();
ns3::TestManager::EnableVerbose ();
bool success = ns3::TestManager::RunTests ();
--- a/wscript Mon Oct 29 13:40:25 2007 -0700
+++ b/wscript Thu Nov 08 17:05:37 2007 -0800
@@ -118,7 +118,6 @@
variant_env.append_value('CXXFLAGS', ['-Werror'])
if 'debug' in Params.g_options.debug_level.lower():
- variant_env.append_value('CXXDEFINES', 'NS3_DEBUG_ENABLE')
variant_env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE')
variant_env.append_value('CXXDEFINES', 'NS3_LOG_ENABLE')