TSIO++ Time series input/output
TSIO++ Time series input/output Documentation
Author
Thomas Forbriger
Since
January 2014
Date
April 2019

Aims

Purpose

This library is based on libtsxx which provides tools and utilities for time series analysis and processing which refer to a given sampling interval of the time series. libtsxx for this reason provides a ts::TimeSeries class template, for objects storing sample values along with the sampling interval. The current library (libtsioxx) inherits from this template to provide a ts::sff::SFFTimeSeries class template for objects storing sample values along with full qualified SFF headers (stored in ts::sff::TraceHeader objects) and which are valid ts::TimeSeries objects at the same time.

Based on ts::sff::SFFTimeSeries libtsioxx provides ts::sff::TraceVector which publically inherits from the STL vector and provides an object to store several ts::sff::SFFTimeSeries objects. This, together with ts::sff::FileHeader, is used to compile the class template ts::sff::File, which is able to store complete data files.

Further libtsioxx provides input/output operators for the above mentioned classes to be read from or written two libdatrwxx streams. Reading functions wich provide a rangelist selection for input traces are provided too.

At the highest level of complexity, classes ts::sff::SFile and ts::sff::DFile are provided together with file reading functions. These classes are meant to store a complete set of data files as defined on the command line of application programs together with file specific parameters. A set of such files can be stored in ts::sff::TSFileList and ts::sff::TDFileList objects, which basically are typedefs referring to the STL list container. File input for these objects is supported for reading from libdatrwxx input streams.

Interfaces

tsioxx.h:
Main interface to the library, loads all modules.
traceheader.h:
Definition of ts::sff::TraceHeader
sfftimeseries.h:
Definition of ts::sff::SFFTimeSeries class template This essentially is a ts::TimeSeries with ts::sff::TraceHeader
fileheader.h:
Definition of ts::sff::FileHeader
tracevector.h:
Definition of ts::sff::TraceVector class template
sfftsfile.h:
Definition of ts::sff::File class template to store contents of a complete time series data file
sfftsfileread.h:
Definition of read member function for ts::sff::File
inputoperators.h:
libdatrwxx input operators for ts::sff::TraceHeader, ts::sff::FileHeader, and ts::sff::File
outputoperators.h:
libdatrwxx output operators for objects of libtsioxx
operators.h:
Load input and output operators
cmdlinefiles.h:
definition of classes ts::sff::SFile and ts::sff::DFile to store time series data in single and double precision, respectively. Definition of typedef for ts::sff::TSFileList and ts::sff::TDFileList which are STL lists of ts::sff::SFile and ts::sff::DFile, respectively. Declaration of ts::sff::readSSFF (returns single precision ts::sff::SFile) or ts::sff::readDSFF (returns double precision ts::sff::DFile) reading functions. They read an entire set of files and return data in appropriate objects. Data selection is supported by command line parameters being assembled in modules from namespace tfxx::cmdline as provided in tfxx/xcmdline.h

Usage example

Reading files

When reading a complete set of files, we recommend to nevertheless implement the loop over all files in the main program. This allows for more flexibility handling different files differently (with respect to file format for example) and comes at almost no overhead.

#include <tfxx/commandline.h>
struct Options {
bool verbose;
std::string inputformat;
}; // struct Options
int main(int iargc, char* argv[])
{
// define commandline options
using namespace tfxx::cmdline;
static Declare options[]=
{
// 0: print help
{"help",arg_no,"-"},
// 1: verbose mode
{"verbose",arg_no,"-"},
// 2: default input file format
{"itype",arg_yes,"sff"},
{NULL}
};
// define command line keys for input files
static const char tracekey[]="t";
static const char formatkey[]="f";
// define commandline argument modifier keys
static const char* cmdlinekeys[]={tracekey, formatkey, 0};
// collect options from commandline
Commandline cmdline(iargc, argv, options);
Options opt;
opt.verbose=cmdline.optset(1);
opt.inputformat=cmdline.string_arg(2);
// extract commandline arguments
TFXX_assert(cmdline.extra(), "missing input file");
tfxx::cmdline::Tparsed arguments=parse_cmdline(cmdline, cmdlinekeys);
ts::sff::TDFileList input_file_list;
tfxx::cmdline::Tparsed::const_iterator file=arguments.begin();
while (file != arguments.end())
{
std::string format=opt.inputformat;
if (file->haskey(formatkey))
{
format=file->value(formatkey);
}
input_file_list.push_back(ts::sff::readDSFF(*file, opt.verbose,
tracekey, format));
++file;
}
} // main()

History

code reorganization

Date
02/04/2019

Compilation units are reorganized, providing smaller granularity. The previous version as logically inconsistent and incorrect.

before 30/01/2014

Date
30/01/2014

These modules previously were implemented in libtsxx and libtfxx. They produced a mutual dependency between both libraries which was undesirable. The modules are now separated into this library which in turn now depends on both, libtsxx and libtfxx. Namely

  • libtsxx/sffheaders.h,
  • libtsxx/sffheaders.cc,
  • libtfxx/readtsdata.h, and
  • libtfxx/readtsdata.cc

have moved.

Some modules presented in sffheaders.h date back to a pre-libdatrwxx era. They should be replaced by more up-to-date functionality. These modules (group_SFFoutputoperators) are moved to SFFoutputoperators.h.