src/stats/helper/file-helper.h
author Jared Ivey <j.ivey@gatech.edu>
Mon, 18 Nov 2013 09:51:24 -0800
changeset 10426 11e80cad10f4
parent 10118 848770c90669
child 10527 210b3b72062d
permissions -rw-r--r--
doxygen warnings for stats module
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10118
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     2
/*
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     3
 * Copyright (c) 2013 University of Washington
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     4
 *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     8
 *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    12
 * GNU General Public License for more details.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    13
 *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    17
 *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    18
 * Author: Mitch Watrous (watrous@u.washington.edu)
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    19
 */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    20
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    21
#ifndef FILE_HELPER_H
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    22
#define FILE_HELPER_H
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    23
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    24
#include <map>
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    25
#include <string>
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    26
#include "ns3/object-factory.h"
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    27
#include "ns3/ptr.h"
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    28
#include "ns3/probe.h"
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    29
#include "ns3/file-aggregator.h"
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    30
#include "ns3/time-series-adaptor.h"
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    31
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    32
namespace ns3 {
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    33
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    34
/**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    35
 * \brief Helper class used to put data values into a file.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    36
 **/
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    37
class FileHelper
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    38
{
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    39
public:
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    40
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    41
   * Constructs a file helper that will create a space separated file
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    42
   * named "file-helper.txt" unless it is later configured otherwise.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    43
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    44
  FileHelper ();
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    45
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    46
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    47
   * \param outputFileNameWithoutExtension name of output file to
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    48
   * write with no extension
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    49
   * \param fileType type of file to write.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    50
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    51
   * Constructs a file helper that will create a file named
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    52
   * outputFileNameWithoutExtension plus possible extra information
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    53
   * from wildcard matches plus ".txt" with values printed as
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    54
   * specified by fileType.  The default file type is space-separated.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    55
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    56
  FileHelper (const std::string &outputFileNameWithoutExtension,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    57
              enum FileAggregator::FileType fileType = FileAggregator::SPACE_SEPARATED);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    58
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    59
  virtual ~FileHelper ();
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    60
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    61
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    62
   * \param outputFileNameWithoutExtension name of output file to
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    63
   * write with no extension
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    64
   * \param fileType type of file to write.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    65
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    66
   * Configures file related parameters for this file helper so that
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    67
   * it will create a file named outputFileNameWithoutExtension plus
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    68
   * possible extra information from wildcard matches plus ".txt" with
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    69
   * values printed as specified by fileType.  The default file type
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    70
   * is space-separated.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    71
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    72
  void ConfigureFile (const std::string &outputFileNameWithoutExtension,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    73
                      enum FileAggregator::FileType fileType = FileAggregator::SPACE_SEPARATED);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    74
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    75
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    76
   * \param typeId the type ID for the probe used when it is created.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    77
   * \param path Config path to access the probe.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    78
   * \param probeTraceSource the probe trace source to access.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    79
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    80
   * Creates output files generated by hooking the ns-3 trace source
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    81
   * with a probe, and then writing the values from the
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    82
   * probeTraceSource. The output file names will have the text stored
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    83
   * in m_outputFileNameWithoutExtension plus ".txt", and will consist
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    84
   * of the 'newValue' at each timestamp.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    85
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    86
   * If the config path has more than one match in the system
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    87
   * (e.g. there is a wildcard), then one output file for each match
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    88
   * will be created.  The output file names will contain the text in
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    89
   * m_outputFileNameWithoutExtension plus the matched characters for
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    90
   * each of the wildcards in the config path, separated by dashes,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    91
   * plus ".txt".  For example, if the value in
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    92
   * m_outputFileNameWithoutExtension is the string
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    93
   * "packet-byte-count", and there are two wildcards in the path,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    94
   * then output file names like "packet-byte-count-0-0.txt" or
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    95
   * "packet-byte-count-12-9.txt" will be possible as names for the
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    96
   * files that will be created.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    97
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    98
   * A fatal error will result if an unknown probe type is used.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    99
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   100
  void WriteProbe (const std::string &typeId,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   101
                   const std::string &path,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   102
                   const std::string &probeTraceSource);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   103
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   104
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   105
   * \param typeId the type ID for the probe used when it is created.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   106
   * \param probeName the probe's name.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   107
   * \param path Config path to access the probe
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   108
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   109
   * \brief Adds a probe to be used to write values to files.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   110
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   111
  void AddProbe (const std::string &typeId,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   112
                 const std::string &probeName,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   113
                 const std::string &path);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   114
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   115
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   116
   * \param adaptorName the timeSeriesAdaptor's name.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   117
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   118
   * \brief Adds a time series adaptor to be used to write the file.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   119
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   120
  void AddTimeSeriesAdaptor (const std::string &adaptorName);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   121
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   122
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   123
   * \param aggregatorName the aggregator's name.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   124
   * \param outputFileName name of the file to write.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   125
   * \param onlyOneAggregator indicates if more than one aggregator
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   126
   * should be created or not.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   127
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   128
   * \brief Adds an aggregator to be used to write values to files.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   129
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   130
  void AddAggregator (const std::string &aggregatorName,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   131
                      const std::string &outputFileName,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   132
                      bool onlyOneAggregator);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   133
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   134
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   135
   * \param probeName the probe's name.
10426
11e80cad10f4 doxygen warnings for stats module
Jared Ivey <j.ivey@gatech.edu>
parents: 10118
diff changeset
   136
   * \return Ptr to the probe
10118
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   137
   * \brief Gets the specified probe.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   138
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   139
  Ptr<Probe> GetProbe (std::string probeName) const;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   140
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   141
  /**
10426
11e80cad10f4 doxygen warnings for stats module
Jared Ivey <j.ivey@gatech.edu>
parents: 10118
diff changeset
   142
   * \return Ptr to a FileAggregator object
10118
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   143
   * \brief Gets the single aggregator that is always constructed.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   144
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   145
   * This function is non-const because an aggregator may be lazily
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   146
   * created by this method.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   147
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   148
  Ptr<FileAggregator> GetAggregatorSingle ();
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   149
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   150
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   151
   * \param aggregatorName name for aggregator.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   152
   * \param outputFileName name of output file to write.
10426
11e80cad10f4 doxygen warnings for stats module
Jared Ivey <j.ivey@gatech.edu>
parents: 10118
diff changeset
   153
   * \return Ptr to a FileAggregator object
10118
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   154
   * \brief Gets one of the multiple aggregators from the map.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   155
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   156
   * This function is non-const because an aggregator may be lazily
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   157
   * created by this method.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   158
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   159
  Ptr<FileAggregator> GetAggregatorMultiple (const std::string &aggregatorName,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   160
                                             const std::string &outputFileName);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   161
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   162
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   163
   * \param heading the heading string.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   164
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   165
   * \brief Sets the heading string that will be printed on the first
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   166
   * line of the file.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   167
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   168
   * Note that the heading string will only be printed if it has been
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   169
   * set by calling this function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   170
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   171
  void SetHeading (const std::string &heading);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   172
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   173
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   174
   * \param format the 1D format string.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   175
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   176
   * \brief Sets the 1D format string for the C-style sprintf()
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   177
   * function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   178
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   179
  void Set1dFormat (const std::string &format);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   180
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   181
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   182
   * \param format the 2D format string.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   183
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   184
   * \brief Sets the 2D format string for the C-style sprintf()
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   185
   * function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   186
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   187
  void Set2dFormat (const std::string &format);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   188
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   189
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   190
   * \param format the 3D format string.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   191
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   192
   * \brief Sets the 3D format string for the C-style sprintf()
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   193
   * function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   194
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   195
  void Set3dFormat (const std::string &format);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   196
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   197
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   198
   * \param format the 4D format string.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   199
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   200
   * \brief Sets the 4D format string for the C-style sprintf()
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   201
   * function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   202
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   203
  void Set4dFormat (const std::string &format);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   204
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   205
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   206
   * \param format the 5D format string.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   207
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   208
   * \brief Sets the 5D format string for the C-style sprintf()
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   209
   * function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   210
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   211
  void Set5dFormat (const std::string &format);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   212
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   213
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   214
   * \param format the 6D format string.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   215
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   216
   * \brief Sets the 6D format string for the C-style sprintf()
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   217
   * function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   218
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   219
  void Set6dFormat (const std::string &format);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   220
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   221
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   222
   * \param format the 7D format string.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   223
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   224
   * \brief Sets the 7D format string for the C-style sprintf()
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   225
   * function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   226
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   227
  void Set7dFormat (const std::string &format);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   228
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   229
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   230
   * \param format the 8D format string.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   231
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   232
   * \brief Sets the 8D format string for the C-style sprintf()
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   233
   * function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   234
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   235
  void Set8dFormat (const std::string &format);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   236
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   237
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   238
   * \param format the 9D format string.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   239
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   240
   * \brief Sets the 9D format string for the C-style sprintf()
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   241
   * function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   242
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   243
  void Set9dFormat (const std::string &format);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   244
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   245
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   246
   * \param format the 10D format string.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   247
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   248
   * \brief Sets the 10D format string for the C-style sprintf()
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   249
   * function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   250
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   251
  void Set10dFormat (const std::string &format);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   252
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   253
private:
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   254
  /**
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   255
   * \param typeId the type ID for the probe used when it is created.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   256
   * \param matchIdentifier this string is used to make the probe's
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   257
   * context be unique.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   258
   * \param path Config path to access the probe.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   259
   * \param probeTraceSource the probe trace source to access.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   260
   * \param outputFileNameWithoutExtension name of output file to
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   261
   * write with no extension
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   262
   * \param onlyOneAggregator indicates if more than one aggregator
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   263
   * should be created or not.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   264
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   265
   * \brief Connects the probe to the aggregator.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   266
   *
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   267
   * A fatal error will result if an unknown probe type is used.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   268
   */
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   269
  void ConnectProbeToAggregator (const std::string &typeId,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   270
                                 const std::string &matchIdentifier,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   271
                                 const std::string &path,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   272
                                 const std::string &probeTraceSource,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   273
                                 const std::string &outputFileNameWithoutExtension,
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   274
                                 bool onlyOneAggregator);
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   275
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   276
  /// Used to create the probes and collectors as they are added.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   277
  ObjectFactory m_factory;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   278
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   279
  /// The single aggregator that is always created in the constructor.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   280
  Ptr<FileAggregator> m_aggregator;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   281
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   282
  /// Maps aggregator names to aggregators when multiple aggregators
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   283
  /// are needed.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   284
  std::map<std::string, Ptr<FileAggregator> > m_aggregatorMap;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   285
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   286
  /// Maps probe names to probes.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   287
  std::map<std::string, std::pair <Ptr<Probe>, std::string> > m_probeMap;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   288
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   289
  /// Maps time series adaptor names to time series adaptors.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   290
  std::map<std::string, Ptr<TimeSeriesAdaptor> > m_timeSeriesAdaptorMap;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   291
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   292
  /// Number of file probes that have been created.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   293
  uint32_t m_fileProbeCount;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   294
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   295
  /// Determines the kind of file written by the aggregator.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   296
  enum FileAggregator::FileType m_fileType;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   297
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   298
  /// The name of the output file to created without its extension.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   299
  std::string m_outputFileNameWithoutExtension;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   300
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   301
  /// Indicates if the heading line for the file has been set.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   302
  bool m_hasHeadingBeenSet;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   303
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   304
  /// Heading line for the outputfile.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   305
  std::string m_heading;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   306
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   307
  /// Format strings for C-style sprintf() function.
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   308
  std::string m_1dFormat;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   309
  std::string m_2dFormat;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   310
  std::string m_3dFormat;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   311
  std::string m_4dFormat;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   312
  std::string m_5dFormat;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   313
  std::string m_6dFormat;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   314
  std::string m_7dFormat;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   315
  std::string m_8dFormat;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   316
  std::string m_9dFormat;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   317
  std::string m_10dFormat;
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   318
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   319
}; // class FileHelper
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   320
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   321
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   322
} // namespace ns3
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   323
848770c90669 data collection extensions for stats module
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   324
#endif // FILE_HELPER_H