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

added provisions to support binary openmode for input stream

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/branches/libdatrwxx.su
SVN Revision: 3455
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 8a5ee444
......@@ -42,16 +42,37 @@
namespace datrw {
/*! constructor (must be called by derived class
*
* \param is C++ input stream
* \param providesd \c true, if stream provides \c double type series
* \param providesf \c true, if stream provides \c float type series
* \param providesi \c true, if stream provides \c int type series
* \param isbinary \c true, if input stream should be opened in binary mode
*/
idatstream::idatstream(std::istream& is,
const bool& providesd,
const bool& providesf,
const bool& providesi):
const bool& providesi,
const bool& isbinary):
Mis(is), Mwid2set(false), Msrceset(false), Minfoset(false),
Mtracefreeset(false), Mfilefreeset(false), Mlast(false),
Mprovidesd(providesd), Mprovidesf(providesf), Mprovidesi(providesi)
Mprovidesd(providesd), Mprovidesf(providesf), Mprovidesi(providesi),
Misbinary(isbinary)
{
DATRW_assert(is.good(), "input stream is not good!");
}
} // idatstream::idatstream
/*----------------------------------------------------------------------*/
/*! return open mode required for this type of stream
*/
std::ios_base::openmode idatstream::openmode() const
{
std::ios_base::openmode retval=std::ios_base::in;
if (this->isbinary()) { retval |= std::ios_base::binary; }
return(retval);
} // ios_base::openmode openmode() const
/*----------------------------------------------------------------------*/
......
......@@ -33,6 +33,7 @@
* - 17/09/2004 V1.2 make most fields private
* - 23/12/2004 V1.3 user of datstream::good() does not want to know
* anything about Mis state
* - 23/11/2010 V1.4 introduced isbinary flag
*
* ============================================================================
*/
......@@ -88,6 +89,8 @@ namespace datrw {
bool providesd() const { return(Mprovidesd); }
bool providesf() const { return(Mprovidesf); }
bool providesi() const { return(Mprovidesi); }
bool isbinary() const { return(Misbinary); }
std::ios_base::openmode openmode() const;
bool last() const { return(Mlast); }
bool good() const { return(!Mlast); }
/*! return FREE block
......@@ -112,7 +115,8 @@ namespace datrw {
idatstream(std::istream& is,
const bool& providesd=false,
const bool& providesf=false,
const bool& providesi=false);
const bool& providesi=false,
const bool& isbinary=false);
std::istream& Mis;
void setfilefree(const sff::FREE& free);
void settracefree(const sff::FREE& free);
......@@ -129,7 +133,7 @@ namespace datrw {
sff::FREE Mfilefree;
bool Mwid2set, Msrceset, Minfoset, Mtracefreeset, Mfilefreeset;
bool Mlast;
bool Mprovidesd, Mprovidesf, Mprovidesi;
bool Mprovidesd, Mprovidesf, Mprovidesi, Misbinary;
}; // class idatstream
/*----------------------------------------------------------------------*/
......
......@@ -72,7 +72,7 @@ namespace datrw {
} // namespace mseed
imseedstream::imseedstream(std::istream& is, const bool& debug):
Tbase(is, true, true, true), Mdebug(debug)
Tbase(is, true, true, true, true), Mdebug(debug)
{
/* We must always be one record in advance. Data reading will be done by
* concatenating several MiniSEED records. A time series will be
......
......@@ -47,7 +47,8 @@
namespace datrw {
ipdasstream::ipdasstream(std::istream& is): Tbase(is, true, true, true)
ipdasstream::ipdasstream(std::istream& is)
: Tbase(is, true, true, true, true)
{ }
/*----------------------------------------------------------------------*/
......
......@@ -86,6 +86,8 @@ namespace datrw {
bool ANYDELEGATE( providesd )
bool ANYDELEGATE( providesf )
bool ANYDELEGATE( providesi )
bool ANYDELEGATE( isbinary )
std::ios_base::openmode ANYDELEGATE( openmode )
void ANYDELEGATE( skipseries )
private:
ianystream(const ianystream&);
......
......@@ -49,7 +49,7 @@
namespace datrw {
isacstream::isacstream(std::istream& is, const bool& debug):
Tbase(is, true, true, true), Mdebug(debug)
Tbase(is, true, true, true, true), Mdebug(debug)
{ }
/*----------------------------------------------------------------------*/
......
Supports Markdown
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