The following commit has been merged in the master branch:
commit fb1da0b4335d9745efe7670ab4f58b9533aa83b2
Author: Andrei Zavada <[email protected]>
Date:   Mon Apr 29 01:43:53 2013 +0300

    sigfile::SChannel overhaul WIP

diff --git a/src/expdesign/primaries.hh b/src/expdesign/primaries.hh
index 0e18d99..e33f1cf 100644
--- a/src/expdesign/primaries.hh
+++ b/src/expdesign/primaries.hh
@@ -156,7 +156,7 @@ class CSubject : public SSubjectId {
                        const char*
                        channel() const
                                {
-                                       return (_h == -1) ? "(embedded)" : 
_source.channel_by_id(_h);
+                                       return (_h == -1) ? "(embedded)" : 
_source.channel_by_id(_h).name();
                                }
                        agh::alg::SSpan<float>
                        page_span( size_t pagesize) const
diff --git a/src/expdesign/recording.hh b/src/expdesign/recording.hh
index 71b66fd..fe08eea 100644
--- a/src/expdesign/recording.hh
+++ b/src/expdesign/recording.hh
@@ -156,7 +156,7 @@ class CRecording {
        const char* subject() const      {  return 
_source().subject().name.c_str(); }
        const char* session() const      {  return _source().session(); }
        const char* episode() const      {  return _source().episode(); }
-       const char* channel() const      {  return 
_source().channel_by_id(_sig_no); }
+       const char* channel() const      {  return 
_source().channel_by_id(_sig_no).name(); }
 
        sigfile::SChannel::TType signal_type() const
                {
diff --git a/src/libsigfile/edf.cc b/src/libsigfile/edf.cc
index a5244f9..021638c 100644
--- a/src/libsigfile/edf.cc
+++ b/src/libsigfile/edf.cc
@@ -39,9 +39,9 @@ using agh::str::tokens_trimmed;
 using sigfile::CEDFFile;
 
 template valarray<TFloat> CEDFFile::get_region_original_( int, size_t, size_t) 
const;
-template valarray<TFloat> CEDFFile::get_region_original_( const string&, 
size_t, size_t) const;
+template valarray<TFloat> CEDFFile::get_region_original_( const SChannel&, 
size_t, size_t) const;
 template valarray<TFloat> CEDFFile::get_region_filtered_( int, size_t, size_t) 
const;
-template valarray<TFloat> CEDFFile::get_region_filtered_( const string&, 
size_t, size_t) const;
+template valarray<TFloat> CEDFFile::get_region_filtered_( const SChannel&, 
size_t, size_t) const;
 template int CEDFFile::put_region_( int, const valarray<TFloat>&, size_t) 
const;
 template int CEDFFile::put_region_( const string&, const valarray<TFloat>&, 
size_t) const;
 template int CEDFFile::export_original_( int, const string&) const;
@@ -119,9 +119,6 @@ const char version_string[8]  = {'0',' ',' ',' ', ' ',' ',' 
',' '};
 
 }
 
-const char* CEDFFile::SSignal::edf_annotations_label =
-       
sigfile::SChannel::kemp_signal_types[sigfile::SChannel::embedded_annotation];
-
 
 CEDFFile::
 CEDFFile (const string& fname_, const int flags_)
@@ -193,7 +190,7 @@ CEDFFile (const string& fname_, const int flags_)
        else {
              // 1. artifacts, per signal
                for ( auto &H : channels ) {
-                       ifstream thomas (make_fname_artifacts( H.label));
+                       ifstream thomas (make_fname_artifacts( H.ucd));
                        if ( not thomas.good() )
                                continue;
 
@@ -208,7 +205,7 @@ CEDFFile (const string& fname_, const int flags_)
 
              // 2. annotations, per signal
                for ( auto &H : channels ) {
-                       ifstream fd (make_fname_annotations( H.label));
+                       ifstream fd (make_fname_annotations( H.ucd));
                        if ( not fd.good() )
                                continue;
                        while ( fd.good() and not fd.eof() ) {
@@ -260,7 +257,7 @@ CEDFFile (const string& fname_, const int flags_)
 
 CEDFFile::
 CEDFFile (const string& fname_, const TSubtype subtype_, const int flags_,
-         const list<pair<string, size_t>>& channels_,
+         const list<pair<SChannel, size_t>>& channels_,
          const size_t data_record_size_,
          const size_t n_data_records_)
       : CSource (fname_, flags_),
@@ -318,8 +315,9 @@ CEDFFile (const string& fname_, const TSubtype subtype_, 
const int flags_,
        for ( auto& h : channels_ ) {
                auto& H = channels[hi];
 
+               H.ucd = h.first;
                strncpy( H.header.label,
-                        pad( H.label = h.first, 16).c_str(), 16);
+                        pad( H.ucd.name(), 16).c_str(), 16);
 
                strncpy( H.header.transducer_type,
                         pad( H.transducer_type = "no transducer info", 
80).c_str(), 80);
@@ -445,19 +443,19 @@ write_ancillary_files()
 {
        for ( auto &I : channels ) {
                if ( not I.artifacts().empty() ) {
-                       ofstream thomas (make_fname_artifacts( I.label), 
ios_base::trunc);
+                       ofstream thomas (make_fname_artifacts( I.ucd), 
ios_base::trunc);
                        if ( thomas.good() )
                                for ( auto &A : I.artifacts() )
                                        thomas << A.a << ' ' << A.z << endl;
                } else
-                       if ( unlink( make_fname_artifacts( I.label).c_str()) ) 
{}
+                       if ( unlink( make_fname_artifacts( I.ucd).c_str()) ) {}
 
                if ( not I.annotations.empty() ) {
-                       ofstream thomas (make_fname_annotations( I.label), 
ios_base::trunc);
+                       ofstream thomas (make_fname_annotations( I.ucd), 
ios_base::trunc);
                        for ( auto &A : I.annotations )
                                thomas << (int)A.type << ' ' << A.span.a << ' ' 
<< A.span.z << ' ' << A.label << EOA << endl;
                } else
-                       if ( unlink( make_fname_annotations( I.label).c_str()) 
) {}
+                       if ( unlink( make_fname_annotations( I.ucd).c_str()) ) 
{}
        }
        ofstream thomas (make_fname_filters( filename()), ios_base::trunc);
        if ( thomas.good() )
@@ -677,9 +675,8 @@ _parse_header()
                        channels.resize( n_channels);
 
                        for ( auto &H : channels )
-                               H.label =
-                                       trim( string (_get_next_field( 
H.header.label, 16), 16));
-                               // to be parsed again wrt SignalType:Channel 
format
+                               H.ucd = trim( string (_get_next_field( 
H.header.label, 16), 16));
+                               // includes figuring signal type and mapping to 
a canonicalised name
 
                        for ( auto &H : channels )
                                H.transducer_type =
@@ -691,7 +688,7 @@ _parse_header()
 
                        for ( auto &H : channels ) {
                                _get_next_field( H.header.physical_min, 8);
-                               if ( H.label == SSignal::edf_annotations_label )
+                               if ( H.ucd.type() == 
sigfile::SChannel::TType::embedded_annotation )
                                        continue;
                                if ( sscanf( H.header.physical_min, "%8lg",
                                             &H.physical_min) != 1 ) {
@@ -702,7 +699,7 @@ _parse_header()
                        }
                        for ( auto &H : channels ) {
                                _get_next_field( H.header.physical_max, 8);
-                               if ( H.label == SSignal::edf_annotations_label )
+                               if ( H.ucd.type() == 
sigfile::SChannel::TType::embedded_annotation )
                                        continue;
                                if ( sscanf( H.header.physical_max, "%8lg",
                                             &H.physical_max) != 1 ) {
@@ -714,7 +711,7 @@ _parse_header()
 
                        for ( auto &H : channels ) {
                                _get_next_field( H.header.digital_min, 8);
-                               if ( H.label == SSignal::edf_annotations_label )
+                               if ( H.ucd.type() == 
sigfile::SChannel::TType::embedded_annotation )
                                        continue;
                                if ( sscanf( H.header.digital_min, "%8d",
                                             &H.digital_min) != 1 ) {
@@ -725,7 +722,7 @@ _parse_header()
                        }
                        for ( auto &H : channels ) {
                                _get_next_field( H.header.digital_max, 8);
-                               if ( H.label == SSignal::edf_annotations_label )
+                               if ( H.ucd.type() == 
sigfile::SChannel::TType::embedded_annotation )
                                        continue;
                                if ( sscanf( H.header.digital_max, "%8d",
                                             &H.digital_max) != 1 ) {
@@ -765,7 +762,7 @@ _parse_header()
 
       // calculate gain
        for ( auto &H : channels )
-               if ( H.label != SSignal::edf_annotations_label ) {
+               if ( H.ucd.type() == 
sigfile::SChannel::TType::embedded_annotation ) {
                        if ( H.physical_max <= H.physical_min ||
                             H.digital_max  <= H.digital_min  ) {
                                _status |= nogain;
@@ -781,10 +778,11 @@ _parse_header()
       // determine & validate signal types
        i = 0;
        for ( auto &H : channels ) {
-               if ( H.label == SSignal::edf_annotations_label )
-                       H.signal_type = SChannel::TType::embedded_annotation;
+               if ( H.ucd.type() == 
sigfile::SChannel::TType::embedded_annotation )
+                       ;
                else {
-                       auto tt = agh::str::tokens( H.label, " ");
+                       ??? move this up right after SChannel ctor
+                       auto tt = agh::str::tokens( H.name, " ");
                        SChannel::TType figured_type;
                        // parse legacy pre 0.9 specs ("EEG F3" etc)
                        if ( tt.size() > 1 &&
@@ -792,12 +790,12 @@ _parse_header()
                             != SChannel::TType::other ) {
                                H.signal_type = figured_type;
                                H.signal_type_s = tt.front();
-                               H.label = (tt.pop_front(), agh::str::join( tt, 
" "));
-                               if ( not H.label.follows_system1020() )
+                               H.name = (tt.pop_front(), agh::str::join( tt, " 
"));
+                               if ( not H.name.follows_system1020() )
                                        _status |= non1020_channel;
                        } else {
                                H.signal_type_s = SChannel::kemp_signal_types[
-                                       H.signal_type = 
SChannel::signal_type_of_channel( H.label) ];
+                                       H.signal_type = 
SChannel::signal_type_of_channel( H.name) ];
 
                                if ( not H.label.follows_system1020() )
                                        _status |= non1020_channel;
@@ -839,7 +837,7 @@ int
 CEDFFile::
 _extract_embedded_annotations()
 {
-       auto S = find( channels.begin(), channels.end(), 
SSignal::edf_annotations_label);
+       auto S = find( channels.begin(), channels.end(), 
sigfile::edf_annotations_label);
        if ( S == channels.end() )
                return 0;
        auto& AH = *S;
diff --git a/src/libsigfile/edf.hh b/src/libsigfile/edf.hh
index 49a45d6..265986d 100644
--- a/src/libsigfile/edf.hh
+++ b/src/libsigfile/edf.hh
@@ -83,7 +83,7 @@ class CEDFFile
        CEDFFile (const string& fname, int flags = 0);
        // create new
        CEDFFile (const string& fname, TSubtype subtype_, int flags,
-                 const list<pair<string, size_t>>& channels,
+                 const list<pair<SChannel, size_t>>& channels,
                  size_t data_record_size = 1,
                  size_t n_data_records = 0);
        CEDFFile (CEDFFile&& rv);
@@ -135,53 +135,51 @@ class CEDFFile
                {
                        list<SChannel> ret;
                        for ( auto &H : channels )
-                               ret.push_back( H.label);
+                               ret.push_back( H.ucd);
                        return ret;
                }
        bool
-       have_channel( const string& h) const
+       have_channel( const SChannel& h) const
                { return find( channels.cbegin(), channels.cend(), h) != 
channels.cend(); }
        int
-       channel_id( const string& h) const
+       channel_id( const SChannel& h) const
                {
-                       for ( size_t i = 0; i < channels.size(); i++ )
-                               if ( channels[i].label == h )
+                       for ( size_t i = 0; i < channels.size(); ++i )
+                               if ( channels[i].ucd == h )
                                        return i;
                        return -1;
                }
-       const char*
+       const SChannel&
        channel_by_id( int h) const
                {
-                       if ( likely (h < (int)channels.size()) )
-                               return channels[h].label.c_str();
-                       return nullptr;
+                       return channels[h].ucd; // throws
                }
 
        SChannel::TType
        signal_type( int h) const
-               { return (*this)[h].signal_type; }
+               { return (*this)[h].ucd.type(); }
        SChannel::TType
-       signal_type( const string& h) const
-               { return (*this)[h].signal_type; }
+       signal_type( const SChannel& h) const
+               { return (*this)[h].ucd.type(); }
 
        size_t
        samplerate( int h) const
                { return (*this)[h].samples_per_record / data_record_size; }
        size_t
-       samplerate( const string& h) const
+       samplerate( const SChannel& h) const
                { return (*this)[h].samples_per_record / data_record_size; }
 
        list<SAnnotation>&
        annotations( int h)
                { return (*this)[h].annotations; }
        list<SAnnotation>&
-       annotations( const string& h)
+       annotations( const SChannel& h)
                { return (*this)[h].annotations; }
        const list<SAnnotation>&
        annotations( int h) const
                { return (*this)[h].annotations; }
        const list<SAnnotation>&
-       annotations( const string& h) const
+       annotations( const SChannel& h) const
                { return (*this)[h].annotations; }
 
        list<SAnnotation>&
@@ -196,13 +194,13 @@ class CEDFFile
        artifacts( int h)
                { return (*this)[h].artifacts; }
        SArtifacts&
-       artifacts( const string& h)
+       artifacts( const SChannel& h)
                { return (*this)[h].artifacts; }
        const SArtifacts&
        artifacts( int h) const
                { return (*this)[h].artifacts; }
        const SArtifacts&
-       artifacts( const string& h) const
+       artifacts( const SChannel& h) const
                { return (*this)[h].artifacts; }
 
        // filters
@@ -210,26 +208,26 @@ class CEDFFile
        filters( int h)
                { return (*this)[h].filters; }
        SFilterPack&
-       filters( const string& h)
+       filters( const SChannel& h)
                { return (*this)[h].filters; }
        const SFilterPack&
        filters( int h) const
                { return (*this)[h].filters; }
        const SFilterPack&
-       filters( const string& h) const
+       filters( const SChannel& h) const
                { return (*this)[h].filters; }
 
 
       // signal data extractors
-       template <class Th>  // accommodates int or const string& as Th
+       template <class Th>  // accommodates int or const SChannel& as Th
        valarray<TFloat>
        get_region_original_( Th h, size_t smpla, size_t smplz) const;
        valarray<TFloat>
        get_region_original( int h, size_t smpla, size_t smplz) const
                { return get_region_original_<int>( h, smpla, smplz); }
        valarray<TFloat>
-       get_region_original( const string& h, size_t smpla, size_t smplz) const
-               { return get_region_original_<const string&>( h, smpla, smplz); 
}
+       get_region_original( const SChannel& h, size_t smpla, size_t smplz) 
const
+               { return get_region_original_<const SChannel&>( h, smpla, 
smplz); }
 
        template <class Th>
        valarray<TFloat>
@@ -245,9 +243,9 @@ class CEDFFile
                             float timea, float timez) const
                { return get_region_original_<int>( h, timea, timez); }
        valarray<TFloat>
-       get_region_original( const string& h,
+       get_region_original( const SChannel& h,
                             float timea, float timez) const
-               { return get_region_original_<const string&>( h, timea, timez); 
}
+               { return get_region_original_<const SChannel&>( h, timea, 
timez); }
 
        template <class Th>
        valarray<TFloat>
@@ -257,7 +255,7 @@ class CEDFFile
        get_signal_original( int h) const
                { return get_signal_original_( h); }
        valarray<TFloat>
-       get_signal_original( const string& h) const
+       get_signal_original( const SChannel& h) const
                { return get_signal_original_( h); }
 
        template <class Th>
@@ -269,7 +267,7 @@ class CEDFFile
                             size_t smpla, size_t smplz) const
                { return get_region_filtered_( h, smpla, smplz); }
        valarray<TFloat>
-       get_region_filtered( const string& h,
+       get_region_filtered( const SChannel& h,
                             size_t smpla, size_t smplz) const
                { return get_region_filtered_( h, smpla, smplz); }
        template <class Th>
@@ -286,7 +284,7 @@ class CEDFFile
                             float timea, float timez) const
                { return get_region_filtered_( h, timea, timez); }
        valarray<TFloat>
-       get_region_filtered( const string& h,
+       get_region_filtered( const SChannel& h,
                             float timea, float timez) const
                { return get_region_filtered_( h, timea, timez); }
        template <class Th>
@@ -302,7 +300,7 @@ class CEDFFile
        put_region( int h, const valarray<TFloat>& src, size_t offset) const
                { return put_region_( h, src, offset); }
        int
-       put_region( const string& h, const valarray<TFloat>& src, size_t 
offset) const
+       put_region( const SChannel& h, const valarray<TFloat>& src, size_t 
offset) const
                { return put_region_( h, src, offset); }
 
        template <class Th>
@@ -320,12 +318,12 @@ class CEDFFile
        put_signal( int h, const valarray<TFloat>& src) const
                { return put_signal_( h, src); }
        int
-       put_signal( const string& h, const valarray<TFloat>& src) const
+       put_signal( const SChannel& h, const valarray<TFloat>& src) const
                { return put_signal_( h, src); }
 
       // signal data info
        pair<TFloat, TFloat>
-       get_real_original_signal_range( const string& h) const
+       get_real_original_signal_range( const SChannel& h) const
                { return get_real_original_signal_range( channel_id(h)); }
        pair<TFloat, TFloat>
        get_real_original_signal_range( int h) const
@@ -335,7 +333,7 @@ class CEDFFile
                }
 
        pair<TFloat, TFloat>
-       get_max_original_signal_range( const string& h) const
+       get_max_original_signal_range( const SChannel& h) const
                { return get_max_original_signal_range( channel_id(h)); }
        pair<TFloat, TFloat>
        get_max_original_signal_range( int h) const
@@ -343,7 +341,7 @@ class CEDFFile
 
 
        pair<TFloat, TFloat>
-       get_real_filtered_signal_range( const string& h) const
+       get_real_filtered_signal_range( const SChannel& h) const
                { return get_real_filtered_signal_range( channel_id(h)); }
        pair<TFloat, TFloat>
        get_real_filtered_signal_range( int h) const
@@ -353,7 +351,7 @@ class CEDFFile
                }
 
        pair<TFloat, TFloat>
-       get_max_filtered_signal_range( const string& h) const
+       get_max_filtered_signal_range( const SChannel& h) const
                { return get_max_filtered_signal_range( channel_id(h)); }
        pair<TFloat, TFloat>
        get_max_filtered_signal_range( int h) const
@@ -374,10 +372,10 @@ class CEDFFile
        export_filtered( int h, const string& fname) const
                { return export_filtered_( h, fname); }
        int
-       export_original( const string& h, const string& fname) const
+       export_original( const SChannel& h, const string& fname) const
                { return export_original_( h, fname); }
        int
-       export_filtered( const string& h, const string& fname) const
+       export_filtered( const SChannel& h, const string& fname) const
                { return export_filtered_( h, fname); }
        template <class Th>
        int export_original_( Th h, const string& fname) const;
@@ -429,12 +427,8 @@ class CEDFFile
                };
                SEDFSignalHeader
                        header;
-               string  signal_type_s; // although SChannel:: has all known 
types including "(unknown)", some
-                                      // users will freak out and want their 
own
-               SChannel::TType
-                       signal_type;
                SChannel
-                       label;
+                       ucd; // Universal Channel Designation, епта
                string  transducer_type,
                        physical_dim,
                        filtering_info,
@@ -449,9 +443,9 @@ class CEDFFile
                void set_digital_range( int16_t, int16_t);
                size_t  samples_per_record;
 
-               bool operator==( const string& h) const
+               bool operator==( const SChannel& h) const
                        {
-                               return label == h;
+                               return ucd.name() == h.name();
                        }
 
                list<SAnnotation>
@@ -484,14 +478,14 @@ class CEDFFile
                                throw out_of_range ("Signal index out of 
range");
                        return channels[i];
                }
-       SSignal& operator[]( const string& h)
+       SSignal& operator[]( const SChannel& h)
                {
                        auto S = find( channels.begin(), channels.end(), h);
                        if ( S == channels.end() )
-                               throw out_of_range (string ("Unknown channel ") 
+ h);
+                               throw out_of_range (string ("Unknown channel ") 
+ h.name());
                        return *S;
                }
-       const SSignal& operator[]( const string& h) const
+       const SSignal& operator[]( const SChannel& h) const
                {
                        return (*const_cast<CEDFFile*>(this)) [h];
                }
diff --git a/src/libsigfile/edf.ii b/src/libsigfile/edf.ii
index f547d45..390cd0a 100644
--- a/src/libsigfile/edf.ii
+++ b/src/libsigfile/edf.ii
@@ -11,13 +11,13 @@
 
 
 extern template valarray<TFloat> CEDFFile::get_region_original_( int, size_t, 
size_t) const;
-extern template valarray<TFloat> CEDFFile::get_region_original_( const 
string&, size_t, size_t) const;
+extern template valarray<TFloat> CEDFFile::get_region_original_( const 
SChannel&, size_t, size_t) const;
 extern template valarray<TFloat> CEDFFile::get_region_filtered_( int, size_t, 
size_t) const;
-extern template valarray<TFloat> CEDFFile::get_region_filtered_( const 
string&, size_t, size_t) const;
+extern template valarray<TFloat> CEDFFile::get_region_filtered_( const 
SChannel&, size_t, size_t) const;
 extern template int CEDFFile::put_region_( int, const valarray<TFloat>&, 
size_t) const;
-extern template int CEDFFile::put_region_( const string&, const 
valarray<TFloat>&, size_t) const;
+extern template int CEDFFile::put_region_( const SChannel&, const 
valarray<TFloat>&, size_t) const;
 extern template int CEDFFile::export_original_( int, const string&) const;
-extern template int CEDFFile::export_original_( const string&, const string&) 
const;
+extern template int CEDFFile::export_original_( const SChannel&, const 
string&) const;
 
 
 template <typename A>
diff --git a/src/libsigfile/source-base.hh b/src/libsigfile/source-base.hh
index 9357e89..5d9be26 100644
--- a/src/libsigfile/source-base.hh
+++ b/src/libsigfile/source-base.hh
@@ -38,14 +38,14 @@ inline string
 make_fname_artifacts( const string& _filename, const SChannel& channel)
 {
        return agh::fs::make_fname_base( _filename, ".edf", true)
-               + "-" + channel + ".af";
+               + "-" + channel.name() + ".af";
 }
 
 inline string
 make_fname_annotations( const string& _filename, const SChannel& channel)
 {
        return agh::fs::make_fname_base( _filename, ".edf", true)
-               + "-" + channel + ".annotations";
+               + "-" + channel.name() + ".annotations";
 }
 
 inline string
@@ -237,23 +237,23 @@ class CSource {
       // channels
        virtual size_t n_channels()                     const = 0;
        virtual list<SChannel> channel_list()           const = 0;
-       virtual bool have_channel( const string&)       const = 0;
-       virtual int channel_id( const string&)          const = 0;
-       virtual const char* channel_by_id( int)         const = 0;
+       virtual bool have_channel( const SChannel&)     const = 0;
+       virtual int channel_id( const SChannel&)        const = 0;
+       virtual const SChannel& channel_by_id( int)     const = 0;
        virtual SChannel::TType
-       signal_type( const string&)                     const = 0;
+       signal_type( const SChannel&)                   const = 0;
        virtual SChannel::TType
        signal_type( int)                               const = 0;
-       virtual size_t samplerate( const string&)       const = 0;
+       virtual size_t samplerate( const SChannel&)     const = 0;
        virtual size_t samplerate( int)                 const = 0;
 
        // the following methods are pass-through:
        // 1. annotations
        // (a) per-channel
        virtual list<SAnnotation>&
-       annotations( const string&)                   = 0;
+       annotations( const SChannel&)                 = 0;
        virtual const list<SAnnotation>&
-       annotations( const string&) const             = 0;
+       annotations( const SChannel&) const           = 0;
        virtual list<SAnnotation>&
        annotations( int)                             = 0;
        virtual const list<SAnnotation>&
@@ -267,21 +267,21 @@ class CSource {
 
        // artifacts
        virtual SArtifacts&
-       artifacts( const string&)                     = 0;
+       artifacts( const SChannel&)                   = 0;
        virtual SArtifacts&
        artifacts( int)                               = 0;
        virtual const SArtifacts&
-       artifacts( const string&)               const = 0;
+       artifacts( const SChannel&)             const = 0;
        virtual const SArtifacts&
        artifacts( int)                         const = 0;
 
        // filters
        virtual SFilterPack&
-       filters( const string&)                       = 0;
+       filters( const SChannel&)                             = 0;
        virtual SFilterPack&
        filters( int)                                 = 0;
        virtual const SFilterPack&
-       filters( const string&)                 const = 0;
+       filters( const SChannel&)                       const = 0;
        virtual const SFilterPack&
        filters( int)                           const = 0;
 
@@ -303,9 +303,9 @@ class CSource {
       // get samples
        // original
        virtual valarray<TFloat>
-       get_region_original( const string& h, size_t, size_t) const = 0;
+       get_region_original( const SChannel&, size_t, size_t) const = 0;
        virtual valarray<TFloat>
-       get_region_original( int h, size_t, size_t) const = 0;
+       get_region_original( int, size_t, size_t) const = 0;
 
        template <typename T>
        valarray<TFloat>
@@ -331,7 +331,7 @@ class CSource {
 
        // filtered
        virtual valarray<TFloat>
-       get_region_filtered( const string& h, size_t, size_t) const = 0;
+       get_region_filtered( const SChannel& h, size_t, size_t) const = 0;
        virtual valarray<TFloat>
        get_region_filtered( int h, size_t, size_t) const = 0;
 
@@ -363,7 +363,7 @@ class CSource {
                    const valarray<TFloat>& src,
                    size_t offset)              const = 0;
        virtual int
-       put_region( const string& h,
+       put_region( const SChannel& h,
                    const valarray<TFloat>& src,
                    size_t offset)              const = 0;
 
@@ -374,7 +374,7 @@ class CSource {
                        return put_region( h, src, 0);
                }
        int
-       put_signal( const string& h,
+       put_signal( const SChannel& h,
                    const valarray<TFloat>& src)
                {
                        return put_region( h, src, 0);
@@ -387,7 +387,7 @@ class CSource {
        virtual pair<TFloat, TFloat>
        get_real_original_signal_range( int) const = 0;
        virtual pair<TFloat, TFloat>
-       get_real_original_signal_range( const string&) const = 0;
+       get_real_original_signal_range( const SChannel&) const = 0;
 
        template <typename T>
        pair<TFloat, TFloat>
@@ -395,7 +395,7 @@ class CSource {
        virtual pair<TFloat, TFloat>
        get_max_original_signal_range( int) const = 0;
        virtual pair<TFloat, TFloat>
-       get_max_original_signal_range( const string&) const = 0;
+       get_max_original_signal_range( const SChannel&) const = 0;
 
        template <typename T>
        pair<TFloat, TFloat>
@@ -403,7 +403,7 @@ class CSource {
        virtual pair<TFloat, TFloat>
        get_real_filtered_signal_range( int) const = 0;
        virtual pair<TFloat, TFloat>
-       get_real_filtered_signal_range( const string&) const = 0;
+       get_real_filtered_signal_range( const SChannel&) const = 0;
 
        template <typename T>
        pair<TFloat, TFloat>
@@ -411,17 +411,17 @@ class CSource {
        virtual pair<TFloat, TFloat>
        get_max_filtered_signal_range( int) const = 0;
        virtual pair<TFloat, TFloat>
-       get_max_filtered_signal_range( const string&) const = 0;
+       get_max_filtered_signal_range( const SChannel&) const = 0;
 
       // export
        virtual int
        export_original( int, const string& fname) const = 0;
        virtual int
-       export_original( const string&, const string& fname) const = 0;
+       export_original( const SChannel&, const string& fname) const = 0;
        virtual int
        export_filtered( int, const string& fname) const = 0;
        virtual int
-       export_filtered( const string&, const string& fname) const = 0;
+       export_filtered( const SChannel&, const string& fname) const = 0;
 
       // filenames
        string make_fname_artifacts( const SChannel& channel) const
diff --git a/src/metrics/mc.cc b/src/metrics/mc.cc
index 9d210c1..7e0e55d 100644
--- a/src/metrics/mc.cc
+++ b/src/metrics/mc.cc
@@ -76,7 +76,7 @@ fname_base() const
        ASPRINTF( &_,
                  "%s.%s-%lu"
                  ":%zu-%g_%g" "_%g" "_%g_%g",
-                 _using_F().filename(), 
_using_F().channel_by_id(_using_sig_no),
+                 _using_F().filename(), 
_using_F().channel_by_id(_using_sig_no).name(),
                  _using_F().dirty_signature( _using_sig_no),
                  Pp.pagesize,
                  Pp.scope,
@@ -97,7 +97,7 @@ mirror_fname() const
                  "%s-%s-%lu"
                  ":%zu-%g_%g" "_%g" "_%g_%g" "_%g_%g@%zu"
                  ".mc",
-                 basename_dot.c_str(), _using_F().channel_by_id(_using_sig_no),
+                 basename_dot.c_str(), 
_using_F().channel_by_id(_using_sig_no).name(),
                  _using_F().dirty_signature( _using_sig_no),
                  Pp.pagesize,
                  Pp.scope,
@@ -164,7 +164,7 @@ export_tsv( const string& fname) const
                 "#Page\t",
                 _using_F().subject().name.c_str(), _using_F().session(), 
_using_F().episode(),
                 (int)strlen(asctime_)-1, asctime_,
-                _using_F().channel_by_id(_using_sig_no),
+                _using_F().channel_by_id(_using_sig_no).name(),
                 pages(), Pp.pagesize, Pp.freq_from, Pp.freq_from + 
Pp.bandwidth * bins(), Pp.bandwidth);
 
        for ( bin = 0; bin < _bins; ++bin, bum += Pp.bandwidth )
@@ -198,7 +198,7 @@ export_tsv( size_t bin,
                 "## Course (%zu %zu-sec pages) in range %g-%g Hz\n",
                 _using_F().subject().name.c_str(), _using_F().session(), 
_using_F().episode(),
                 (int)strlen(asctime_)-1, asctime_,
-                _using_F().channel_by_id(_using_sig_no),
+                _using_F().channel_by_id(_using_sig_no).name(),
                 pages(), Pp.pagesize, Pp.freq_from, Pp.freq_from + (bin+1) * 
Pp.bandwidth);
 
        for ( size_t p = 0; p < pages(); ++p )
@@ -221,9 +221,6 @@ const size_t sssu_hist_size = 100;
 
 
 // Local Variables:
-// Local Variables:
 // Mode: c++
 // indent-tabs-mode: 8
 // End:
-// indent-tabs-mode: 8
-// End:
diff --git a/src/metrics/page-metrics-base.cc b/src/metrics/page-metrics-base.cc
index cd949b3..770c15a 100644
--- a/src/metrics/page-metrics-base.cc
+++ b/src/metrics/page-metrics-base.cc
@@ -218,7 +218,7 @@ export_tsv( const string& fname) const
                 "#Page\t",
                 _using_F().subject().name.c_str(), _using_F().session(), 
_using_F().episode(),
                 (int)strlen(asctime_)-1, asctime_,
-                _using_F().channel_by_id(_using_sig_no));
+                _using_F().channel_by_id(_using_sig_no).name());
 
        for ( bin = 0; bin < _bins; ++bin )
                fprintf( f, "%zu%c", bin, bin+1 == _bins ? '\n' : '\t');
diff --git a/src/metrics/psd.cc b/src/metrics/psd.cc
index 50cc355..fa58057 100644
--- a/src/metrics/psd.cc
+++ b/src/metrics/psd.cc
@@ -100,7 +100,7 @@ fname_base() const
        ASPRINTF( &_,
                  "%s.%s-%lu"
                  ":%zu-%g-%c%c",
-                 _using_F().filename(), 
_using_F().channel_by_id(_using_sig_no),
+                 _using_F().filename(), 
_using_F().channel_by_id(_using_sig_no).name(),
                  _using_F().dirty_signature( _using_sig_no),
                  Pp.pagesize, Pp.binsize,
                  'a'+(char)Pp.welch_window_type, 'a'+(char)Pp.plan_type);
@@ -120,7 +120,7 @@ mirror_fname() const
                  "%s.%s-%lu"
                  ":%zu-%g-%c%c@%zu"
                  ".psd",
-                 basename_dot.c_str(), _using_F().channel_by_id(_using_sig_no),
+                 basename_dot.c_str(), 
_using_F().channel_by_id(_using_sig_no).name(),
                  _using_F().dirty_signature( _using_sig_no),
                  Pp.pagesize, Pp.binsize,
                  'a'+(char)Pp.welch_window_type, 'a'+(char)Pp.plan_type,
@@ -267,7 +267,7 @@ export_tsv( const string& fname) const
                 "#Page\t",
                 _using_F().subject().name.c_str(), _using_F().session(), 
_using_F().episode(),
                 (int)strlen(asctime_)-1, asctime_,
-                _using_F().channel_by_id(_using_sig_no),
+                _using_F().channel_by_id(_using_sig_no).name(),
                 pages(), Pp.pagesize, _bins*Pp.binsize, Pp.binsize);
 
        for ( bin = 0; bin < _bins; ++bin, bum += Pp.binsize )
@@ -303,7 +303,7 @@ export_tsv( float from, float upto,
                 "## Course (%zu %zu-sec pages) in range %g-%g Hz\n",
                 _using_F().subject().name.c_str(), _using_F().session(), 
_using_F().episode(),
                 (int)strlen(asctime_)-1, asctime_,
-                _using_F().channel_by_id(_using_sig_no),
+                _using_F().channel_by_id(_using_sig_no).name(),
                 pages(), Pp.pagesize, from, upto);
 
        valarray<TFloat> crs = course( from, upto);
diff --git a/src/metrics/swu.cc b/src/metrics/swu.cc
index efe7c26..14eeb07 100644
--- a/src/metrics/swu.cc
+++ b/src/metrics/swu.cc
@@ -66,7 +66,7 @@ fname_base() const
        ASPRINTF( &_,
                  "%s.%s-%lu"
                  ":%zu-%g",
-                 _using_F().filename(), 
_using_F().channel_by_id(_using_sig_no),
+                 _using_F().filename(), 
_using_F().channel_by_id(_using_sig_no).name(),
                  _using_F().dirty_signature( _using_sig_no),
                  Pp.pagesize, Pp.min_upswing_duration);
        string ret {_};
@@ -84,7 +84,7 @@ mirror_fname() const
                  "%s.%s-%lu"
                  ":%zu-%g@%zu"
                  ".swu",
-                 basename_dot.c_str(), _using_F().channel_by_id(_using_sig_no),
+                 basename_dot.c_str(), 
_using_F().channel_by_id(_using_sig_no).name(),
                  _using_F().dirty_signature( _using_sig_no),
                  Pp.pagesize, Pp.min_upswing_duration,
                  sizeof(TFloat));
@@ -157,7 +157,7 @@ export_tsv( const string& fname) const
                 "#Page\tSWU\n",
                 _using_F().subject().name.c_str(), _using_F().session(), 
_using_F().episode(),
                 (int)strlen(asctime_)-1, asctime_,
-                _using_F().channel_by_id(_using_sig_no),
+                _using_F().channel_by_id(_using_sig_no).name(),
                 pages(), Pp.pagesize);
 
        for ( size_t p = 0; p < pages(); ++p )
diff --git a/src/tools/edfcat.cc b/src/tools/edfcat.cc
index 32d1f4b..40fbdd4 100644
--- a/src/tools/edfcat.cc
+++ b/src/tools/edfcat.cc
@@ -188,10 +188,10 @@ figure_channels( const list<string>& argv) throw 
(invalid_argument)
 
 
 
-list<pair<string, size_t>>
+list<pair<sigfile::SChannel, size_t>>
 make_channel_headers_for_CEDFFile( size_t n, const char *fmt, size_t 
samplerate)
 {
-       list<pair<string, size_t>> ret;
+       list<pair<sigfile::SChannel, size_t>> ret;
        for ( size_t i = 0; i < n; ++i ) {
                DEF_UNIQUE_CHARP (_);
                ret.emplace_back( (ASPRINTF( &_, fmt, i), _), samplerate);
@@ -366,7 +366,7 @@ exec_prune( const SOperation::SObject& obj)
 {
        sigfile::CEDFFile F (obj.c_str(), 
sigfile::CTypedSource::no_ancillary_files);
 
-       list<pair<string, size_t>> selected_channels;
+       list<pair<sigfile::SChannel, size_t>> selected_channels;
        for ( auto& select_this : obj.channels ) {
                if ( select_this >= F.n_channels() ) {
                        DEF_UNIQUE_CHARP (_);
diff --git a/src/ui/mw/loadsave.cc b/src/ui/mw/loadsave.cc
index dc01488..960edcc 100644
--- a/src/ui/mw/loadsave.cc
+++ b/src/ui/mw/loadsave.cc
@@ -146,7 +146,7 @@ load_settings()
        _AghDi = find( AghDD.begin(), AghDD.end(), _aghdd_placeholder);
        if ( _AghDi == AghDD.end() )
                _AghDi = AghDD.begin();
-       _AghTi = find( AghTT.begin(), AghTT.end(), _aghtt_placeholder);
+       _AghTi = find( AghTT.begin(), AghTT.end(), sigfile::SChannel 
(_aghtt_placeholder));
        if ( _AghTi == AghTT.end() )
                _AghTi = AghTT.begin();
 

-- 
Sleep experiment manager

_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to