template <typename T>
bool dumpargs(std::ostream & os, T c1, T c2, T c3, T c4, T c5, T c6, T c7, T c8)
{
static const char sep = '\t';
os << c1 << sep << c2 << sep << c3 << sep << c4 << sep << c5 << sep << c6 << sep << c7 << sep << c8;
os << std::endl;
return true;
}
bool wave2stream( std::ostream &text_file, const char *in, size_t len )
{
short * buffer = (short*)in;
int length = len / sizeof( short );
text_file << "COMPLETE_WAVE" << '\t' << "MASK" << '\t' << "AQUISITION_PROFIL" << '\t' << "END-INHALE" << '\t' << "END-EXHALE" << '\t' << "AQUISITION_WAVE" << '\t' << "WAVE_STATISTICS" << '\t' << "MASK" << std::endl;
for (int i=0;i<length-76;i+=2)
{
if ( i < 74 )
{
if (buffer[i+75] == 0)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 0 << '\t' << " " << '\t' << " " << '\t' << " " << '\t' << buffer[i] << '\t' << buffer[i+1] << std::endl;
if (buffer[i+75] == 16384)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 0 << '\t' << buffer[i+74] << '\t' << " " << '\t' << " " << '\t' << buffer[i] << '\t' << buffer[i+1] << std::endl;
if (buffer[i+75] == 256)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 0 << '\t' << " " << '\t' << buffer[i+74] << '\t' << " " << '\t' << buffer[i] << '\t' << buffer[i+1] << std::endl;
if (buffer[i+75] == -32768)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 1 << '\t' << " " << '\t' << " " << '\t' << buffer[i+74] << '\t' << buffer[i] << '\t' << buffer[i+1] << std::endl;
if (buffer[i+75] == -16384)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 1 << '\t' << buffer[i+74] << '\t' << " " << '\t' << buffer[i+74] << '\t' << buffer[i] << '\t' << buffer[i+1] << std::endl;
if (buffer[i+75] == -32512)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 1 << '\t' << " " << '\t' << buffer[i+74] << '\t' << buffer[i+74] << '\t' << buffer[i] << '\t' << buffer[i+1] << std::endl;
}
else
{
if (buffer[i+75] == 0)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 0 << '\t' << " " << '\t' << " " << '\t' << " " << '\t' << " " << '\t' << " " << std::endl;
if (buffer[i+75] == 16384)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 0 << '\t' << buffer[i+74] << '\t' << " " << '\t' << " " << '\t' << " " << '\t' << " " << std::endl;
if (buffer[i+75] == 256)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 0 << '\t' << " " << '\t' << buffer[i+74] << '\t' << " " << '\t' << " " << '\t' << " " << std::endl;
if (buffer[i+75] == -32768)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 1 << '\t' << " " << '\t' << " " << '\t' << buffer[i+74] << '\t' << " " << '\t' << " " << std::endl;
if (buffer[i+75] == -16384)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 1 << '\t' << buffer[i+74] << '\t' << " " << '\t' << buffer[i+74] << '\t' << " " << '\t' << " " << std::endl;
if (buffer[i+75] == -32512)
text_file << buffer[i+74] << '\t' << buffer[i+75] << '\t' << 1 << '\t' << " " << '\t' << buffer[i+74] << '\t' << buffer[i+74] << '\t' << " " << '\t' << " " << std::endl;
}
}
return true;
}
int main(int argc, char *argv [])
{
if( argc < 3 ) return 1;
const char *filename = argv[1];
const char *outfilename = argv[2];
{
std::cerr << "Failed to read: " << filename << std::endl;
return 1;
}
assert( bv );
std::ofstream os( outfilename );
os.close();
return 0;
}