Commit a9cd6d11 authored by thomas.forbriger's avatar thomas.forbriger

libtsioxx [FIX][API][!!!]: reorganize header files

Code is reorganized in compilation units in smaller granularity.

The idea of providing inputoperators.h and outputoperators.h is to allow
to load the classes from modules in this library without loading all
input and output stream operators. Since sff::ts::File<C> provide member
functions for reading, this cannot be implemented strictly.
parent 1a262a97
......@@ -5,6 +5,21 @@
#
# Time series input/output functions
#
# ----
# libtsioxx is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ----
#
# REVISIONS and CHANGES
# 27/01/2014 Thomas Forbriger (thof)
# 23/12/2018 thof: add soname and references to other shared libraries
......
/*! \file sfftsfile.cc
* \brief data file container for SFF TimeSeries (implementation)
/*! \file fileheader.cc
* \brief implementation of ts::sff::FileHeader member functions (implementation)
*
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \since 18/07/2005
* \date 30/01/2014
* \date 02/04/2019
*
* data file container for SFF TimeSeries (implementation)
* implementation of ts::sff::FileHeader member functions (implementation)
*
* Copyright (c) 2005-2007, 2012, 2014 by Thomas Forbriger (BFO Schiltach)
* Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program is free software; you can redistribute it and/or modify
......@@ -30,13 +30,14 @@
* REVISIONS and CHANGES
* - 30/01/2014 V1.0 Thomas Forbriger (thof):
* copied from sffheaders.cc
* - 02/04/2019 V1.0 rename file
*
* ============================================================================
*/
#define TSIO_SFFTSFILE_CC_VERSION \
"TF_SFFTSFILE_CC 2014/01/30"
#define TSIO_FILEHEADER_CC_VERSION \
"TSIO_FILEHEADER_CC 2019/04/02"
#include <tsioxx/sfftsfile.h>
#include <tsioxx/fileheader.h>
namespace ts {
......@@ -63,4 +64,4 @@ namespace ts {
} // namespace sff
} // namespace ts
/* ----- END OF sfftsfile.cc ----- */
/* ----- END OF fileheader.cc ----- */
/*! \file fileheader.h
* \brief define ts::sff::FileHeader (prototypes)
*
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \date 02/04/2019
*
* define ts::sff::FileHeader (prototypes)
*
* Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
*
* ----
* libtsioxx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ----
*
* REVISIONS and CHANGES
* - 02/04/2019 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TSIO_FILEHEADER_H_VERSION
#define TSIO_FILEHEADER_H_VERSION \
"TSIO_FILEHEADER_H 2019/04/02"
#include<sffxx.h>
namespace ts {
namespace sff {
/*! \brief hold information for a complete SFF file header
* \ingroup group_sfftsfile
*/
class FileHeader {
public:
FileHeader(): Mhasfree(false), Mhassrce(false) { }
void srce(const ::sff::SRCE& s);
void free(const ::sff::FREE& f);
void append(const ::sff::FREE& f);
::sff::FREE free() const { return Mfree; }
::sff::SRCE srce() const { return Msrce; }
bool hasfree() const { return Mhasfree; }
bool hassrce() const { return Mhassrce; }
private:
::sff::FREE Mfree;
::sff::SRCE Msrce;
bool Mhasfree;
bool Mhassrce;
}; // struct FileHeader
} // namespace sff
} // namespace ts
#endif // TSIO_FILEHEADER_H_VERSION (includeguard)
/* ----- END OF fileheader.h ----- */
......@@ -41,9 +41,11 @@
#ifndef TSIO_INPUTOPERATORS_H_VERSION
#define TSIO_INPUTOPERATORS_H_VERSION \
"TF_INPUTOPERATORS_H 2016/11/22"
"TF_INPUTOPERATORS_H 2019/04/02"
#include<tsioxx/sfftsfile.h>
#include<tsioxx/traceheader.h>
#include<tsioxx/fileheader.h>
#include<tsioxx/sfftimeseries.h>
#include<datrwxx/datread.h>
namespace ts {
......
......@@ -32,6 +32,7 @@
* copied from sffheaders.h
* - 22/11/2016 V1.1 reorganize public interface to SFFTimeSeries
* required to provide reliable type conversion
* - 02/04/2019 V1.2 just define ts::sff::ts::sff::SFFTimeSeries<C>
*
* ============================================================================
*/
......@@ -40,24 +41,14 @@
#ifndef TSIO_SFFTIMESERIES_H_VERSION
#define TSIO_SFFTIMESERIES_H_VERSION \
"TF_SFFTIMESERIES_H 2016/11/22"
"TF_SFFTIMESERIES_H 2019/04/02"
#include<sffxx.h>
#include<tsxx/tsxx.h>
#include<tsxx/dttimeseries.h>
#include<tsioxx/traceheader.h>
/*! \brief Outer namespace
*
* All mosules are placed within this namespace, which is the namespace of
* modules from libtsxx.
*/
namespace ts {
/*! \brief Namespace for libtsioxx modules
*
* To distinguish the modules in libtsioxx and to avoid future conflicts,
* all modules in libtsioxx are placed in this namespace.
*/
namespace sff {
/*----------------------------------------------------------------------*/
......@@ -70,31 +61,6 @@ namespace ts {
* @{
*/
/*! \brief hold information for a complete SFF trace header
*/
class TraceHeader {
public:
TraceHeader(): Mhasfree(false), Mhasinfo(false) { }
void info(const ::sff::INFO& s);
void free(const ::sff::FREE& f);
void wid2(const ::sff::WID2& w) { Mwid2=w; }
void append(const ::sff::FREE& f);
::sff::FREE free() const { return Mfree; }
::sff::INFO info() const { return Minfo; }
::sff::WID2 wid2() const { return Mwid2; }
bool hasfree() const { return Mhasfree; }
bool hasinfo() const { return Mhasinfo; }
void read(std::istream& is, const bool& verbose=false);
private:
::sff::FREE Mfree;
::sff::INFO Minfo;
::sff::WID2 Mwid2;
bool Mhasfree;
bool Mhasinfo;
}; // class TraceHeader
/*----------------------------------------------------------------------*/
/*! \brief hold a full SFF trace and provide conversion
*
* This \b is a ts::TimeSeries<C,ts::sff::TraceHeader> class, due to
......
......@@ -30,6 +30,7 @@
* REVISIONS and CHANGES
* - 30/01/2014 V1.0 Thomas Forbriger (thof):
* copied from sffheaders.h
* - 02/04/2019 V1.1 just define ts::sff::File<C>
*
* ============================================================================
*/
......@@ -38,12 +39,12 @@
#ifndef TSIO_SFFTSFILE_H_VERSION
#define TSIO_SFFTSFILE_H_VERSION \
"TF_SFFTSFILE_H 2014/01/30"
"TF_SFFTSFILE_H 2019/04/02"
#include<tsioxx/sfftimeseries.h>
#include<datrwxx/datread.h>
#include<tsioxx/fileheader.h>
#include<tsioxx/tracevector.h>
#include<tfxx/rangelist.h>
#include<vector>
#include<datrwxx/datread.h>
namespace ts {
......@@ -57,39 +58,6 @@ namespace ts {
* @{
*/
/*! \brief hold information for a complete SFF file header
*/
class FileHeader {
public:
FileHeader(): Mhasfree(false), Mhassrce(false) { }
void srce(const ::sff::SRCE& s);
void free(const ::sff::FREE& f);
void append(const ::sff::FREE& f);
::sff::FREE free() const { return Mfree; }
::sff::SRCE srce() const { return Msrce; }
bool hasfree() const { return Mhasfree; }
bool hassrce() const { return Mhassrce; }
void read(std::istream& is, const bool& verbose=false);
private:
::sff::FREE Mfree;
::sff::SRCE Msrce;
bool Mhasfree;
bool Mhassrce;
}; // struct FileHeader
/*----------------------------------------------------------------------*/
/*! \brief hold SFF traces with full header information
*/
template<class C>
class TraceVector: public std::vector<SFFTimeSeries<C> > {
public:
typedef std::vector<SFFTimeSeries<C> > Tbase;
typedef SFFTimeSeries<C> Ttimeseries;
}; // class TraceVector
/*----------------------------------------------------------------------*/
/*! \brief hold all information contained in an SFF data file
*
* Store the complete information contained in a data file
......@@ -114,51 +82,6 @@ namespace ts {
*/
/*======================================================================*/
// member functions
/*! \brief Read a complete file with all traces.
*/
template<class C>
inline void File<C>::read(datrw::idatstream& is, const bool& verbose)
{
Trangelist rl;
this->read(is, rl, verbose);
} // TraceVector<C>::read
/*----------------------------------------------------------------------*/
/*! \brief Read a data file an extract selected traces.
*/
template<class C>
inline void File<C>::read(datrw::idatstream& is,
const Trangelist& rl,
const bool& verbose)
{
is >> this->fileheader;
int itrace=0;
while (is.good())
{
++itrace;
if ((rl.size()==0) || rl.contains(itrace))
{
if (verbose)
{ std::cout << " * read trace #" << itrace << std::endl; }
Ttimeseries timeseries;
is >> timeseries;
timeseries.settraceindex(itrace);
this->push_back(timeseries);
}
else
{
if (verbose)
{ std::cout << " skip trace #" << itrace << std::endl; }
is.skipseries();
}
}
} // TraceVector<C>::read
} // namespace sff
} // namespace ts
......
/*! \file sfftsfileread.h
* \brief define ts::sff::File<C>::read function (implementation)
*
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \date 02/04/2019
*
* define ts::sff::File<C>::read function (implementation)
*
* Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
*
* ----
* libtsioxx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ----
*
* REVISIONS and CHANGES
* - 02/04/2019 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TSIO_SFFTSFILEREAD_H_VERSION
#define TSIO_SFFTSFILEREAD_H_VERSION \
"TSIO_SFFTSFILEREAD_H 2019/04/02"
#include<tsioxx/sfftsfile.h>
#include<tsioxx/inputoperators.h>
namespace ts {
namespace sff {
/*======================================================================*/
// member functions
/*! \brief Read a complete file with all traces.
*/
template<class C>
inline void File<C>::read(datrw::idatstream& is, const bool& verbose)
{
Trangelist rl;
this->read(is, rl, verbose);
} // File<C>::read
/*----------------------------------------------------------------------*/
/*! \brief Read a data file an extract selected traces.
*/
template<class C>
inline void File<C>::read(datrw::idatstream& is,
const Trangelist& rl,
const bool& verbose)
{
is >> this->fileheader;
int itrace=0;
while (is.good())
{
++itrace;
if ((rl.size()==0) || rl.contains(itrace))
{
if (verbose)
{ std::cout << " * read trace #" << itrace << std::endl; }
Ttimeseries timeseries;
is >> timeseries;
timeseries.settraceindex(itrace);
this->push_back(timeseries);
}
else
{
if (verbose)
{ std::cout << " skip trace #" << itrace << std::endl; }
is.skipseries();
}
}
} // File<C>::read
} // namespace sff
} // namespace ts
#endif // TSIO_SFFTSFILEREAD_H_VERSION (includeguard)
/* ----- END OF sfftsfileread.h ----- */
/*! \file sfftimeseries.cc
* \brief libtsxx TimeSeries class template with SFF trace header
* (implementation).
/*! \file traceheader.cc
* \brief implementation of ts::sff::TraceHeader member functions (implementation)
*
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \since 18/07/2005
* \date 30/01/2014
* \date 02/04/2019
*
* libtsxx TimeSeries class template with SFF trace header (implementation)
* implementation of ts::sff::TraceHeader member functions (implementation)
*
* Copyright (c) 2005-2007, 2012, 2014 by Thomas Forbriger (BFO Schiltach)
* Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program is free software; you can redistribute it and/or modify
......@@ -31,13 +30,14 @@
* REVISIONS and CHANGES
* - 30/01/2014 V1.0 Thomas Forbriger (thof):
* copied from sffheaders.cc
* - 02/04/2019 V1.1 rename file
*
* ============================================================================
*/
#define TSIO_SFFTIMESERIES_CC_VERSION \
"TF_SFFTIMESERIES_CC 2014/01/30"
#define TSIO_TRACEHEADER_CC_VERSION \
"TSIO_TRACEHEADER_CC 2019/04/02"
#include <tsioxx/sfftimeseries.h>
#include <tsioxx/traceheader.h>
namespace ts {
......@@ -64,4 +64,4 @@ namespace ts {
} // namespace sff
} // namespace ts
/* ----- END OF sfftimeseries.cc ----- */
/* ----- END OF traceheader.cc ----- */
/*! \file traceheader.h
* \brief define ts::sff::TraceHeader (prototypes)
*
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \date 02/04/2019
*
* define ts::sff::TraceHeader (prototypes)
*
* Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
*
* ----
* libtsioxx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ----
*
* REVISIONS and CHANGES
* - 02/04/2019 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TSIO_TRACEHEADER_H_VERSION
#define TSIO_TRACEHEADER_H_VERSION \
"TSIO_TRACEHEADER_H 2019/04/02"
#include<sffxx.h>
namespace ts {
namespace sff {
/*! \brief hold information for a complete SFF trace header
* \ingroup group_sfftimeseries
*/
class TraceHeader {
public:
TraceHeader(): Mhasfree(false), Mhasinfo(false) { }
void info(const ::sff::INFO& s);
void free(const ::sff::FREE& f);
void wid2(const ::sff::WID2& w) { Mwid2=w; }
void append(const ::sff::FREE& f);
::sff::FREE free() const { return Mfree; }
::sff::INFO info() const { return Minfo; }
::sff::WID2 wid2() const { return Mwid2; }
bool hasfree() const { return Mhasfree; }
bool hasinfo() const { return Mhasinfo; }
void read(std::istream& is, const bool& verbose=false);
private:
::sff::FREE Mfree;
::sff::INFO Minfo;
::sff::WID2 Mwid2;
bool Mhasfree;
bool Mhasinfo;
}; // class TraceHeader
} // namespace sff
} // namespace ts
#endif // TSIO_TRACEHEADER_H_VERSION (includeguard)
/* ----- END OF traceheader.h ----- */
/*! \file tracevector.h
* \brief define ts::sff::TraceVector<C> (prototypes)
*
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \date 02/04/2019
*
* define ts::sff::TraceVector<C> (prototypes)
*
* Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
*
* ----
* libtsioxx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ----
*
* REVISIONS and CHANGES
* - 02/04/2019 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TSIO_TRACEVECTOR_H_VERSION
#define TSIO_TRACEVECTOR_H_VERSION \
"TSIO_TRACEVECTOR_H 2019/04/02"
#include<vector>
#include<tsioxx/sfftimeseries.h>
namespace ts {
namespace sff {
/*! \brief hold SFF traces with full header information
* \ingroup group_sfftsfile
*/
template<class C>
class TraceVector: public std::vector<SFFTimeSeries<C> > {
public:
typedef std::vector<SFFTimeSeries<C> > Tbase;
typedef SFFTimeSeries<C> Ttimeseries;
}; // class TraceVector
} // namespace sff
} // namespace ts
#endif // TSIO_TRACEVECTOR_H_VERSION (includeguard)
/* ----- END OF tracevector.h ----- */
/*! \file tsioxx.h
* \brief load all modules (prototypes)
*
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \date 02/04/2019
*
* load all modules (prototypes)
*
* Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
*
* ----
* libtsioxx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ----
*
* REVISIONS and CHANGES
* - 02/04/2019 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TSIO_TSIOXX_H_VERSION
#define TSIO_TSIOXX_H_VERSION \
"TSIO_TSIOXX_H 2019/04/02"
#include<tsioxx/sfftsfileread.h>
#include<tsioxx/operators.h>
#include<tsioxx/cmdlinefiles.h>
/*! \brief Outer namespace
*
* All modules are placed within this namespace, which is the namespace of
* modules from libtsxx.
*/
namespace ts {
/*! \brief Namespace for libtsioxx modules
*
* To distinguish the modules in libtsioxx and to avoid future conflicts,
* all modules in libtsioxx are placed in this namespace.
*/
namespace sff {
} // namespace sff
} // namespace ts
#endif // TSIO_TSIOXX_H_VERSION (includeguard)
/* ----- END OF tsioxx.h ----- */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment