Loading...
Searching...
No Matches
satellite-output-fstream-double-container.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 Magister Solutions Ltd.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Frans Laakso <frans.laakso@magister.fi>
19 */
20
21#ifndef SAT_OUTPUT_FSTREAM_DOUBLE_CONTAINER_H
22#define SAT_OUTPUT_FSTREAM_DOUBLE_CONTAINER_H
23
25
26#include "ns3/gnuplot.h"
27#include "ns3/object.h"
28
29#include <fstream>
30#include <stdint.h>
31
32namespace ns3
33{
34
43{
44 public:
51
56 static TypeId GetTypeId(void);
57
64 SatOutputFileStreamDoubleContainer(std::string filename,
65 std::ios::openmode filemode,
66 uint32_t valuesInRow);
67
72
77
82
86 void AddToContainer(std::vector<double> newItem);
87
91 void DoDispose();
92
102 void EnableFigureOutput(std::string title,
103 std::string legendY,
104 std::string legendX,
105 std::string keyPosition,
106 FigureUnitConversion_t figureUnitConversionType,
107 Gnuplot2dDataset::Style style);
108
109 private:
113 void Reset();
114
118 void ResetStream();
119
123 void ClearContainer();
124
128 void OpenStream();
129
133 void PrintFigure();
134
140 double ConvertValue(double value);
141
146 Gnuplot2dDataset GetGnuplotDataset();
147
152 Gnuplot GetGnuplot();
153
158
162 std::ofstream* m_outputFileStream;
163
167 std::vector<std::vector<double>> m_container;
168
172 std::string m_fileName;
173
177 std::ios::openmode m_fileMode;
178
183
188
192 std::string m_title;
193
197 std::string m_legendY;
198
202 std::string m_legendX;
203
207 std::string m_keyPosition;
208
213
217 Gnuplot2dDataset::Style m_style;
218};
219
220} // namespace ns3
221
222#endif /* SAT_OUTPUT_FSTREAM_DOUBLE_CONTAINER_H */
SatOutputFileStreamDoubleContainer(std::string filename, std::ios::openmode filemode, uint32_t valuesInRow)
Constructor.
double ConvertValue(double value)
Function for converting the container data samples.
void OpenStream()
Function for opening the output file stream.
std::vector< std::vector< double > > m_container
Container for value rows.
SatOutputFileStreamWrapper * m_outputFileStreamWrapper
Pointer to output file stream wrapper.
bool m_printFigure
Enable / disable printing of container contents into a figure.
Gnuplot2dDataset GetGnuplotDataset()
Function for creating Gnuplot datasets.
Gnuplot2dDataset::Style m_style
2D dataset figure style
FigureUnitConversion_t m_figureUnitConversionType
Describes which unit conversion should be used with the figure.
void AddToContainer(std::vector< double > newItem)
Function for adding the values to container.
void PrintFigure()
Function for printing the container contents into a figure.
std::ofstream * m_outputFileStream
Pointer to output file stream.
void EnableFigureOutput(std::string title, std::string legendY, std::string legendX, std::string keyPosition, FigureUnitConversion_t figureUnitConversionType, Gnuplot2dDataset::Style style)
Function for enabling the figure output.
void WriteContainerToFile()
Function for writing the container contents to file.
static TypeId GetTypeId(void)
NS-3 function for type id.
A class encapsulating an STL output stream.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.