satellite-output-fstream-string-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_STRING_CONTAINER_H
22 #define SAT_OUTPUT_FSTREAM_STRING_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:
48  static TypeId GetTypeId(void);
49 
55  SatOutputFileStreamStringContainer(std::string filename, std::ios::openmode filemode);
56 
61 
66 
70  void WriteContainerToFile();
71 
75  void AddToContainer(std::string newLine);
76 
80  void DoDispose();
81 
82  private:
86  void Reset();
87 
91  void ResetStream();
92 
96  void ClearContainer();
97 
101  void OpenStream();
102 
107 
111  std::ofstream* m_outputFileStream;
112 
116  std::vector<std::string> m_container;
117 
121  std::string m_fileName;
122 
126  std::ios::openmode m_fileMode;
127 };
128 
129 } // namespace ns3
130 
131 #endif /* SAT_OUTPUT_FSTREAM_STRING_CONTAINER_H */
Class for output file stream container for strings.
void AddToContainer(std::string newLine)
Function for adding the line to container.
void OpenStream()
Function for opening the output file stream.
void WriteContainerToFile()
Function for writing the container contents to file.
std::ofstream * m_outputFileStream
Pointer to output file stream.
std::vector< std::string > m_container
Container for lines.
static TypeId GetTypeId(void)
NS-3 function for type id.
SatOutputFileStreamWrapper * m_outputFileStreamWrapper
Pointer to output file stream wrapper.
void ClearContainer()
Function for clearing the container.
A class encapsulating an STL output stream.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.