Read a segment list sequentially (for Omicron). More...
#include <Odata.h>
Public Member Functions | |
int | GetChunkDuration (void) |
Returns the nominal chunk duration. | |
int | GetChunkTimeEnd (void) |
Returns the GPS ending time of current chunk. | |
int | GetChunkTimeStart (void) |
Returns the GPS starting time of current chunk. | |
int | GetCurrentChunkDuration (void) |
Returns the current chunk duration. | |
int | GetCurrentOverlapDuration (void) |
Returns the current overlap duration. | |
int | GetNSegments (void) |
Returns number of subsegments in the current chunk. | |
int | GetOverlapDuration (void) |
Returns the nominal overlap duration. | |
int | GetSegmentDuration (void) |
Returns the segment duration. | |
int | GetSegmentTimeEnd (const int aNseg) |
Returns the GPS ending time of segment aNseg. | |
int | GetSegmentTimeStart (const int aNseg) |
Returns the GPS starting time of segment aNseg. | |
bool | NewChunk (void) |
Loads a new (next) chunk. | |
bool | SetSegments (Segments *aSegments) |
Sets the segments to read. | |
Constructors and destructors | |
Odata (const int aChunkDuration, const int aSegmentDuration, const int aOverlapDuration, const int aVerbosity=0) | |
Constructor of the Odata class. | |
virtual | ~Odata (void) |
Destructor of the Odata class. |
Read a segment list sequentially (for Omicron).
An input Segments object is segmented into several levels to perform an organized analysis of data segments. The input Segments object (set with SetSegments()) is divided into overlapping chunks. The chunks are loaded sequentially any time the NewChunk() function is called. The chunk sequence can be represented in the following way:
------------------------------------------------------------ input segment |------------------| chunk i-1 |------------------| chunk i |------------------| chunk i+1 |---| overlap
Chunks are subdivided in subsegments overlaping the same way as chunks:
|------------------------------------------| chunk i |----------| subsegment 0 |----------| subsegment 1 |----------| subsegment 2 |----------| subsegment 3 |----------| subsegment 4 |------------------------------------------| chunk i+1
In general, the input Segments object contain multiple time segments. The sequence described above does not necessarily match the size of the input segments. The Odata class is designed to deal with such edge effects. When calling NewChunk(), if the next chunk ends after the end of the current segment, some actions are taken to adjust the chunk size to the left-over (represented below):
------------------------------------| input segment under processing -------| chunk i-1 ###### call NextChunk() to cover the left-over |--------------------------| chunk i |----------| subsegment 0 |----------| subsegment 1 |----------| subsegment 2 ###### call NextChunk() to cover the left-over |----------| chunk i+1 |----------| subsegment 0
Obviously, the user must be careful about these special cases as the chunck and/or the overlap duration is modified (the subsegment duration is never changed). Some functions are available to monitor the different sizes.
When moving to a new segment, the chunk and overlap durations are set back to nominal values.
Odata::Odata | ( | const int | aChunkDuration, | |
const int | aSegmentDuration, | |||
const int | aOverlapDuration, | |||
const int | aVerbosity = 0 | |||
) |
Constructor of the Odata class.
Nominal durations are defined.
IMPORTANT: the nominal durations must verify some conditions. If these conditions are not met, the duration are automatically changed to match the Odata class requirements.
aChunkDuration | nominal chunk duration [s] | |
aSegmentDuration | nominal subsegment duration [s] | |
aOverlapDurationnominal | overlap duration [s] | |
averbose | verbosity level |
Odata::~Odata | ( | void | ) | [virtual] |
Destructor of the Odata class.
int Odata::GetChunkDuration | ( | void | ) | [inline] |
Returns the nominal chunk duration.
int Odata::GetChunkTimeEnd | ( | void | ) | [inline] |
Returns the GPS ending time of current chunk.
int Odata::GetChunkTimeStart | ( | void | ) | [inline] |
Returns the GPS starting time of current chunk.
int Odata::GetCurrentChunkDuration | ( | void | ) | [inline] |
Returns the current chunk duration.
In most cases the chunk duration is nominal unless the special case of the end of an input segment is hit.
int Odata::GetCurrentOverlapDuration | ( | void | ) | [inline] |
Returns the current overlap duration.
In most cases the overlap duration is nominal unless the special case of the end of an input segment is hit.
int Odata::GetNSegments | ( | void | ) | [inline] |
Returns number of subsegments in the current chunk.
The nominal value is returned if no chunk is loaded.
int Odata::GetOverlapDuration | ( | void | ) | [inline] |
Returns the nominal overlap duration.
In most cases the overlap duration is nominal unless the special case of the end of an input segment is hit.
int Odata::GetSegmentDuration | ( | void | ) | [inline] |
Returns the segment duration.
This value is never changed.
int Odata::GetSegmentTimeEnd | ( | const int | aNseg | ) |
Returns the GPS ending time of segment aNseg.
Returns -1 if this function fails.
aNseg | segment number |
int Odata::GetSegmentTimeStart | ( | const int | aNseg | ) |
Returns the GPS starting time of segment aNseg.
Returns -1 if this function fails.
aNseg | segment number |
bool Odata::NewChunk | ( | void | ) |
Loads a new (next) chunk.
The chunks are loaded following the structure defined for the Odata class and the Segments object defined with SetSegments(). When there is not enough data to fill one chunk (end of a segment), the chunk duration is shortened. This function should be called iteratively to cover the full data set. The returned value indicates the status of this operation:
bool Odata::SetSegments | ( | Segments * | aSegments | ) |