The following commit has been merged in the master branch:
commit 57ef2b2bd30d889c7b632bb0d5584b846d3100eb
Author: Andrei Zavada <johnhom...@gmail.com>
Date:   Tue Jul 9 09:30:14 2013 +0300

    WIP

diff --git a/src/libsigfile/edf-io.cc b/src/libsigfile/edf-io.cc
index d88f239..3adc071 100644
--- a/src/libsigfile/edf-io.cc
+++ b/src/libsigfile/edf-io.cc
@@ -116,40 +116,6 @@ put_region_smpl( const int h,
 
 
 
-
-int
-CEDFFile::
-export_original( const int h,
-                const string& fname) const
-{
-       valarray<TFloat> signal = get_signal_original( h);
-       FILE *fd = fopen( fname.c_str(), "w");
-       if ( fd ) {
-               for ( size_t i = 0; i < signal.size(); ++i )
-                       fprintf( fd, "%g\n", signal[i]);
-               fclose( fd);
-               return 0;
-       } else
-               return -1;
-}
-
-
-int
-CEDFFile::
-export_filtered( const int h,
-                const string& fname) const
-{
-       valarray<TFloat> signal = get_signal_filtered( h);
-       FILE *fd = fopen( fname.c_str(), "w");
-       if ( fd ) {
-               for ( size_t i = 0; i < signal.size(); ++i )
-                       fprintf( fd, "%g\n", signal[i]);
-               fclose( fd);
-               return 0;
-       } else
-               return -1;
-}
-
 // Local Variables:
 // Mode: c++
 // indent-tabs-mode: 8
diff --git a/src/libsigfile/edf.hh b/src/libsigfile/edf.hh
index 589bd72..d28164d 100644
--- a/src/libsigfile/edf.hh
+++ b/src/libsigfile/edf.hh
@@ -245,14 +245,6 @@ class CEDFFile
        resize_records( size_t new_records);
        // unused, undefined
 
-      // export
-       int export_original( int h, const string& fname) const;
-       int export_filtered( int h, const string& fname) const;
-
-       int export_original_( int h, const string& fname) const;
-       int export_filtered_( int h, const string& fname) const;
-
-
       // reporting & misc
        string details( int which) const;
 
diff --git a/src/libsigfile/source-base.cc b/src/libsigfile/source-base.cc
index b826290..b4740cb 100644
--- a/src/libsigfile/source-base.cc
+++ b/src/libsigfile/source-base.cc
@@ -130,6 +130,7 @@ load_ancillary_files()
 {
        int retval = 0;
 
+       FAFA;
        for ( int h = 0; h < (int)n_channels(); ++h ) {
                auto& H = channel_by_id(h);
 
@@ -151,6 +152,7 @@ load_ancillary_files()
                        }
                }
 
+       FAFA;
        step2:
              // 2. annotations
                {
@@ -182,6 +184,7 @@ load_ancillary_files()
        step3:
                ;
        }
+       FAFA;
 
       // 3. filters
        {
@@ -200,6 +203,7 @@ load_ancillary_files()
                        }
        }
 
+       FAFA;
        return retval;
 }
 
