Commit 8047844b authored by thomas.forbriger's avatar thomas.forbriger
Browse files

[WP][TASK] (ticket10tsio): reorganize source code files

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.

Several tasks are accomplished:
  - Add proper file headers with preample and copyright.
  - Give proper reference to ancestors.
  - Define namespaces.
  - Set proper include guards.
parent c728c751
......@@ -5,10 +5,10 @@ libsioxx C++ time series file input/ouput
$Id: COPYING 4960 2013-02-01 09:02:16Z tforb $
============================================================================
The source code in this directory is part of libtfxx which
compiles libtfxx.a
The source code in this directory is part of libtsioxx which
compiles libtsioxx.a
Copyright (C) 2005, 2007, 2013, 2014 by Thomas Forbriger
Copyright (C) 2005-2007, 2011-2014 by Thomas Forbriger
----
libtsioxx is free software; you can redistribute it and/or modify
......
......@@ -72,7 +72,6 @@ clean: ;
-find . -name \*.o | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.d | xargs --no-run-if-empty /bin/rm -v
-/bin/rm -vf flist *.o install-include *.strip libtfxx.a *.a *.so *.xxx
cd tests; $(MAKE) clean
#======================================================================
# dependencies
......
/*! \file SFFoutputoperators.h
* \brief deprecated output operators to libsffxx output stream (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id: $
* \author Thomas Forbriger
* \since 18/07/2005
* \date 30/01/2014
*
* deprecated output operators to libsffxx output stream (prototypes)
*
* Copyright (c) 2005-2007, 2012, 2014 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
* REVISIONS and CHANGES
* - 30/01/2014 V1.0 Thomas Forbriger (thof):
* copied from sffheaders.h
*
* ============================================================================
*/
// include guard
#ifndef TSIO_SFFOUTPUTOPERATORS_H_VERSION
#define TSIO_SFFOUTPUTOPERATORS_H_VERSION \
"TF_SFFOUTPUTOPERATORS_H 2014/01/30"
#define TSIO_SFFOUTPUTOPERATORS_H_CVSID \
"$Id: $"
#include<sffxx.h>
#include<tsxx/tsxx.h>
#include<datrwxx/datread.h>
#include<datrwxx/datwrite.h>
#include<tfxx/rangelist.h>
#include<sffostream.h>
#include<vector>
/*! \brief Interface to libsffxx
*
* \defgroup subgroup_sffheaders_sffxx Interface to libsffxx
* \ingroup group_sffheaders
*
* Output operators for classes in module \ref subgroup_sffheaders_classes
* to SFFostream from libsff
*
* \deprecated
* Direct output to libsffxx through SFFostream is deprecated.
* Use output through libdatrwxx streams instead.
* Appropriate operators are presented in module
* \ref subgroup_sffheaders_datrwxx
* @{
*/
namespace ts {
namespace sff {
/*======================================================================*/
// sff::SFFostream output operators
template<class C>
::sff::SFFostream<C>& operator<<(::sff::SFFostream<C>& os,
const FileHeader& fh)
{
if (fh.hasfree()) { os << fh.free(); }
if (fh.hassrce()) { os << fh.srce(); }
return os;
}
/*----------------------------------------------------------------------*/
template<class C>
::sff::SFFostream<C>& operator<<(::sff::SFFostream<C>& os,
const TraceHeader& th)
{
os << th.wid2();
if (th.hasfree()) { os << th.free(); }
if (th.hasinfo()) { os << th.info(); }
return os;
}
/*----------------------------------------------------------------------*/
/*! \note
* The compiler cannot distinguish between this definition and the
* next one.
*/
template<class C>
::sff::SFFostream<C>& operator<<(::sff::SFFostream<C>& os,
const typename SFFTimeSeries<C>::Tconsttimeseries& s)
{
typedef typename SFFTimeSeries<C>::Tconsttimeseries::Tseries Tseries;
return(os << Tseries(s) << s.header);
}
/*----------------------------------------------------------------------*/
template<class C>
::sff::SFFostream<C>& operator<<(::sff::SFFostream<C>& os,
const SFFTimeSeries<C>& s)
{
typedef typename SFFTimeSeries<C>::Tcoc Tcoc;
return(os << Tcoc(s) << s.header);
}
/*----------------------------------------------------------------------*/
template<class C>
::sff::SFFostream<C>& operator<<(::sff::SFFostream<C>& os,
const TraceVector<C>& tv)
{
typedef TraceVector<C> Ttracevector;
for(typename Ttracevector::const_iterator i=tv.begin();
i != tv.end(); ++i)
{ os << *i; }
return os;
}
/*----------------------------------------------------------------------*/
template<class C>
::sff::SFFostream<C>& operator<<(::sff::SFFostream<C>& os,
const File<C>& f)
{ return(os << f.fileheader << TraceVector<C>(f)); }
/*!
* @}
*/
} // namespace sff
} // namespace ts
#endif // TSIO_SFFOUTPUTOPERATORS_H_VERSION (includeguard)
/* ----- END OF SFFoutputoperators.h ----- */
/*! \file readtsdata.cc
* \brief read waveform data through the interface provided by libdatrwxx
* (implementation)
/*! \file cmdlinefiles.cc
* \brief containers for data files with file specific command line parameters (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id$
* $Id: $
* \author Thomas Forbriger
* \date 31/01/2007
* \since 31/01/2007
* \date 30/01/2014
*
* read waveform data through the interface provided by libdatrwxx
* containers for data files with file specific command line parameters
* (implementation)
*
* Copyright (c) 2007, 2010, 2011, 2014 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program is free software; you can redistribute it and/or modify
......@@ -26,27 +28,23 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
* Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach)
*
*
* REVISIONS and CHANGES
* - 31/01/2007 V1.0 Thomas Forbriger
* - 31/10/2007 V1.1 added single precision versions
* PGPLOT requires single precision data
* - 25/11/2010 V1.2 use correct open mode upon opening an ifstream
* - 09/09/2011 V1.3 support file format modifiers
* - 30/01/2014 V1.0 Thomas Forbriger (thof):
* copied from readtsdata.cc
*
* ============================================================================
*/
#define TSIOXX_READTSDATA_CC_VERSION \
"TSIOXX_READTSDATA_CC V1.3"
#define TSIOXX_READTSDATA_CC_CVSID \
"$Id$"
#define TSIO_CMDLINEFILES_CC_VERSION \
"TF_CMDLINEFILES_CC 2014/01/30"
#define TSIO_CMDLINEFILES_CC_CVSID \
"$Id: $"
#include <cmdlinefiles.h>
#include <tsioxx/readtsdata.h>
namespace ts {
namespace tsio {
namespace file {
namespace sff {
//! read complete SFF file
SFile readSSFF(const std::string& filename,
......@@ -250,7 +248,7 @@ namespace tsio {
return (readDSFF(flist, verbose, tracekey, datrw::anyID(format)));
}
} // namespace file
} // namespace tsio
} // namespace sff
} // namespace ts
/* ----- END OF readtsdata.cc ----- */
/* ----- END OF cmdlinefiles.cc ----- */
/*! \file readtsdata.h
* \brief read waveform data through the interface provided by libdatrwxx
* (prototypes)
/*! \file cmdlinefiles.h
* \brief containers for data files with file specific command line parameters
* (prototypes).
*
* ----------------------------------------------------------------------------
*
* $Id$
* $Id: $
* \author Thomas Forbriger
* \date 31/01/2007
* \since 31/01/2007
* \date 30/01/2014
*
* Copyright (c) 2007, 2010, 2011, 2014 by Thomas Forbriger (BFO Schiltach)
*
* read waveform data through the interface provided by libdatrwxx
* containers for data files with file specific command line parameters
* (prototypes)
*
* ----
......@@ -26,25 +29,21 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
* Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach)
*
*
* REVISIONS and CHANGES
* - 31/01/2007 V1.0 Thomas Forbriger
* - 31/10/2007 V1.1 added single precision versions
* PGPLOT requires single precision data
* - 09/09/2011 V1.2 support file format modifiers
* - 30/01/2014 V1.0 Thomas Forbriger (thof):
* copied from readtsdata.h
*
* ============================================================================
*/
// include guard
#ifndef TSIOXX_READTSDATA_H_VERSION
#ifndef TSIO_CMDLINEFILES_H_VERSION
#define TSIOXX_READTSDATA_H_VERSION \
"TSIOXX_READTSDATA_H V1.2"
#define TSIOXX_READTSDATA_H_CVSID \
"$Id$"
#define TSIO_CMDLINEFILES_H_VERSION \
"TF_CMDLINEFILES_H 2014/01/30"
#define TSIO_CMDLINEFILES_H_CVSID \
"$Id: $"
#include<tfxx/rangelist.h>
#include<tfxx/xcmdline.h>
......@@ -68,12 +67,9 @@
*
*/
namespace tsio {
/*! \namespace tfxx::tsio
* \brief Namespace containing all components of module readtsdata.
* \ingroup group_readtsdata, readtsdata_h
*/
namespace file {
namespace ts {
namespace sff {
/*! \brief type of trace selection list.
*
......@@ -513,9 +509,9 @@ namespace tsio {
Ttracelistkey tracekey="t",
const datrw::Eformat& format=datrw::Fsff);
} // namespace file
} // namespace tsio
} // namespace sff
} // namespace ts
#endif // TSIOXX_READTSDATA_H_VERSION (includeguard)
#endif // TSIO_CMDLINEFILES_H_VERSION (includeguard)
/* ----- END OF readtsdata.h ----- */
/* ----- END OF cmdlinefiles.h ----- */
/*! \file inputoperators.cc
* \brief input operators for SFF TimeSeries traces and files for libdatrwxx
* streams (implementation).
*
* ----------------------------------------------------------------------------
*
* $Id: $
* \author Thomas Forbriger
* \since 18/07/2005
* \date 30/01/2014
*
* input operators for SFF TimeSeries traces and files for libdatrwxx streams
* (implementation)
*
* Copyright (c) 2005-2007, 2012, 2014 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
* REVISIONS and CHANGES
* - 30/01/2014 V1.0 Thomas Forbriger (thof):
* copied from sffheaders.cc
*
* ============================================================================
*/
#define TSIO_INPUTOPERATORS_CC_VERSION \
"TF_INPUTOPERATORS_CC 2014/01/30"
#define TSIO_INPUTOPERATORS_CC_CVSID \
"$Id: $"
#include <inputoperators.h>
namespace ts {
namespace sff {
datrw::idatstream& operator>>(datrw::idatstream& is,
FileHeader& fh)
{
::sff::FREE free;
::sff::SRCE srce;
fh=FileHeader();
if (is.hasfree()) { is >> free; fh.free(free); }
if (is.hassrce()) { is >> srce; fh.srce(srce); }
return(is);
}
datrw::idatstream& operator>>(datrw::idatstream& is,
TraceHeader& th)
{
::sff::FREE free;
::sff::INFO info;
::sff::WID2 wid2;
th=TraceHeader();
is >> wid2; th.wid2(wid2);
if (is.hasfree()) { is >> free; th.free(free); }
if (is.hasinfo()) { is >> info; th.info(info); }
return(is);
}
} // namespace sff
} // namespace ts
/* ----- END OF inputoperators.cc ----- */
/*! \file inputoperators.h
* \brief input operators for SFF TimeSeries traces and files for libdatrwxx
* streams (prototypes).
*
* ----------------------------------------------------------------------------
*
* $Id: $
* \author Thomas Forbriger
* \since 18/07/2005
* \date 30/01/2014
*
* input operators for SFF TimeSeries traces and files for libdatrwxx streams
* (prototypes)
*
* Copyright (c) 2005-2007, 2012, 2014 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
* REVISIONS and CHANGES
* - 30/01/2014 V1.0 Thomas Forbriger (thof):
* copied from sffheaders.h
*
* ============================================================================
*/
// include guard
#ifndef TSIO_INPUTOPERATORS_H_VERSION
#define TSIO_INPUTOPERATORS_H_VERSION \
"TF_INPUTOPERATORS_H 2014/01/30"
#define TSIO_INPUTOPERATORS_H_CVSID \
"$Id: $"
#include<sffxx.h>
#include<tsxx/tsxx.h>
#include<datrwxx/datread.h>
#include<datrwxx/datwrite.h>
#include<tfxx/rangelist.h>
#include<sffostream.h>
#include<vector>
/*! \brief Interface to libdatrwxx
*
* \defgroup subgroup_sffheaders_datrwxx Interface to libdatrwxx
* \ingroup group_sffheaders
*
* Input/output operators for structures in \ref group_sffheaders_classes
* to libdatrwxx input/output streams.
* @{
*/
namespace ts {
namespace sff {
/*======================================================================*/
// libdatrwxx input operators
datrw::idatstream& operator>>(datrw::idatstream& is, FileHeader& fh);
datrw::idatstream& operator>>(datrw::idatstream& is, TraceHeader& th);
/*----------------------------------------------------------------------*/
template<class C>
datrw::idatstream& operator>>(datrw::idatstream& is,
SFFTimeSeries<C>& s)
{ return(is >> s.series() >> s.header); }
/*======================================================================*/
// libdatrwxx output operators
inline
datrw::odatstream& operator<<(datrw::odatstream& os,
const FileHeader& fh)
{
if (fh.hasfree()) { os << fh.free(); }
if (fh.hassrce()) { os << fh.srce(); }
return os;
}
/*----------------------------------------------------------------------*/
inline
datrw::odatstream& operator<<(datrw::odatstream& os,
const TraceHeader& th)
{
os << th.wid2();
if (th.hasfree()) { os << th.free(); }
if (th.hasinfo()) { os << th.info(); }
return os;
}
/*----------------------------------------------------------------------*/
/*! \note
* The compiler cannot distinguish between this definition and the
* next one.
*/
template<class C>
datrw::odatstream& operator<<(datrw::odatstream& os,
const typename SFFTimeSeries<C>::Tconsttimeseries& s)
{
typedef typename SFFTimeSeries<C>::Tconsttimeseries::Tseries Tseries;
return(os << s.header << Tseries(s));
}
/*----------------------------------------------------------------------*/
template<class C>
datrw::odatstream& operator<<(datrw::odatstream& os,
const SFFTimeSeries<C>& s)
{
typedef typename SFFTimeSeries<C>::Tcoc Tcoc;
return(os << s.header << Tcoc(s));
}
/*----------------------------------------------------------------------*/
template<class C>
datrw::odatstream& operator<<(datrw::odatstream& os,
const TraceVector<C>& tv)
{
typedef TraceVector<C> Ttracevector;
for(typename Ttracevector::const_iterator i=tv.begin();
i != tv.end(); ++i)
{ os << *i; }
return os;
}
/*----------------------------------------------------------------------*/
template<class C>
datrw::odatstream& operator<<(datrw::odatstream& os,
const File<C>& f)
{ return(os << f.fileheader << TraceVector<C>(f)); }
/*!
* @}
*/
} // namespace sff
} // namespace ts
#endif // TSIO_INPUTOPERATORS_H_VERSION (includeguard)
/* ----- END OF inputoperators.h ----- */
/*! \file outputoperators.cc
* \brief output operators for SFF TimeSeries traces and files to libdatrwxx
* streams (implementation).
*
* ----------------------------------------------------------------------------
*
* $Id: $
* \author Thomas Forbriger
* \since 18/07/2005
* \date 30/01/2014
*
* output operators for SFF TimeSeries traces and files to libdatrwxx streams
* (implementation)
*
* Copyright (c) 2005-2007, 2012, 2014 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
* REVISIONS and CHANGES
* - 30/01/2014 V1.0 Thomas Forbriger (thof):
* copied from sffheaders.cc
*
* ============================================================================
*/
#define TSIO_OUTPUTOPERATORS_CC_VERSION \
"TF_OUTPUTOPERATORS_CC 2014/01/30"
#define TSIO_OUTPUTOPERATORS_CC_CVSID \
"$Id: $"
#include <outputoperators.h>
namespace ts {
namespace sff {