satellite-output-fstream-long-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_LONG_DOUBLE_CONTAINER_H
22 #define SAT_OUTPUT_FSTREAM_LONG_DOUBLE_CONTAINER_H
23 
25 
26 #include "ns3/object.h"
27 #include <ns3/gnuplot.h>
28 
29 #include <fstream>
30 
31 namespace ns3
32 {
33 
42 {
43  public:
44  typedef enum
45  {
46  RAW,
50 
55  static TypeId GetTypeId(void);
56 
63  SatOutputFileStreamLongDoubleContainer(std::string filename,
64  std::ios::openmode filemode,
65  uint32_t valuesInRow);
66 
71 
76 
80  void WriteContainerToFile();
81 
85  void AddToContainer(std::vector<long double> newItem);
86 
90  void DoDispose();
91 
100  void EnableFigureOutput(std::string title,
101  std::string legendY,
102  std::string legendX,
103  std::string keyPosition,
104  FigureUnitConversion_t figureUnitConversionType);
105 
106  private:
110  void Reset();
111 
115  void ResetStream();
116 
120  void ClearContainer();
121 
125  void OpenStream();
126 
130  void PrintFigure();
131 
137  long double ConvertValue(long double value);
138 
143  Gnuplot2dDataset GetGnuplotDataset();
144 
149  Gnuplot GetGnuplot();
150 
155 
159  std::ofstream* m_outputFileStream;
160 
164  std::vector<std::vector<long double>> m_container;
165 
169  std::string m_fileName;
170 
174  std::ios::openmode m_fileMode;
175 
179  uint32_t m_valuesInRow;
180 
185 
189  std::string m_title;
190 
194  std::string m_legendY;
195 
199  std::string m_legendX;
200 
204  std::string m_keyPosition;
205 
210 };
211 
212 } // namespace ns3
213 
214 #endif /* SAT_OUTPUT_FSTREAM_LONG_DOUBLE_CONTAINER_H */
Class for output file stream container for long double values.
void AddToContainer(std::vector< long double > newItem)
Function for adding the values to container.
void PrintFigure()
Function for printing the container contents into a figure.
std::vector< std::vector< long double > > m_container
Container for value rows.
bool m_printFigure
Enable / disable printing of container contents into a figure.
void WriteContainerToFile()
Function for writing the container contents to file.
FigureUnitConversion_t m_figureUnitConversionType
Describes which unit conversion should be used with the figure.
void EnableFigureOutput(std::string title, std::string legendY, std::string legendX, std::string keyPosition, FigureUnitConversion_t figureUnitConversionType)
Function for enabling the figure output.
SatOutputFileStreamWrapper * m_outputFileStreamWrapper
Pointer to output file stream wrapper.
long double ConvertValue(long double value)
Function for converting the container data samples.
void OpenStream()
Function for opening the output file stream.
Gnuplot2dDataset GetGnuplotDataset()
Function for creating Gnuplot datasets.
A class encapsulating an STL output stream.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.