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 #include <stdint.h>
31 
32 namespace ns3
33 {
34 
43 {
44  public:
45  typedef enum
46  {
47  RAW,
51 
56  static TypeId GetTypeId(void);
57 
64  SatOutputFileStreamLongDoubleContainer(std::string filename,
65  std::ios::openmode filemode,
66  uint32_t valuesInRow);
67 
72 
77 
81  void WriteContainerToFile();
82 
86  void AddToContainer(std::vector<long double> newItem);
87 
91  void DoDispose();
92 
101  void EnableFigureOutput(std::string title,
102  std::string legendY,
103  std::string legendX,
104  std::string keyPosition,
105  FigureUnitConversion_t figureUnitConversionType);
106 
107  private:
111  void Reset();
112 
116  void ResetStream();
117 
121  void ClearContainer();
122 
126  void OpenStream();
127 
131  void PrintFigure();
132 
138  long double ConvertValue(long double value);
139 
144  Gnuplot2dDataset GetGnuplotDataset();
145 
150  Gnuplot GetGnuplot();
151 
156 
160  std::ofstream* m_outputFileStream;
161 
165  std::vector<std::vector<long double>> m_container;
166 
170  std::string m_fileName;
171 
175  std::ios::openmode m_fileMode;
176 
180  uint32_t m_valuesInRow;
181 
186 
190  std::string m_title;
191 
195  std::string m_legendY;
196 
200  std::string m_legendX;
201 
205  std::string m_keyPosition;
206 
211 };
212 
213 } // namespace ns3
214 
215 #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.