@@ -429,6 +433,40 @@ get_region_filtered_smpl( const int h,
 
 
 
+int
+CSource::
+export_original( const int h,
+                const string& fname) const
+{
+       valarray<TFloat> signal = get_signal_original( h);
+       FILE *fd = fopen( fname.c_str(), "w");
+       if ( fd ) {
+               for ( size_t i = 0; i < signal.size(); ++i )
+                       fprintf( fd, "%g\n", signal[i]);
+               fclose( fd);
+               return 0;
+       } else
+               return -1;
+}
+
+
+int
+CSource::
+export_filtered( const int h,
+                const string& fname) const
+{
+       valarray<TFloat> signal = get_signal_filtered( h);
+       FILE *fd = fopen( fname.c_str(), "w");
+       if ( fd ) {
+               for ( size_t i = 0; i < signal.size(); ++i )
+                       fprintf( fd, "%g\n", signal[i]);
+               fclose( fd);
+               return 0;
+       } else
+               return -1;
+}
+
+
 // Local Variables:
 // Mode: c++
 // indent-tabs-mode: 8
diff --git a/src/libsigfile/source-base.hh b/src/libsigfile/source-base.hh
index 1141059..98df897 100644
--- a/src/libsigfile/source-base.hh
+++ b/src/libsigfile/source-base.hh
@@ -216,6 +216,11 @@ struct SFilterPack {
 
 class CSource {
        friend class CTypedSource;
+    public:
+       enum TFlags {
+               no_ancillary_files         = 1<<1,
+               no_field_consistency_check = 1<<2,
+       };
     protected:
        string  _filename;
 
@@ -223,10 +228,6 @@ class CSource {
        void clear_status()
                { _status = 0; }
 
-       enum TFlags {
-               no_ancillary_files         = 1<<1,
-               no_field_consistency_check = 1<<2,
-       };
        int     _flags;
 
        agh::SSubjectId
@@ -401,9 +402,9 @@ class CSource {
 
       // export
        virtual int
-       export_original( int, const string& fname) const = 0;
+       export_original( int, const string& fname) const;
        virtual int
-       export_filtered( int, const string& fname) const = 0;
+       export_filtered( int, const string& fname) const;
 
       // filenames
        string make_fname_artifacts( const SChannel& channel) const
diff --git a/src/libsigfile/tsv.cc b/src/libsigfile/tsv.cc
index 0f125e4..f6139ed 100644
--- a/src/libsigfile/tsv.cc
+++ b/src/libsigfile/tsv.cc
@@ -226,6 +226,18 @@ put_region_smpl( int, const valarray<TFloat>&, size_t) 
const
 }
 
 
+
+size_t
+CTSVFile::
+resize_seconds( double s)
+{
+       assert ( s > 0. );
+       for ( auto& H : channels )
+               H.data.resize( s * _samplerate);
+       return 0;
+}
+
+
 string
 CTSVFile::
 details( const int which) const
diff --git a/src/libsigfile/tsv.hh b/src/libsigfile/tsv.hh
index 991f2c7..eda499f 100644
--- a/src/libsigfile/tsv.hh
+++ b/src/libsigfile/tsv.hh
@@ -250,14 +250,6 @@ class CTSVFile
        size_t
        resize_seconds( double);
 
-      // export
-       int export_original( int h, const string& fname) const;
-       int export_filtered( int h, const string& fname) const;
-
-       int export_original_( int h, const string& fname) const;
-       int export_filtered_( int h, const string& fname) const;
-
-
       // reporting & misc
        string details( int which_details) const;
 
diff --git a/src/tools/agh-profile-gen.cc b/src/tools/agh-profile-gen.cc
index 60d523f..2f7fb89 100644
--- a/src/tools/agh-profile-gen.cc
+++ b/src/tools/agh-profile-gen.cc
@@ -203,7 +203,7 @@ main( int argc, char **argv)
                if ( A.file.empty() )
                        throw invalid_argument ("Missing file name");
 
-               sigfile::CTypedSource F (A.file, A.pagesize, 
0|sigfile::CTypedSource::no_ancillary_files);
+               sigfile::CTypedSource F (A.file, A.pagesize, 
0|sigfile::CSource::no_ancillary_files);
                if ( do_psd ) {
                        metrics::psd::CProfile P (F, A.h, A.psd_pp);
                        if ( P.go_compute() )
diff --git a/src/tools/edfcat.cc b/src/tools/edfcat.cc
index b0db990..afb5b8c 100644
--- a/src/tools/edfcat.cc
+++ b/src/tools/edfcat.cc
@@ -19,6 +19,7 @@
 
 #include <stdexcept>
 #include <fstream>
+#include "libsigproc/sigproc.hh"
 #include "libsigfile/edf.hh"
 #include "libsigfile/source.hh"
 #include "common/alg.hh"
@@ -335,7 +336,7 @@ exec_convert( const SOperation::SObject& obj)
 
        sigfile::CEDFFile F ((obj + ".edf").c_str(),
                             sigfile::CEDFFile::TSubtype::edf,
-                            0|sigfile::CTypedSource::no_ancillary_files,
+                            0|sigfile::CSource::no_ancillary_files,
                             make_channel_headers_for_CEDFFile( Hh.size(), 
"channel%zu", obj.samplerate),
                             obj.record_size,
                             ceilf(duration / obj.record_size));
@@ -358,7 +359,7 @@ exec_convert( const SOperation::SObject& obj)
 int
 exec_prune( const SOperation::SObject& obj)
 {
-       sigfile::CEDFFile F (obj.c_str(), 
sigfile::CTypedSource::no_ancillary_files);
+       sigfile::CEDFFile F (obj.c_str(), sigfile::CSource::no_ancillary_files);
 
        list<pair<sigfile::SChannel, size_t>> selected_channels;
        for ( auto& select_this : obj.channels ) {
@@ -378,7 +379,7 @@ exec_prune( const SOperation::SObject& obj)
 
        sigfile::CEDFFile G ((agh::fs::make_fname_base( obj, ".edf", false) + 
"-mod.edf").c_str(),
                             sigfile::CEDFFile::TSubtype::edf,
-                            sigfile::CTypedSource::no_ancillary_files,
+                            sigfile::CSource::no_ancillary_files,
                             selected_channels,
                             F.data_record_size,
                             F.n_data_records);
diff --git a/src/tools/edfhed-gtk.cc b/src/tools/edfhed-gtk.cc
index 3111338..4a81384 100644
--- a/src/tools/edfhed-gtk.cc
+++ b/src/tools/edfhed-gtk.cc
@@ -174,7 +174,7 @@ main( int argc, char **argv)
 
        try {
                auto F = sigfile::CEDFFile (fname,
-                                           
sigfile::CTypedSource::no_ancillary_files |
+                                           
sigfile::CSource::no_ancillary_files |
                                            
sigfile::CEDFFile::no_field_consistency_check);
 
                channel_no = 0;
diff --git a/src/tools/edfhed.cc b/src/tools/edfhed.cc
index 2769b05..15cdb0d 100644
--- a/src/tools/edfhed.cc
+++ b/src/tools/edfhed.cc
@@ -325,7 +325,7 @@ main( int argc, char **argv)
        for ( auto &fname : Opts.files )
                try {
                        auto F = sigfile::CEDFFile (fname,
-                                                   
sigfile::CTypedSource::no_ancillary_files |
+                                                   
sigfile::CSource::no_ancillary_files |
                                                    
sigfile::CEDFFile::no_field_consistency_check);
                        if ( Opts.settables.empty() &&
                             not Opts.from_timestamp && not Opts.from_tree && 
not Opts.to_timestamp ) {

-- 
Sleep experiment manager

_______________________________________________
debian-med-commit mailing list
debian-med-commit@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to