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

promise constness of series samples upon output to file

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: 3995
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 15cc9722
......@@ -31,11 +31,12 @@
* REVISIONS and CHANGES
* - 11/04/2006 V1.0 Thomas Forbriger
* - 01/04/2011 V1.1 do not clear Mhassrce upon writing the file header
* - 07/06/2011 V1.2 promise constness of series samples
*
* ============================================================================
*/
#define DATRW_DATWRITE_CC_VERSION \
"DATRW_DATWRITE_CC V1.1"
"DATRW_DATWRITE_CC V1.2"
#define DATRW_DATWRITE_CC_CVSID \
"$Id$"
......@@ -177,7 +178,7 @@ namespace datrw {
/*----------------------------------------------------------------------*/
void odatstream::writeseries(const Tdseries& series)
void odatstream::writeseries(const Tdseries::Tcoc& series)
{
DATRW_assert(this-Mwid2set,"missing WID2 header");
this->writetrace(series);
......@@ -186,7 +187,7 @@ namespace datrw {
/*----------------------------------------------------------------------*/
void odatstream::writeseries(const Tfseries& series)
void odatstream::writeseries(const Tfseries::Tcoc& series)
{
DATRW_assert(this-Mwid2set,"missing WID2 header");
this->writetrace(series);
......@@ -195,7 +196,7 @@ namespace datrw {
/*----------------------------------------------------------------------*/
void odatstream::writeseries(const Tiseries& series)
void odatstream::writeseries(const Tiseries::Tcoc& series)
{
DATRW_assert(this-Mwid2set,"missing WID2 header");
this->writetrace(series);
......
......@@ -30,6 +30,7 @@
*
* REVISIONS and CHANGES
* - 11/04/2006 V1.0 Thomas Forbriger
* - 07/06/2011 V1.1 promise constness of series samples
*
* ============================================================================
*/
......@@ -38,7 +39,7 @@
#ifndef DATRW_DATWRITE_H_VERSION
#define DATRW_DATWRITE_H_VERSION \
"DATRW_DATWRITE_H V1.0 "
"DATRW_DATWRITE_H V1.1"
#define DATRW_DATWRITE_H_CVSID \
"$Id$"
......@@ -114,11 +115,11 @@ namespace datrw {
void setsrce(const sff::SRCE& srce);
void setinfo(const sff::INFO& info);
//! write double data
void writeseries(const Tdseries& series);
void writeseries(const Tdseries::Tcoc& series);
//! write single precision float data
void writeseries(const Tfseries& series);
void writeseries(const Tfseries::Tcoc& series);
//! write integer data
void writeseries(const Tiseries& series);
void writeseries(const Tiseries::Tcoc& series);
//! flush file header to file
void flushfileheader();
//! true if file FREE block can be handled
......@@ -147,11 +148,11 @@ namespace datrw {
const bool& handlessrce=false,
const bool& handlesinfo=false);
//! write double data
virtual void writetrace(const Tdseries& series) { DATRW_illegal; }
virtual void writetrace(const Tdseries::Tcoc& series) { DATRW_illegal; }
//! write single precision float data
virtual void writetrace(const Tfseries& series) { DATRW_illegal; }
virtual void writetrace(const Tfseries::Tcoc& series) { DATRW_illegal; }
//! write integer data
virtual void writetrace(const Tiseries& series) { DATRW_illegal; }
virtual void writetrace(const Tiseries::Tcoc& series) { DATRW_illegal; }
//! actually write the file header
virtual void writefileheader() { DATRW_illegal; }
//! clear trace header flags
......@@ -203,25 +204,25 @@ namespace datrw {
/*----------------------------------------------------------------------*/
inline odatstream& operator<<(odatstream& os, sff::WID2& wid2)
inline odatstream& operator<<(odatstream& os, const sff::WID2& wid2)
{ os.setwid2(wid2); return(os); }
inline odatstream& operator<<(odatstream& os, sff::SRCE& srce)
inline odatstream& operator<<(odatstream& os, const sff::SRCE& srce)
{ os.setsrce(srce); return(os); }
inline odatstream& operator<<(odatstream& os, sff::INFO& info)
inline odatstream& operator<<(odatstream& os, const sff::INFO& info)
{ os.setinfo(info); return(os); }
inline odatstream& operator<<(odatstream& os, sff::FREE& free)
inline odatstream& operator<<(odatstream& os, const sff::FREE& free)
{ os.setfree(free); return(os); }
inline odatstream& operator<<(odatstream& os, Tdseries& series)
inline odatstream& operator<<(odatstream& os, const Tdseries::Tcoc& series)
{ os.writeseries(series); return(os); }
inline odatstream& operator<<(odatstream& os, Tfseries& series)
inline odatstream& operator<<(odatstream& os, const Tfseries::Tcoc& series)
{ os.writeseries(series); return(os); }
inline odatstream& operator<<(odatstream& os, Tiseries& series)
inline odatstream& operator<<(odatstream& os, const Tiseries::Tcoc& series)
{ os.writeseries(series); return(os); }
} // namespace datrw
......
......@@ -50,37 +50,37 @@ namespace datrw {
Mvaluetype=Fnone;
} // seriesreservoir::seriesreservoir()
seriesreservoir::seriesreservoir(const Tdseries& series)
seriesreservoir::seriesreservoir(const Tdseries::Tcoc& series)
{
Mvaluetype=Fdouble;
Mdseries=series.copyout();
} // seriesreservoir::seriesreservoir(const Tdseries& series)
seriesreservoir::seriesreservoir(const Tfseries& series)
seriesreservoir::seriesreservoir(const Tfseries::Tcoc& series)
{
Mvaluetype=Ffloat;
Mfseries=series.copyout();
} // seriesreservoir::seriesreservoir(const Tfseries& series)
seriesreservoir::seriesreservoir(const Tiseries& series)
seriesreservoir::seriesreservoir(const Tiseries::Tcoc& series)
{
Mvaluetype=Finteger;
Miseries=series.copyout();
} // seriesreservoir::seriesreservoir(const Tiseries& series)
Tdseries seriesreservoir::dseries() const
Tdseries::Tcoc seriesreservoir::dseries() const
{
DATRW_assert((Mvaluetype == Fdouble), "wrong data type");
return Mdseries;
} // Tdseries seriesreservoir::dseries() const
Tfseries seriesreservoir::fseries() const
Tfseries::Tcoc seriesreservoir::fseries() const
{
DATRW_assert((Mvaluetype == Ffloat), "wrong data type");
return Mfseries;
} // Tfseries seriesreservoir::fseries() const
Tiseries seriesreservoir::iseries() const
Tiseries::Tcoc seriesreservoir::iseries() const
{
DATRW_assert((Mvaluetype == Finteger), "wrong data type");
return Miseries;
......
......@@ -30,6 +30,7 @@
*
* REVISIONS and CHANGES
* - 20/02/2010 V1.0 Thomas Forbriger
* - 07/06/2011 V1.1 promise constness of series samples
*
* ============================================================================
*/
......@@ -38,7 +39,7 @@
#ifndef DATRW_RESERVOIR_H_VERSION
#define DATRW_RESERVOIR_H_VERSION \
"DATRW_RESERVOIR_H V1.0"
"DATRW_RESERVOIR_H V1.1"
#define DATRW_RESERVOIR_H_CVSID \
"$Id$"
......@@ -73,18 +74,18 @@ namespace datrw {
class seriesreservoir {
public:
seriesreservoir();
seriesreservoir(const Tdseries& series);
seriesreservoir(const Tfseries& series);
seriesreservoir(const Tiseries& series);
seriesreservoir(const Tdseries::Tcoc& series);
seriesreservoir(const Tfseries::Tcoc& series);
seriesreservoir(const Tiseries::Tcoc& series);
Evaluetype valuetype() const { return Mvaluetype; }
Tdseries dseries() const;
Tfseries fseries() const;
Tiseries iseries() const;
Tdseries::Tcoc dseries() const;
Tfseries::Tcoc fseries() const;
Tiseries::Tcoc iseries() const;
private:
Evaluetype Mvaluetype;
Tdseries Mdseries;
Tfseries Mfseries;
Tiseries Miseries;
Tdseries::Tcoc Mdseries;
Tfseries::Tcoc Mfseries;
Tiseries::Tcoc Miseries;
}; // class seriesreservoir
} // namespace util
......
......@@ -31,6 +31,7 @@
* - 30/03/2004 V1.0 Thomas Forbriger
* - 12/06/2007 V1.1 added DEBUG member data
* - 23/11/2010 V1.2 introduced static member data
* - 07/06/2011 V1.3 promise constness of series samples
*
* ============================================================================
*/
......@@ -39,7 +40,7 @@
#ifndef DATRW_SFF_H_VERSION
#define DATRW_SFF_H_VERSION \
"DATRW_SFF_H V1.2"
"DATRW_SFF_H V1.3"
#define DATRW_SFF_H_CVSID \
"$Id$"
......@@ -105,9 +106,9 @@ namespace datrw {
static const std::ios_base::openmode openmode;
protected:
virtual void writefileheader();
virtual void writetrace(const Tdseries& series);
virtual void writetrace(const Tfseries& series);
virtual void writetrace(const Tiseries& series);
virtual void writetrace(const Tdseries::Tcoc& series);
virtual void writetrace(const Tfseries::Tcoc& series);
virtual void writetrace(const Tiseries::Tcoc& series);
private:
/*! flush waiting trace data
* \PARAM last true if no other trace will be written,
......
......@@ -34,11 +34,12 @@
* - bug fix: INFO data was not passed
* - declare SFF data type as single precision
* - declare GSE data type as integer
* - 07/06/2011 V1.2 promise constness of series samples
*
* ============================================================================
*/
#define DATRW_OSFF_CC_VERSION \
"DATRW_OSFF_CC V1.1"
"DATRW_OSFF_CC V1.2"
#define DATRW_OSFF_CC_CVSID \
"$Id$"
......@@ -86,7 +87,7 @@ namespace datrw {
/*----------------------------------------------------------------------*/
void osffstream::writetrace(const Tdseries& series)
void osffstream::writetrace(const Tdseries::Tcoc& series)
{
DATRW_debug(Mdebug, "osffstream::writefileheader",
"write series of type double to file");
......@@ -96,7 +97,7 @@ namespace datrw {
/*----------------------------------------------------------------------*/
void osffstream::writetrace(const Tfseries& series)
void osffstream::writetrace(const Tfseries::Tcoc& series)
{
DATRW_debug(Mdebug, "osffstream::writefileheader",
"write series of type float to file");
......@@ -106,7 +107,7 @@ namespace datrw {
/*----------------------------------------------------------------------*/
void osffstream::writetrace(const Tiseries& series)
void osffstream::writetrace(const Tiseries::Tcoc& series)
{
DATRW_debug(Mdebug, "osffstream::writefileheader",
"write series of type integer to file");
......
......@@ -30,6 +30,7 @@
* REVISIONS and CHANGES
* - 19/11/2010 V1.0 Thomas Forbriger
* - 23/11/2010 V1.1 introduced static member data
* - 07/06/2011 V1.2 promise constness of series samples
*
* ============================================================================
*/
......@@ -38,7 +39,7 @@
#ifndef DATRW_SU_H_VERSION
#define DATRW_SU_H_VERSION \
"DATRW_SU_H V1.1"
"DATRW_SU_H V1.2"
#define DATRW_SU_H_CVSID \
"$Id$"
......@@ -92,9 +93,9 @@ namespace datrw {
static const std::ios_base::openmode openmode;
protected:
virtual void writefileheader();
virtual void writetrace(const Tdseries& series);
virtual void writetrace(const Tfseries& series);
virtual void writetrace(const Tiseries& series);
virtual void writetrace(const Tdseries::Tcoc& series);
virtual void writetrace(const Tfseries::Tcoc& series);
virtual void writetrace(const Tiseries::Tcoc& series);
private:
bool Mdebug;
unsigned int Mitrace;
......
......@@ -29,11 +29,12 @@
*
* REVISIONS and CHANGES
* - 03/12/2010 V1.0 Thomas Forbriger
* - 07/06/2011 V1.1 promise constness of series samples
*
* ============================================================================
*/
#define DATRW_OSUSTREAM_CC_VERSION \
"DATRW_OSUSTREAM_CC V1.0 "
"DATRW_OSUSTREAM_CC V1.1"
#define DATRW_OSUSTREAM_CC_CVSID \
"$Id$"
......@@ -79,23 +80,23 @@ namespace datrw {
/*----------------------------------------------------------------------*/
//! write double data by passing samples to float function
void osustream::writetrace(const Tdseries& series)
void osustream::writetrace(const Tdseries::Tcoc& series)
{
this->writetrace(::datrw::util::convert<Tdseries,Tfseries>(series));
this->writetrace(::datrw::util::convert<Tdseries::Tcoc,Tfseries>(series));
} // void osustream::writetrace(const Tdseries& series)
/*----------------------------------------------------------------------*/
//! write int data by passing samples to float function
void osustream::writetrace(const Tiseries& series)
void osustream::writetrace(const Tiseries::Tcoc& series)
{
this->writetrace(::datrw::util::convert<Tiseries,Tfseries>(series));
this->writetrace(::datrw::util::convert<Tiseries::Tcoc,Tfseries>(series));
} // void osustream::writetrace(const Tiseries& series)
/*----------------------------------------------------------------------*/
//! actually write trace data
void osustream::writetrace(const Tfseries& series)
void osustream::writetrace(const Tfseries::Tcoc& series)
{
DATRW_debug(Mdebug, "osustream::writetrace(const Tfseries& series)",
"actually write trace");
......@@ -121,7 +122,7 @@ namespace datrw {
header.Mheader.tracr=Mitrace;
header.write(Mos);
// write samples to file
Mos.write(reinterpret_cast<char *>(series.pointer()),
Mos.write(reinterpret_cast<const char *>(series.pointer()),
series.size()*sizeof(Tfseries::Tvalue));
DATRW_debug(Mdebug, "osustream::writetrace(const Tfseries& series)",
"wrote " << series.size() << " samples of "
......
......@@ -31,6 +31,7 @@
* REVISIONS and CHANGES
* - 17/02/2010 V1.0 Thomas Forbriger
* - 26/11/2010 V1.1 moved not input specifc part to formats.h
* - 07/06/2011 V1.2 promise constness of series samples
*
* ============================================================================
*/
......@@ -39,7 +40,7 @@
#ifndef DATRW_WRITEANY_H_VERSION
#define DATRW_WRITEANY_H_VERSION \
"DATRW_WRITEANY_H V1.1"
"DATRW_WRITEANY_H V1.2"
#define DATRW_WRITEANY_H_CVSID \
"$Id$"
......@@ -101,7 +102,7 @@ namespace datrw {
* datrw::oanystream::odatstream()
*/
template<class C>
oanystream& operator<<(oanystream& os, C& c)
oanystream& operator<<(oanystream& os, const C& c)
{ os.odatstream() << c; return(os); }
} // namespace datrw
......
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