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

TSOFT reading should be fine now

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: 2892
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent c675f3f5
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tsofttest.cc,v 1.13 2009-11-12 15:20:26 tforb Exp $
* $Id: tsofttest.cc,v 1.14 2009-11-12 16:21:39 tforb Exp $
* \author Thomas Forbriger
* \date 17/09/2009
*
......@@ -35,7 +35,7 @@
#define TSOFTTEST_VERSION \
"TSOFTTEST V1.0 test tsoft reading"
#define TSOFTTEST_CVSID \
"$Id: tsofttest.cc,v 1.13 2009-11-12 15:20:26 tforb Exp $"
"$Id: tsofttest.cc,v 1.14 2009-11-12 16:21:39 tforb Exp $"
#include <iostream>
#include <fstream>
......@@ -264,13 +264,13 @@ int main(int iargc, char* argv[])
filefree.append(thefile.free());
cout << filefree;
const datread::tsoft::Datacontainer& thedatacontainer=thefile.dc();
const datread::tsoft::Datacontainer& dc=thefile.dc();
// report on channels
for (int ich=0; ich<thefile.nchannels(); ++ich)
for (int ich=0; ich<dc.nchannels(); ++ich)
{
cout << "channel #" << ich << ":" << endl;
cout << "===========" << endl;
const datread::tsoft::Channeldata& cd=thedatacontainer[ich];
const datread::tsoft::Channeldata& cd=dc.channel(ich, true);
const datread::tsoft::Channelinfo& ci=cd.chinfo();
sff::FREE channelfree;
channelfree.append(datread::tsoft::channelinfofree(ci));
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tsoftdata.cc,v 1.15 2009-11-12 15:20:26 tforb Exp $
* $Id: tsoftdata.cc,v 1.16 2009-11-12 16:21:39 tforb Exp $
* \author Thomas Forbriger
* \date 16/09/2009
*
......@@ -35,7 +35,7 @@
#define DATREAD_TSOFTDATA_CC_VERSION \
"DATREAD_TSOFTDATA_CC V1.0 "
#define DATREAD_TSOFTDATA_CC_CVSID \
"$Id: tsoftdata.cc,v 1.15 2009-11-12 15:20:26 tforb Exp $"
"$Id: tsoftdata.cc,v 1.16 2009-11-12 16:21:39 tforb Exp $"
#include <datreadxx/error.h>
#include <datreadxx/tsoftdata.h>
......@@ -150,6 +150,13 @@ namespace datread {
/*======================================================================*/
// class Datasequence
Datasequence::Datasequence()
{
this->initialize();
} // Datasequence::Datasequence()
/*----------------------------------------------------------------------*/
//! return time of next sample after last samples
libtime::TAbsoluteTime Datasequence::timeofnextsample(const bool&
debug) const
......@@ -172,7 +179,7 @@ namespace datread {
Msamples.reserve(86500);
Msamples.clear();
Mdate=libtime::TAbsoluteTime();
Minterval=0;
Minterval=libtime::double2time(0);
} // void Datasequence::initialize()
/*----------------------------------------------------------------------*/
......@@ -277,7 +284,7 @@ namespace datread {
{
std::cout << " sample: " << thesample << std::endl;
}
this->sequence(ich).push_sample(thedata.time(),
this->channel(ich).push_sample(thedata.time(),
thesample,
theundetval,
dt, debug);
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tsoftdata.h,v 1.15 2009-11-12 15:20:26 tforb Exp $
* $Id: tsoftdata.h,v 1.16 2009-11-12 16:21:39 tforb Exp $
* \author Thomas Forbriger
* \date 16/09/2009
*
......@@ -39,7 +39,7 @@
#define DATREAD_TSOFTDATA_H_VERSION \
"DATREAD_TSOFTDATA_H V1.0 "
#define DATREAD_TSOFTDATA_H_CVSID \
"$Id: tsoftdata.h,v 1.15 2009-11-12 15:20:26 tforb Exp $"
"$Id: tsoftdata.h,v 1.16 2009-11-12 16:21:39 tforb Exp $"
#include<iostream>
#include<string>
......@@ -267,6 +267,8 @@ namespace datread {
*/
class Datasequence {
public:
//! initialize
Datasequence();
//! append sample
void append(const double& v) { Msamples.push_back(v); }
//! set time of first sample
......@@ -385,50 +387,51 @@ namespace datread {
const libtime::TRelativeTime& dt,
const bool& debug=false);
//! return data for specific channel
Channeldata& sequence(const unsigned int& i)
Channeldata& channel(const unsigned int& i,
const bool& debug=false)
{
// using resize here ist not critical since the actual resize should
// take place when reading channel information, not data
if (i>=Mchannels.size())
{
Mchannels.resize(i+1);
// std::cout << "resize to access " << i << std::endl;
}
DATREAD_assert(((i<Mchannels.size()) && (i>=0)),
"illegal channel index");
return Mchannels[i];
this->resizetoindex(i);
return(Mchannels[i]);
}
//! return data for specific channel
const Channeldata& sequence(const unsigned int& i) const
const Channeldata& channel(const unsigned int& i,
const bool& debug=false) const
{
// using resize here ist not critical since the actual resize should
// take place when reading channel information, not data
if (i>=Mchannels.size())
{
Mchannels.resize(i+1);
// std::cout << "resize to access " << i << std::endl;
}
DATREAD_assert(((i<Mchannels.size()) && (i>=0)),
"illegal channel index");
return Mchannels[i];
this->checkindex(i);
return(Mchannels[i]);
}
//! return data for specific channel
Channeldata& operator[](const unsigned int& i)
{
return this->sequence(i);
return (this->channel(i));
}
//! return data for specific channel
const Channeldata& operator[](const unsigned int& i) const
{
return this->sequence(i);
return (this->channel(i));
}
//! return number of channels
int nchannels() const { return Mchannels.size(); }
//! flush all channels
void flushchannels();
private:
//! resize to index
void resizetoindex(const unsigned int& i)
{
if (i>=Mchannels.size())
{
Mchannels.resize(i+1);
}
this->checkindex(i);
}
//! check index
void checkindex(const unsigned int& i) const
{
DATREAD_assert(((i<Mchannels.size()) && (i>=0)),
"illegal channel index");
}
//! data sequences
mutable Tvocd Mchannels;
Tvocd Mchannels;
}; // class Datacontainer
} // namespace tsoft
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tsoftreader.cc,v 1.12 2009-11-12 07:23:55 tforb Exp $
* $Id: tsoftreader.cc,v 1.13 2009-11-12 16:21:39 tforb Exp $
* \author Thomas Forbriger
* \date 16/09/2009
*
......@@ -35,7 +35,7 @@
#define DATREAD_TSOFTREADER_CC_VERSION \
"DATREAD_TSOFTREADER_CC V1.0 "
#define DATREAD_TSOFTREADER_CC_CVSID \
"$Id: tsoftreader.cc,v 1.12 2009-11-12 07:23:55 tforb Exp $"
"$Id: tsoftreader.cc,v 1.13 2009-11-12 16:21:39 tforb Exp $"
#include <iostream>
#include <sstream>
......@@ -190,7 +190,14 @@ namespace datread {
}
else if (inchannels)
{
if (debug)
cout << "go for info for channel #" << count+1 << endl;
Channelinfo& ci=Mdatacontainer[count].chinfo();
if (debug)
{
cout << "have access to channelinfo for channel " << count+1 << endl;
cout.flush();
}
ci.setchannelinfo(inputline);
++count;
if (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