Commit db36bdf8 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding

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.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2982
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 2c18207e
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: README,v 1.4 2010-02-17 22:13:29 tforb Exp $
* $Id: README,v 1.5 2010-02-20 11:05:43 tforb Exp $
* \author Thomas Forbriger
* \date 11/04/2006
*
......@@ -38,7 +38,7 @@ namespace datwrite {
\since April 2006
\date February 2010 2006
\version V1.0
$Id: README,v 1.4 2010-02-17 22:13:29 tforb Exp $
$Id: README,v 1.5 2010-02-20 11:05:43 tforb Exp $
Contents of this page:
- \ref sec_concept
......@@ -55,17 +55,6 @@ $Id: README,v 1.4 2010-02-17 22:13:29 tforb Exp $
An example will be provided as soon as the code is written ;-)
The user interface works like the sff:SFFostream.
This means the series output operator has to be called first for each trace.
This will flush all entries passed for the previous series or for the file.
The series itself is copied by a shallow copy operation, i.e. only a handle
to the series is stored.
Until the series is flushed by writing the next trace, the data still can be
modified through other handles.
\note
There is not decision yet regarding this concept.
See datwrite.h for more...
*/
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: ascii.h,v 1.2 2010-02-17 22:00:26 tforb Exp $
* $Id: ascii.h,v 1.3 2010-02-20 11:05:43 tforb Exp $
* \author Thomas Forbriger
* \date 11/04/2006
*
......@@ -35,17 +35,17 @@
*/
// include guard
#ifndef TF_ASCII_H_VERSION
#ifndef DATWRITE_ASCII_H_VERSION
#define TF_ASCII_H_VERSION \
#define DATWRITE_ASCII_H_VERSION \
"TF_ASCII_H V1.0 "
#define TF_ASCII_H_CVSID \
"$Id: ascii.h,v 1.2 2010-02-17 22:00:26 tforb Exp $"
#define DATWRITE_ASCII_H_CVSID \
"$Id: ascii.h,v 1.3 2010-02-20 11:05:43 tforb Exp $"
namespace tf {
namespace datwrite {
}
} // namespace datwrite
#endif // TF_ASCII_H_VERSION (includeguard)
#endif // DATWRITE_ASCII_H_VERSION (includeguard)
/* ----- END OF ascii.h ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: ascii.cc,v 1.2 2010-02-17 22:00:27 tforb Exp $
* $Id: ascii.cc,v 1.3 2010-02-20 11:05:43 tforb Exp $
* \author Thomas Forbriger
* \date 11/04/2006
*
......@@ -33,15 +33,15 @@
*
* ============================================================================
*/
#define TF_ASCII_CC_VERSION \
#define DATWRITE_ASCII_CC_VERSION \
"TF_ASCII_CC V1.0 "
#define TF_ASCII_CC_CVSID \
"$Id: ascii.cc,v 1.2 2010-02-17 22:00:27 tforb Exp $"
#define DATWRITE_ASCII_CC_CVSID \
"$Id: ascii.cc,v 1.3 2010-02-20 11:05:43 tforb Exp $"
#include <ascii.h>
namespace tf {
namespace datwrite {
}
} // namespace datwrite
/* ----- END OF ascii.cc ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: datwrite.cc,v 1.5 2010-02-18 12:16:48 tforb Exp $
* $Id: datwrite.cc,v 1.6 2010-02-20 11:05:43 tforb Exp $
* \author Thomas Forbriger
* \date 11/04/2006
*
......@@ -36,7 +36,7 @@
#define DATWRITE_DATWRITE_CC_VERSION \
"TF_DATWRITE_CC V1.0 "
#define DATWRITE_DATWRITE_CC_CVSID \
"$Id: datwrite.cc,v 1.5 2010-02-18 12:16:48 tforb Exp $"
"$Id: datwrite.cc,v 1.6 2010-02-20 11:05:43 tforb Exp $"
#include <datwritexx/datwrite.h>
......@@ -91,6 +91,44 @@ namespace datwrite {
writefileheader();
}
Mheaderflushed=true;
Msrceset=false;
Mfreeset=false;
}
/*----------------------------------------------------------------------*/
void odatstream::cleartraceheader()
{
Mwid2set=false;
Mfreeset=false;
Minfoset=false;
}
/*----------------------------------------------------------------------*/
void odatstream::writeseries(const Tdseries& series)
{
DATWRITE_assert(this-Mwid2set,"missing WID2 header");
this->writetrace(series);
this->cleartraceheader();
}
/*----------------------------------------------------------------------*/
void odatstream::writeseries(const Tfseries& series)
{
DATWRITE_assert(this-Mwid2set,"missing WID2 header");
this->writetrace(series);
this->cleartraceheader();
}
/*----------------------------------------------------------------------*/
void odatstream::writeseries(const Tiseries& series)
{
DATWRITE_assert(this-Mwid2set,"missing WID2 header");
this->writetrace(series);
this->cleartraceheader();
}
/*----------------------------------------------------------------------*/
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: datwrite.h,v 1.6 2010-02-18 12:16:48 tforb Exp $
* $Id: datwrite.h,v 1.7 2010-02-20 11:05:43 tforb Exp $
* \author Thomas Forbriger
* \date 11/04/2006
*
......@@ -40,7 +40,7 @@
#define DATWRITE_DATWRITE_H_VERSION \
"TF_DATWRITE_H V1.0 "
#define DATWRITE_DATWRITE_H_CVSID \
"$Id: datwrite.h,v 1.6 2010-02-18 12:16:48 tforb Exp $"
"$Id: datwrite.h,v 1.7 2010-02-20 11:05:43 tforb Exp $"
namespace datwrite {
......@@ -54,16 +54,25 @@ namespace datwrite {
* structures.
*
* \note
* It would be reasonable to use the functions dseries(), fseries(), and
* iseries() to flush a trace to file.
* Then we have, however, to define a separate mechanism to flush the file
* header.
* Let's think about that.
*
* \note
* Design considerations:
* For most data types it would be convenient to flush data traces to file
* upon a call to odtstream::writeseries().
* upon a call to odatstream::writeseries().
* For this reason trace data fill be collected by setwid2, setfree, and
* setinfo and will be flushed to file upon a call to writeseries.
* Prior to writing the first trace functions odatstream::setsrce() and
* odatstream::setfree() can be used to write file specific data.
* This file header will be flushed to file upon calling
* odatstream::flushfileheader() or upon the first call to
* odatstream::setwid2().
* No file header fields can be written after the first call to
* odatstream::setwid2().
* odatstream::setwid2() must be called for each trace.
* The other fields are optional.
*
* \note
* Due to the design descision just made, a copy of the series will be kept
* until the next trace will be written, since trace data is flushed in
* libsffxx upon writing the wid2 data for the next trace.
*/
class odatstream {
public:
......@@ -72,17 +81,32 @@ namespace datwrite {
void setwid2(const sff::WID2& wid2);
void setsrce(const sff::SRCE& srce);
void setinfo(const sff::INFO& info);
virtual void writeseries(const Tdseries& series) { DATWRITE_illegal; }
virtual void writeseries(const Tdseries& series) { DATWRITE_illegal; }
virtual void writeseries(const Tdseries& series) { DATWRITE_illegal; }
//! write double data
void writeseries(const Tdseries& series)
//! write single precision float data
void writeseries(const Tfseries& series)
//! write integer data
void writeseries(const Tiseries& series)
//! flush file header to file
void flushfileheader();
//! print some info about data conversion.
static void help(std::ostream& os=std::cout,
char* name="idatsream");
protected:
//! write double data
virtual void writetrace(const Tdseries& series) { DATWRITE_illegal; }
//! write single precision float data
virtual void writetrace(const Tfseries& series) { DATWRITE_illegal; }
//! write integer data
virtual void writetrace(const Tiseries& series) { DATWRITE_illegal; }
//! constructor is protected: do not create an instance of this class
odatstream(std::ostream& os);
//! output stream to be used by this class
std::ostream& Mos;
//! actually write the file header
virtual void writefileheader();
//! clear trace header flags
void cleartraceheader();
private:
sff::WID2 Mwid2;
sff::SRCE Msrce;
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sff.h,v 1.2 2010-02-17 22:00:26 tforb Exp $
* $Id: sff.h,v 1.3 2010-02-20 11:05:43 tforb Exp $
* \author Thomas Forbriger
* \date 11/04/2006
*
......@@ -35,17 +35,62 @@
*/
// include guard
#ifndef TF_SFF_H_VERSION
#ifndef DATWRITE_SFF_H_VERSION
#define TF_SFF_H_VERSION \
#define DATWRITE_SFF_H_VERSION \
"TF_SFF_H V1.0 "
#define TF_SFF_H_CVSID \
"$Id: sff.h,v 1.2 2010-02-17 22:00:26 tforb Exp $"
#define DATWRITE_SFF_H_CVSID \
"$Id: sff.h,v 1.3 2010-02-20 11:05:43 tforb Exp $"
namespace tf {
namespace datwrite {
}
/*! \brief SFF reading interface
*
* \defgroup sff Write SFF and GSE data
*/
#endif // TF_SFF_H_VERSION (includeguard)
/*! \brief class to write SFF data
*
* \ingroup sff
*/
class osffstream: public odatstream {
public:
typedef odatstream Tbase;
osffstream(std::ostream& os, const bool& debug=false);
virtual ~osffstream() { }
static void help(std::ostream& os=std::cout)
{ Tbase::help(os, "osffstream"); }
protected:
virtual void writefileheader();
virtual void writetrace(const Tdseries& series);
virtual void writetrace(const Tfseries& series);
virtual void writetrace(const Tiseries& series);
private:
bool Mdebug;
}; // class osffstream
/*----------------------------------------------------------------------*/
/*! \brief class to write GSE data
*
* \ingroup sff
*/
class ogsestream: public odatstream {
public:
typedef odatstream Tbase;
ogsestream(std::ostream& os, const bool& debug=false);
virtual ~ogsestream() { }
static void help(std::ostream& os=std::cout)
{ Tbase::help(os, "ogsestream"); }
protected:
virtual void writefileheader();
virtual void writetrace(const Tiseries& series);
private:
bool Mdebug;
}; // class ogsestream
} // namespace datwrite
#endif // DATWRITE_SFF_H_VERSION (includeguard)
/* ----- END OF sff.h ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sff.cc,v 1.2 2010-02-17 22:00:27 tforb Exp $
* $Id: sff.cc,v 1.3 2010-02-20 11:05:43 tforb Exp $
* \author Thomas Forbriger
* \date 11/04/2006
*
......@@ -33,15 +33,51 @@
*
* ============================================================================
*/
#define TF_SFF_CC_VERSION \
#define DATWRITE_SFF_CC_VERSION \
"TF_SFF_CC V1.0 "
#define TF_SFF_CC_CVSID \
"$Id: sff.cc,v 1.2 2010-02-17 22:00:27 tforb Exp $"
#define DATWRITE_SFF_CC_CVSID \
"$Id: sff.cc,v 1.3 2010-02-20 11:05:43 tforb Exp $"
#include <sff.h>
#include <datwritexx/sff.h>
#include <datwritexx/util.h>
namespace tf {
namespace datwrite {
}
osffstream::osffstream(std::ostream& os, const bool& debug)
{
Mdebug=debug;
} // osffstream::osffstream(std::ostream& os, const bool& debug)
/*----------------------------------------------------------------------*/
void osffstream::help(std::ostream& os=std::cout)
{
} // void osffstream::help(std::ostream& os=std::cout)
/*----------------------------------------------------------------------*/
void osffstream::writefileheader()
{
} // void osffstream::writefileheader()
/*----------------------------------------------------------------------*/
void osffstream::writetrace(const Tdseries& series)
{
} // void osffstream::writetrace(const Tdseries& series)
/*----------------------------------------------------------------------*/
void osffstream::writetrace(const Tfseries& series)
{
} // void osffstream::writetrace(const Tfseries& series)
/*----------------------------------------------------------------------*/
void osffstream::writetrace(const Tiseries& series)
{
} // void osffstream::writetrace(const Tiseries& series)
} // namespace datwrite
/* ----- END OF sff.cc ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: util.h,v 1.3 2010-02-17 22:13:29 tforb Exp $
* $Id: util.h,v 1.4 2010-02-20 11:05:43 tforb Exp $
* \author Thomas Forbriger
* \date 17/02/2010
*
......@@ -40,7 +40,7 @@
#define DATWRITE_UTIL_H_VERSION \
"TF_UTIL_H V1.0 "
#define DATWRITE_UTIL_H_CVSID \
"$Id: util.h,v 1.3 2010-02-17 22:13:29 tforb Exp $"
"$Id: util.h,v 1.4 2010-02-20 11:05:43 tforb Exp $"
namespace datwrite {
......@@ -66,6 +66,21 @@ namespace datwrite {
/*----------------------------------------------------------------------*/
/*! \brief produce debug output
* \ingroup misc_h
*
* \param C output will be generated if C == true
* \param N name of function
* \param M message to print
*/
#define TFXX_debug(C,N,M) \
if (C) { \
std::cerr << "DEBUG (" << N << ", " \
<< __FILE__ << " line #" << __LINE__ << "):" << std::endl \
<< " " << M << std::endl; \
std::cerr.flush(); \
}
} // namespace util
} // namespace datwrite
......
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