Loading...
Searching...
No Matches
satellite-input-fstream-time-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_INPUT_FSTREAM_TIME_LONG_DOUBLE_CONTAINER_H
22#define SAT_INPUT_FSTREAM_TIME_LONG_DOUBLE_CONTAINER_H
23
25
26#include "ns3/object.h"
27
28#include <fstream>
29#include <stdint.h>
30
31namespace ns3
32{
33
44{
45 public:
50 static TypeId GetTypeId(void);
51
59 std::ios::openmode filemode,
60 uint32_t valuesInRow);
61
66
71
78 void UpdateContainer(std::string filename, std::ios::openmode filemode, uint32_t valuesInRow);
79
84 std::vector<long double> ProceedToNextClosestTimeSample();
85
91 std::vector<long double> InterpolateBetweenClosestTimeSamples();
92
96 void DoDispose();
97
98 private:
102 void Reset();
103
107 void ResetStream();
108
112 void ClearContainer();
113
118 std::vector<long double> ReadRow();
119
127 bool FindNextClosest(uint32_t lastValidPosition,
128 long double timeShiftValue,
129 double long comparisonTimeValue);
130
135
140
144 std::ifstream* m_inputFileStream;
145
149 std::vector<std::vector<long double>> m_container;
150
154 std::string m_fileName;
155
159 std::ios::openmode m_fileMode;
160
165
170
175
179 long double m_timeShiftValue;
180
184 uint32_t m_timeColumn;
185};
186
187} // namespace ns3
188
189#endif /* SAT_INPUT_FSTREAM_TIME_DOUBLE_CONTAINER_H */
std::vector< long double > ReadRow()
Function for reading a row from file.
uint32_t m_timeColumn
Index for column which contains time information.
bool FindNextClosest(uint32_t lastValidPosition, long double timeShiftValue, double long comparisonTimeValue)
Function for locating the next closest value index.
void UpdateContainer(std::string filename, std::ios::openmode filemode, uint32_t valuesInRow)
Function for updating the container.
std::vector< long double > ProceedToNextClosestTimeSample()
Function for locating the next closest time sample and returning the values related to it.
SatInputFileStreamTimeLongDoubleContainer(std::string filename, std::ios::openmode filemode, uint32_t valuesInRow)
Constructor.
uint32_t m_numOfPasses
Number for how many times the available samples have been looped over.
std::vector< long double > InterpolateBetweenClosestTimeSamples()
Function for locating time samples enclosing the current time and a linear interpolation between thes...
std::vector< std::vector< long double > > m_container
Container for value rows.
SatInputFileStreamWrapper * m_inputFileStreamWrapper
Pointer to input file stream wrapper.
A class encapsulating an STL input stream.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.