src/netanim/model/animation-interface.h
author John Abraham <john.abraham@gatech.edu>
Wed, 07 Sep 2011 10:40:15 -0400
changeset 7476 2761997c72b2
parent 7454 e1bbc514be33
child 7484 cd2d8cd79237
permissions -rw-r--r--
NetAnim: Set a random position if mobility model does not exist
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     1
/*
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     2
 * This program is free software; you can redistribute it and/or modify
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     3
 * it under the terms of the GNU General Public License version 2 as
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     4
 * published by the Free Software Foundation;
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     5
 *
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     6
 * This program is distributed in the hope that it will be useful,
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     7
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     8
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     9
 * GNU General Public License for more details.
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    10
 *
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    11
 * You should have received a copy of the GNU General Public License
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    12
 * along with this program; if not, write to the Free Software
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    13
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    14
 *
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    15
 * Author: George F. Riley<riley@ece.gatech.edu>
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    16
 * Modified by: John Abraham <john.abraham@gatech.edu>
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    17
 */
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    18
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    19
// Interface between ns3 and the network animator
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    20
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    21
#ifndef ANIMATION_INTERFACE__H
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    22
#define ANIMATION_INTERFACE__H
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    23
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    24
#include <string>
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    25
#include <stdio.h>
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    26
#include <map>
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    27
#include "ns3/ptr.h"
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    28
#include "ns3/net-device.h"
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    29
#include "ns3/nstime.h"
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    30
#include "ns3/log.h"
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    31
#include "ns3/node-list.h"
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    32
#include "ns3/simulator.h"
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    33
#include "ns3/config.h"
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    34
#include "ns3/animation-interface-helper.h"
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    35
#include "ns3/mac48-address.h"
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    36
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    37
namespace ns3 {
7241
0a7a16b599e8 Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents: 7181
diff changeset
    38
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    39
/**
7271
73bb230b6d6c organize doxygen modules alphabetically
Tom Henderson <tomh@tomh.org>
parents: 7243
diff changeset
    40
 * \defgroup netanim Netanim
73bb230b6d6c organize doxygen modules alphabetically
Tom Henderson <tomh@tomh.org>
parents: 7243
diff changeset
    41
 *
73bb230b6d6c organize doxygen modules alphabetically
Tom Henderson <tomh@tomh.org>
parents: 7243
diff changeset
    42
 * This section documents the API of the ns-3 netanim module. For a generic functional description, please refer to the ns-3 manual.
73bb230b6d6c organize doxygen modules alphabetically
Tom Henderson <tomh@tomh.org>
parents: 7243
diff changeset
    43
 */
73bb230b6d6c organize doxygen modules alphabetically
Tom Henderson <tomh@tomh.org>
parents: 7243
diff changeset
    44
73bb230b6d6c organize doxygen modules alphabetically
Tom Henderson <tomh@tomh.org>
parents: 7243
diff changeset
    45
/**
7241
0a7a16b599e8 Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents: 7181
diff changeset
    46
 * \ingroup netanim
0a7a16b599e8 Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents: 7181
diff changeset
    47
 *
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    48
 * \brief Interface to network animator
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    49
 *
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    50
 * Provides functions that facilitate communications with an
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    51
 * external or internal network animator.
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    52
 */
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    53
class AnimationInterface
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    54
{
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    55
public:
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    56
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    57
  /**
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    58
   * \brief Construct the animator interface. No arguments needed.
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
    59
   *
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    60
   */
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    61
  AnimationInterface ();
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    62
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    63
  /**
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    64
   * \brief Destructor for the animator interface.
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
    65
   *
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    66
   */
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    67
  ~AnimationInterface ();
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    68
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    69
  /**
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    70
   * \brief Constructor
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
    71
   * \param filename The Filename for the trace file used by the Animator
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
    72
   * \param usingXML Set to true if XML output traces are required
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    73
   *
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    74
   */
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    75
  AnimationInterface (const std::string filename, bool usingXML = true);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    76
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    77
  /**
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    78
   * \brief Constructor
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
    79
   * \param port Port on which ns-3 should listen to for connection from the
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    80
   *        external netanim application
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
    81
   * \param usingXML Set to true if XML output traces are required
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    82
   *
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    83
   */
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    84
  AnimationInterface (uint16_t port, bool usingXML = true);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    85
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    86
  /**
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    87
   * \brief Specify that animation commands are to be written
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    88
   * to the specified output file.
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    89
   *
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    90
   * This call is used to write the animation information to a text
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    91
   * file that can later be used as input to the network animator tool.
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    92
   *
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    93
   * \param fn The name of the output file.
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    94
   * \returns true if successful open.
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
    95
   *
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    96
   */
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    97
  bool SetOutputFile (const std::string& fn);
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    98
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
    99
  /**
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   100
   * \brief Specify that animation commands are to be written
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   101
   * in XML format.
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   102
   *
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   103
   * \returns none
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   104
   *
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   105
   */
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   106
  void SetXMLOutput ();
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   107
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   108
  /**
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   109
   * \brief Specify that animation commands are to be written to
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   110
   * a socket.
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   111
   *
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   112
   * This call is used to set the ns3 process in server mode, waiting
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   113
   * for a TCP connection from the animator.  This call will not
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   114
   * return until the animator connects in, or if the bind to the
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   115
   * specified port fails.
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   116
   *
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   117
   * \param port Port number to bind to.
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   118
   * \returns true if connection created, false if bind failed.
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   119
   *
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   120
   */
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   121
  bool SetServerPort (uint16_t port);
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   122
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   123
  /**
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   124
   * \brief Writes the topology information and sets up the appropriate
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   125
   *  animation packet tx callback
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   126
   *
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   127
   * Writes the topology information to the appropriate output, depending
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   128
   * on prior calls to SetOutputFile, SetServerPort, or SetInternalAnimation.
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   129
   * Then creates the callbacks needed for the animator to start processing
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   130
   * packets.
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   131
   *
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   132
   */
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   133
  void StartAnimation ();
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   134
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   135
  /**
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   136
   * \brief Closes the interface to the animator.
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   137
   *
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   138
   */
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   139
  void StopAnimation ();
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   140
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   141
  /**
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   142
   * \brief Set mobility poll interval:WARNING: setting a low interval can 
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   143
   * cause slowness
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   144
   *
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   145
   * \param t Time interval between fetching mobility/position information
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   146
   * Default: 0.25s
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   147
   *
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   148
   */
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   149
  void SetMobilityPollInterval (Time t);
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   150
7454
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   151
  /**
7476
2761997c72b2 NetAnim: Set a random position if mobility model does not exist
John Abraham <john.abraham@gatech.edu>
parents: 7454
diff changeset
   152
   * \brief Set random position if a Mobility Model does not exists for the node
2761997c72b2 NetAnim: Set a random position if mobility model does not exist
John Abraham <john.abraham@gatech.edu>
parents: 7454
diff changeset
   153
   *
2761997c72b2 NetAnim: Set a random position if mobility model does not exist
John Abraham <john.abraham@gatech.edu>
parents: 7454
diff changeset
   154
   * \param setRandPos True if a random position can be set for a node without a
2761997c72b2 NetAnim: Set a random position if mobility model does not exist
John Abraham <john.abraham@gatech.edu>
parents: 7454
diff changeset
   155
   * Mobililty model
2761997c72b2 NetAnim: Set a random position if mobility model does not exist
John Abraham <john.abraham@gatech.edu>
parents: 7454
diff changeset
   156
   *
2761997c72b2 NetAnim: Set a random position if mobility model does not exist
John Abraham <john.abraham@gatech.edu>
parents: 7454
diff changeset
   157
   */
2761997c72b2 NetAnim: Set a random position if mobility model does not exist
John Abraham <john.abraham@gatech.edu>
parents: 7454
diff changeset
   158
  void SetRandomPosition (bool setRandPos);
2761997c72b2 NetAnim: Set a random position if mobility model does not exist
John Abraham <john.abraham@gatech.edu>
parents: 7454
diff changeset
   159
2761997c72b2 NetAnim: Set a random position if mobility model does not exist
John Abraham <john.abraham@gatech.edu>
parents: 7454
diff changeset
   160
  /**
7454
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   161
   * \brief typedef for WriteCallBack used for listening to AnimationInterface
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   162
   * write messages
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   163
   * 
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   164
   */
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   165
  typedef void (*AnimWriteCallback) (const char * str);
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   166
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   167
  /**
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   168
   * \brief Set a callback function to listen to AnimationInterface write events
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   169
   *
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   170
   * \param cb Address of callback function
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   171
   *
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   172
   */
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   173
  void SetAnimWriteCallback (AnimWriteCallback cb);
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   174
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   175
  /**
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   176
   * \brief Reset the write callback function
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   177
   *
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   178
   */
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   179
  void ResetAnimWriteCallback ();
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   180
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   181
private:
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   182
  
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   183
  int       m_fHandle;  // File handle for output (-1 if none)
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   184
  bool      m_xml;      // True if xml format desired
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   185
  Time mobilitypollinterval;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   186
  bool usingSockets;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   187
  uint16_t mport;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   188
  std::string outputfilename;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   189
  bool OutputFileSet;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   190
  bool ServerPortSet;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   191
  void DevTxTrace (std::string context,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   192
                   Ptr<const Packet> p,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   193
                   Ptr<NetDevice> tx,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   194
                   Ptr<NetDevice> rx,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   195
                   Time txTime,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   196
                   Time rxTime);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   197
  void WifiPhyTxBeginTrace (std::string context,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   198
                            Ptr<const Packet> p);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   199
  void WifiPhyTxEndTrace (std::string context,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   200
                          Ptr<const Packet> p);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   201
  void WifiPhyTxDropTrace (std::string context,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   202
                           Ptr<const Packet> p);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   203
  void WifiPhyRxBeginTrace (std::string context,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   204
                            Ptr<const Packet> p);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   205
  void WifiPhyRxEndTrace (std::string context,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   206
                          Ptr<const Packet> p);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   207
  void WifiPhyRxDropTrace (std::string context,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   208
                           Ptr<const Packet> p);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   209
  void WimaxTxTrace (std::string context,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   210
                     Ptr<const Packet> p,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   211
		     const Mac48Address &);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   212
  void WimaxRxTrace (std::string context,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   213
                     Ptr<const Packet> p,
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   214
                     const Mac48Address &);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   215
  void MobilityCourseChangeTrace (Ptr <const MobilityModel> mob);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   216
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   217
  // Write specified amount of data to the specified handle
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   218
  int  WriteN (int, const char*, uint32_t);
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   219
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   220
  // Write a string to the specified handle;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   221
  int  WriteN (int, const std::string&);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   222
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   223
  //Helpers to output xml wireless packet
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   224
  void OutputWirelessPacket (AnimPacketInfo& pktInfo, AnimRxInfo pktrxInfo);
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   225
  void MobilityAutoCheck ();
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   226
  
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   227
  uint64_t gAnimUid ;    // Packet unique identifier used by Animtion
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   228
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   229
  std::map<uint64_t, AnimPacketInfo> pendingWifiPackets;
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   230
  void AddPendingWifiPacket (uint64_t AnimUid, AnimPacketInfo&);
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   231
  bool WifiPacketIsPending (uint64_t AnimUid); 
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   232
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   233
  std::map<uint64_t, AnimPacketInfo> pendingWimaxPackets;
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   234
  void AddPendingWimaxPacket (uint64_t AnimUid, AnimPacketInfo&);
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   235
  bool WimaxPacketIsPending (uint64_t AnimUid); 
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   236
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   237
  uint64_t GetAnimUidFromPacket (Ptr <const Packet>);
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   238
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   239
  std::map<uint32_t, Vector> nodeLocation;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   240
  Vector GetPosition (Ptr <Node> n);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   241
  Vector UpdatePosition (Ptr <Node> n);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   242
  Vector UpdatePosition (Ptr <Node> n, Vector v);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   243
  void WriteDummyPacket ();
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   244
  bool NodeHasMoved (Ptr <Node> n, Vector newLocation);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   245
  void AddMargin ();
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   246
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   247
  // Recalculate topology bounds
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   248
  void RecalcTopoBounds (Vector v);
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   249
  std::vector < Ptr <Node> > RecalcTopoBounds ();
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   250
7476
2761997c72b2 NetAnim: Set a random position if mobility model does not exist
John Abraham <john.abraham@gatech.edu>
parents: 7454
diff changeset
   251
  bool randomPosition;
7454
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   252
  AnimWriteCallback m_writeCallback;
e1bbc514be33 NetAnim: Simple Write callback
John Abraham <john.abraham@gatech.edu>
parents: 7362
diff changeset
   253
7360
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   254
  // Path helper
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   255
  std::vector<std::string> GetElementsFromContext (std::string context);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   256
  Ptr <NetDevice> GetNetDeviceFromContext (std::string context);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   257
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   258
  // XML helpers
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   259
  std::string GetPreamble (void);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   260
  // Topology element dimensions
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   261
  double topo_minX;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   262
  double topo_minY;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   263
  double topo_maxX;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   264
  double topo_maxY;
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   265
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   266
  std::string GetXMLOpen_anim (uint32_t lp);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   267
  std::string GetXMLOpen_topology (double minX,double minY,double maxX,double maxY);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   268
  std::string GetXMLOpenClose_node (uint32_t lp,uint32_t id,double locX,double locY);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   269
  std::string GetXMLOpenClose_link (uint32_t fromLp,uint32_t fromId, uint32_t toLp, uint32_t toId);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   270
  std::string GetXMLOpen_packet (uint32_t fromLp,uint32_t fromId, double fbTx, double lbTx);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   271
  std::string GetXMLOpenClose_rx (uint32_t toLp, uint32_t toId, double fbRx, double lbRx);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   272
  std::string GetXMLOpen_wpacket (uint32_t fromLp,uint32_t fromId, double fbTx, double lbTx, double range);
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   273
  std::string GetXMLClose (std::string name) {return "</" + name + ">\n"; }
5949904cf955 Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents: 7271
diff changeset
   274
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   275
};
7362
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   276
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   277
/**
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   278
 * \ingroup netanim
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   279
 *
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   280
 * \brief Byte tag using by Anim to uniquely identify packets
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   281
 *
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   282
 * When Anim receives a Tx Notification we tag the packet with a unique global uint64_t identifier
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   283
 * before recording Tx information
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   284
 * When Anim receives Rx notifications the tag is used to retrieve Tx information recorded earlier 
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   285
 * 
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   286
 */
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   287
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   288
class AnimByteTag : public Tag
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   289
{
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   290
public:
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   291
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   292
  /**
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   293
   * \brief Get Type Id
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   294
   * \returns Type Id
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   295
   *
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   296
   */
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   297
  static TypeId GetTypeId (void);
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   298
  
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   299
  /**
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   300
   * \brief Get Instance Type Id
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   301
   * \returns Type Id
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   302
   *
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   303
   */
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   304
  virtual TypeId GetInstanceTypeId (void) const;
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   305
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   306
  /**
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   307
   * \brief Get Serialized Size
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   308
   * \returns Serialized Size (i.e size of uint64_t)
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   309
   *
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   310
   */
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   311
  virtual uint32_t GetSerializedSize (void) const;
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   312
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   313
  /**
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   314
   * \brief Serialize function
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   315
   * \param i Tag Buffer
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   316
   *
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   317
   */
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   318
  virtual void Serialize (TagBuffer i) const;
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   319
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   320
  /**
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   321
   * \brief Deserialize function
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   322
   * \param i Tag Buffer
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   323
   *
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   324
   */
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   325
  virtual void Deserialize (TagBuffer i);
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   326
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   327
  /**
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   328
   * \brief Print tag info
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   329
   * \param os Reference of ostream object
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   330
   *
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   331
   */
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   332
  virtual void Print (std::ostream &os) const;
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   333
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   334
  /**
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   335
   * \brief Set global Uid in tag
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   336
   * \param AnimUid global Uid
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   337
   *
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   338
   */
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   339
  void Set (uint64_t AnimUid);
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   340
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   341
  /**
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   342
   * \brief Get Uid in tag
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   343
   * \returns Uid in tag
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   344
   *
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   345
   */
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   346
  uint64_t Get (void) const;
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   347
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   348
private:
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   349
  uint64_t m_AnimUid;
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   350
};
36b42a8b16d1 Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents: 7360
diff changeset
   351
5776
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   352
}
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   353
#endif
aae948449722 Moved net-anim from contrib
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   354