Class for input file stream container for storing long double values. More...
#include "satellite-input-fstream-time-long-double-container.h"
Public Member Functions | |
SatInputFileStreamTimeLongDoubleContainer () | |
Constructor. More... | |
SatInputFileStreamTimeLongDoubleContainer (std::string filename, std::ios::openmode filemode, uint32_t valuesInRow) | |
Constructor. More... | |
~SatInputFileStreamTimeLongDoubleContainer () | |
Destructor. More... | |
void | DoDispose () |
Do needed dispose actions. More... | |
std::vector< long double > | InterpolateBetweenClosestTimeSamples () |
Function for locating time samples enclosing the current time and a linear interpolation between these samples. More... | |
std::vector< long double > | ProceedToNextClosestTimeSample () |
Function for locating the next closest time sample and returning the values related to it. More... | |
void | UpdateContainer (std::string filename, std::ios::openmode filemode, uint32_t valuesInRow) |
Function for updating the container. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
NS-3 function for type id. More... | |
Private Member Functions | |
void | CheckContainerSanity () |
Check container time sample sanity. More... | |
void | ClearContainer () |
Function for clearing the container. More... | |
bool | FindNextClosest (uint32_t lastValidPosition, long double timeShiftValue, double long comparisonTimeValue) |
Function for locating the next closest value index. More... | |
std::vector< long double > | ReadRow () |
Function for reading a row from file. More... | |
void | Reset () |
Function for resetting the variables. More... | |
void | ResetStream () |
Function for resetting the stream. More... | |
Private Attributes | |
std::vector< std::vector< long double > > | m_container |
Container for value rows. More... | |
std::ios::openmode | m_fileMode |
File mode. More... | |
std::string | m_fileName |
File name. More... | |
std::ifstream * | m_inputFileStream |
Pointer to input file stream. More... | |
SatInputFileStreamWrapper * | m_inputFileStreamWrapper |
Pointer to input file stream wrapper. More... | |
uint32_t | m_lastValidPosition |
Last valid position. More... | |
uint32_t | m_numOfPasses |
Number for how many times the available samples have been looped over. More... | |
uint32_t | m_timeColumn |
Index for column which contains time information. More... | |
long double | m_timeShiftValue |
Shift value for sample time. More... | |
uint32_t | m_valuesInRow |
Number of values in a row. More... | |
Class for input file stream container for storing long double values.
The class implements reading the values from a file, storing the values and iterating the stored values.
Row format is [time, value1, ..., value n].
Definition at line 43 of file satellite-input-fstream-time-long-double-container.h.
ns3::SatInputFileStreamTimeLongDoubleContainer::SatInputFileStreamTimeLongDoubleContainer | ( | std::string | filename, |
std::ios::openmode | filemode, | ||
uint32_t | valuesInRow | ||
) |
Constructor.
filename | file name |
filemode | file mode |
valuesInRow | number of values in a row |
Definition at line 41 of file satellite-input-fstream-time-long-double-container.cc.
References m_fileMode, m_fileName, m_valuesInRow, and UpdateContainer().
ns3::SatInputFileStreamTimeLongDoubleContainer::SatInputFileStreamTimeLongDoubleContainer | ( | ) |
Constructor.
Definition at line 61 of file satellite-input-fstream-time-long-double-container.cc.
ns3::SatInputFileStreamTimeLongDoubleContainer::~SatInputFileStreamTimeLongDoubleContainer | ( | ) |
Destructor.
Definition at line 78 of file satellite-input-fstream-time-long-double-container.cc.
References Reset().
|
private |
Check container time sample sanity.
check time sample sanity
Definition at line 148 of file satellite-input-fstream-time-long-double-container.cc.
References m_container, and m_timeColumn.
Referenced by UpdateContainer().
|
private |
Function for clearing the container.
Definition at line 347 of file satellite-input-fstream-time-long-double-container.cc.
References m_container, m_lastValidPosition, m_numOfPasses, m_timeShiftValue, and m_valuesInRow.
Referenced by Reset(), and UpdateContainer().
void ns3::SatInputFileStreamTimeLongDoubleContainer::DoDispose | ( | void | ) |
Do needed dispose actions.
Definition at line 86 of file satellite-input-fstream-time-long-double-container.cc.
References Reset().
|
private |
Function for locating the next closest value index.
This locator loops the samples if the container does not have enough samples. Next closest index value is saved to a separate member variable.
lastValidPosition | position of last matching value |
timeShiftValue | value to shift the time if needed |
comparisonValue | value which next closest match to find |
Definition at line 260 of file satellite-input-fstream-time-long-double-container.cc.
References m_container, m_lastValidPosition, m_numOfPasses, m_timeColumn, m_timeShiftValue, and m_valuesInRow.
Referenced by InterpolateBetweenClosestTimeSamples(), and ProceedToNextClosestTimeSample().
|
static |
NS-3 function for type id.
Definition at line 33 of file satellite-input-fstream-time-long-double-container.cc.
std::vector< long double > ns3::SatInputFileStreamTimeLongDoubleContainer::InterpolateBetweenClosestTimeSamples | ( | ) |
Function for locating time samples enclosing the current time and a linear interpolation between these samples.
Definition at line 209 of file satellite-input-fstream-time-long-double-container.cc.
References FindNextClosest(), m_container, m_lastValidPosition, m_timeColumn, and m_timeShiftValue.
std::vector< long double > ns3::SatInputFileStreamTimeLongDoubleContainer::ProceedToNextClosestTimeSample | ( | ) |
Function for locating the next closest time sample and returning the values related to it.
Definition at line 182 of file satellite-input-fstream-time-long-double-container.cc.
References FindNextClosest(), m_container, m_fileName, m_lastValidPosition, m_numOfPasses, m_timeColumn, and m_timeShiftValue.
|
private |
Function for reading a row from file.
Definition at line 132 of file satellite-input-fstream-time-long-double-container.cc.
References m_inputFileStream, and m_valuesInRow.
Referenced by UpdateContainer().
|
private |
Function for resetting the variables.
Definition at line 325 of file satellite-input-fstream-time-long-double-container.cc.
References ClearContainer(), and ResetStream().
Referenced by ~SatInputFileStreamTimeLongDoubleContainer(), and DoDispose().
|
private |
Function for resetting the stream.
Definition at line 334 of file satellite-input-fstream-time-long-double-container.cc.
References m_inputFileStream, and m_inputFileStreamWrapper.
Referenced by Reset(), and UpdateContainer().
void ns3::SatInputFileStreamTimeLongDoubleContainer::UpdateContainer | ( | std::string | filename, |
std::ios::openmode | filemode, | ||
uint32_t | valuesInRow | ||
) |
Function for updating the container.
filename | file name |
filemode | file mode |
valuesInRow | number of values in a row |
Definition at line 95 of file satellite-input-fstream-time-long-double-container.cc.
References CheckContainerSanity(), ClearContainer(), ns3::SatInputFileStreamWrapper::GetStream(), m_container, m_fileMode, m_fileName, m_inputFileStream, m_inputFileStreamWrapper, m_valuesInRow, ReadRow(), and ResetStream().
Referenced by SatInputFileStreamTimeLongDoubleContainer().
|
private |
Container for value rows.
Definition at line 149 of file satellite-input-fstream-time-long-double-container.h.
Referenced by CheckContainerSanity(), ClearContainer(), FindNextClosest(), InterpolateBetweenClosestTimeSamples(), ProceedToNextClosestTimeSample(), and UpdateContainer().
|
private |
File mode.
Definition at line 159 of file satellite-input-fstream-time-long-double-container.h.
Referenced by SatInputFileStreamTimeLongDoubleContainer(), and UpdateContainer().
|
private |
File name.
Definition at line 154 of file satellite-input-fstream-time-long-double-container.h.
Referenced by SatInputFileStreamTimeLongDoubleContainer(), ProceedToNextClosestTimeSample(), and UpdateContainer().
|
private |
Pointer to input file stream.
Definition at line 144 of file satellite-input-fstream-time-long-double-container.h.
Referenced by ReadRow(), ResetStream(), and UpdateContainer().
|
private |
Pointer to input file stream wrapper.
Definition at line 139 of file satellite-input-fstream-time-long-double-container.h.
Referenced by ResetStream(), and UpdateContainer().
|
private |
Last valid position.
Definition at line 169 of file satellite-input-fstream-time-long-double-container.h.
Referenced by ClearContainer(), FindNextClosest(), InterpolateBetweenClosestTimeSamples(), and ProceedToNextClosestTimeSample().
|
private |
Number for how many times the available samples have been looped over.
Definition at line 174 of file satellite-input-fstream-time-long-double-container.h.
Referenced by ClearContainer(), FindNextClosest(), and ProceedToNextClosestTimeSample().
|
private |
Index for column which contains time information.
Definition at line 184 of file satellite-input-fstream-time-long-double-container.h.
Referenced by CheckContainerSanity(), FindNextClosest(), InterpolateBetweenClosestTimeSamples(), and ProceedToNextClosestTimeSample().
|
private |
Shift value for sample time.
Definition at line 179 of file satellite-input-fstream-time-long-double-container.h.
Referenced by ClearContainer(), FindNextClosest(), InterpolateBetweenClosestTimeSamples(), and ProceedToNextClosestTimeSample().
|
private |
Number of values in a row.
Definition at line 164 of file satellite-input-fstream-time-long-double-container.h.
Referenced by SatInputFileStreamTimeLongDoubleContainer(), ClearContainer(), FindNextClosest(), ReadRow(), and UpdateContainer().