[med-svn] [SCM] aghermann branch, master, updated. 99b1d5a023eee9df74b0e0d6f894516fc79435ad

Andrei Zavada johnhommer at gmail.com
Sun Jul 7 23:04:03 UTC 2013


The following commit has been merged in the master branch:
commit 7f8d17a2472338be8930a3a4d44f4b648e910cb4
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Wed Jun 26 10:45:18 2013 +0300

    WIP

diff --git a/src/common/subject_id.cc b/src/common/subject_id.cc
index 5f25005..cc28ebc 100644
--- a/src/common/subject_id.cc
+++ b/src/common/subject_id.cc
@@ -59,7 +59,8 @@ gender_sign( TGender g)
 
 namespace {
 
-int str_to_english_month( const string& s)
+int
+str_to_english_month( const string& s)
 {
 	if ( strcasecmp( s.c_str(), "jan") == 0 )
 		return 0;
@@ -88,6 +89,26 @@ int str_to_english_month( const string& s)
 	else
 		return -1;
 }
+
+const char*
+english_month_to_str( int m)
+{
+	switch ( m ) {
+	case  0: return "jan";
+	case  1: return "feb";
+	case  2: return "mar";
+	case  3: return "apr";
+	case  4: return "may";
+	case  5: return "jun";
+	case  6: return "jul";
+	case  7: return "aug";
+	case  8: return "sep";
+	case  9: return "oct";
+	case 10: return "nov";
+	case 11: return "dec";
+	default: return "---";
+	}
+}
 }
 
 
@@ -116,6 +137,16 @@ str_to_dob( const string& s)
 	}
 }
 
+string
+SSubjectId::
+str_to_dob( const time_t t_)
+{
+	struct tm t;
+	memset( &t, '\0', sizeof (t));
+
+	
+}
+
 
 
 int
diff --git a/src/common/subject_id.hh b/src/common/subject_id.hh
index 49fda92..8080c01 100644
--- a/src/common/subject_id.hh
+++ b/src/common/subject_id.hh
@@ -15,7 +15,7 @@
 #include <ctime>
 
 #include <string>
-#include <cstring>
+#include "common/string.hh"
 
 #if HAVE_CONFIG_H && !defined(VERSION)
 #  include "config.h"
@@ -75,9 +75,18 @@ struct SSubjectId {
 		}
 	int update_from( const SSubjectId&);
 
+	string make_recording_id() const
+		{
+			return agh::str::sasprintf(
+				"%s %c %s %s",
+				id.c_str(), gender_sign(), dob_to_str(),
+				name.c_str());
+		}
+
 	static char gender_sign( TGender);
 	static TGender char_to_gender( char);
 	static time_t str_to_dob( const string&);
+	static string dob_to_str( time_t);
 };
 
 } // namespace agh
diff --git a/src/libsigfile/edf.cc b/src/libsigfile/edf.cc
index 5aee4ee..9b3b469 100644
--- a/src/libsigfile/edf.cc
+++ b/src/libsigfile/edf.cc
@@ -227,7 +227,10 @@ CEDFFile (const string& fname_, const TSubtype subtype_, const int flags_,
 	_lay_out_header();
 
 	strncpy( header.version_number, version_string, 8);
-	_subject.id = "Fafa_1";
+
+	_subject {"Fafa_1", "Mr. Fafa"};
+	set_patient_id( _subject.make_recording_id());
+
 	set_recording_id( "Zzz");
 	set_comment( fname_);
 	set_start_time( time(NULL));

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list