From ae2cb136b731a3789322f4834cf5d80ea10616c2 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Thu, 2 Jun 2011 15:18:25 +1000 Subject: [PATCH] Removed the last of C++0x --- SleepyHead.depend | 12 ++-- SleepyHeadApp.cpp | 1 + libs/sleeplib/machine.cpp | 131 ++++++++++++++++++++++------------ libs/sleeplib/machine.h | 28 ++++---- libs/sleeplib/profiles.cpp | 4 +- libs/sleeplib/prs1_loader.cpp | 76 +++++++++++--------- version.h | 12 ++-- 7 files changed, 159 insertions(+), 105 deletions(-) diff --git a/SleepyHead.depend b/SleepyHead.depend index 7054b4bf..0ccdd156 100644 --- a/SleepyHead.depend +++ b/SleepyHead.depend @@ -7815,7 +7815,7 @@ -1306810322 source:/home/mark/projects/git/sleepyhead/SleepyHeadApp.cpp +1306990964 source:/home/mark/projects/git/sleepyhead/SleepyHeadApp.cpp "wx_pch.h" @@ -7838,7 +7838,7 @@ "sleeplib/machine.h" "graphs/graph.h" -1306984890 /home/mark/projects/git/sleepyhead/libs/sleeplib/machine.h +1306991807 /home/mark/projects/git/sleepyhead/libs/sleeplib/machine.h @@ -7876,7 +7876,7 @@ -1306989702 /home/mark/projects/git/sleepyhead/version.h +1306991808 /home/mark/projects/git/sleepyhead/version.h 1306724655 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h "machine.h" @@ -7927,7 +7927,7 @@ -1306988397 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp +1306991808 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp @@ -7948,7 +7948,7 @@ "preferences.h" -1306989333 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/profiles.cpp +1306990963 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/profiles.cpp @@ -7960,7 +7960,7 @@ "machine_loader.h" "tinyxml/tinyxml.h" -1306989439 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.cpp +1306991577 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.cpp diff --git a/SleepyHeadApp.cpp b/SleepyHeadApp.cpp index 30ff1f40..3ff0556a 100644 --- a/SleepyHeadApp.cpp +++ b/SleepyHeadApp.cpp @@ -42,6 +42,7 @@ bool SleepyHeadApp::OnInit() wxInitAllImageHandlers(); //wxDateTime::SetCountry(wxDateTime::USA); + SetAppName(_("SleepyHead")); PRS1Loader::Register(); Profiles::Scan(); diff --git a/libs/sleeplib/machine.cpp b/libs/sleeplib/machine.cpp index 81a95e17..dc3cbbad 100644 --- a/libs/sleeplib/machine.cpp +++ b/libs/sleeplib/machine.cpp @@ -12,54 +12,29 @@ extern wxProgressDialog *loader_progress; map MachList; -map MachineTypeString= { +/*map MachineTypeString= { {MT_UNKNOWN, wxT("Unknown")}, {MT_CPAP, wxT("CPAP")}, {MT_OXIMETER, wxT("Oximeter")}, {MT_SLEEPSTAGE, wxT("SleepStage")} -}; +}; */ -map MachineTypeLookup= { +/*map MachineTypeLookup= { { MachineTypeString[MT_UNKNOWN].Lower(), MT_UNKNOWN }, { MachineTypeString[MT_CPAP].Lower(), MT_CPAP }, { MachineTypeString[MT_OXIMETER].Lower(), MT_OXIMETER }, { MachineTypeString[MT_SLEEPSTAGE].Lower(), MT_SLEEPSTAGE} -}; - -// This is technically gui related.. however I have something in mind for it. -const map DefaultFlagTypes= { - {CPAP_Obstructive, FT_BAR}, - {CPAP_Hypopnea, FT_BAR}, - {CPAP_RERA, FT_BAR}, - {CPAP_VSnore, FT_BAR}, - {PRS1_VSnore2, FT_BAR}, - {CPAP_FlowLimit, FT_BAR}, - {CPAP_ClearAirway, FT_BAR}, - {CPAP_CSR, FT_SPAN}, - {PRS1_PressurePulse,FT_DOT}, - {CPAP_Pressure, FT_DOT} -}; - -const unsigned char flagalpha=0x80; -const map DefaultFlagColours= { - {CPAP_Obstructive, wxColour(0x80,0x80,0xff,flagalpha)}, - {CPAP_Hypopnea, wxColour(0x00,0x00,0xff,flagalpha)}, - {CPAP_RERA, wxColour(0x40,0x80,0xff,flagalpha)}, - {CPAP_VSnore, wxColour(0xff,0x20,0x20,flagalpha)}, - {CPAP_FlowLimit, wxColour(0x20,0x20,0x20,flagalpha)}, - {CPAP_ClearAirway, wxColour(0xff,0x40,0xff,flagalpha)}, - {CPAP_CSR, wxColour(0x40,0xff,0x40,flagalpha)}, - {PRS1_VSnore2, wxColour(0xff,0x20,0x20,flagalpha)}, - {PRS1_PressurePulse,wxColour(0xff,0x40,0xff,flagalpha)} -}; -map CPAPModeNames={ +}; */ +map CPAPModeNames; +/*={ {MODE_UNKNOWN,wxT("Undetermined")}, {MODE_CPAP,wxT("CPAP")}, {MODE_APAP,wxT("APAP")}, {MODE_BIPAP,wxT("BIPAP")}, {MODE_ASV,wxT("ASV")} -}; -map PressureReliefNames={ +};*/ +map PressureReliefNames; +/*={ {PR_UNKNOWN,_("Undetermined")}, {PR_NONE,_("None")}, {PR_CFLEX,wxT("C-Flex")}, @@ -68,10 +43,13 @@ map PressureReliefNames={ {PR_BIFLEX,wxT("Bi-Flex")}, {PR_EPR,wxT("Exhalation Pressure Relief (EPR)")}, {PR_SMARTFLEX,wxT("SmartFlex")} -}; +}; */ + + // Master list. Look up local name table first.. then these if not found. -map DefaultMCShortNames= { +map DefaultMCShortNames; +/*= { {CPAP_Obstructive, wxT("OA")}, {CPAP_Hypopnea, wxT("H")}, {CPAP_RERA, wxT("RE")}, @@ -102,8 +80,71 @@ map DefaultMCLongNames= { {CPAP_IAP, wxT("BIPAP Inhalation Pressure")}, {PRS1_VSnore2, wxT("Vibratory Snore")}, {PRS1_PressurePulse,wxT("Pressue Pulse")} +}; */ + +void InitMapsWithoutAwesomeInitializerLists() +{ + CPAPModeNames[MODE_UNKNOWN]=wxT("Undetermined"); + CPAPModeNames[MODE_CPAP]=wxT("CPAP"); + CPAPModeNames[MODE_APAP]=wxT("APAP"); + CPAPModeNames[MODE_BIPAP]=wxT("BIPAP"); + CPAPModeNames[MODE_ASV]=wxT("ASV"); + + PressureReliefNames[PR_UNKNOWN]=_("Undetermined"); + PressureReliefNames[PR_NONE]=_("None"); + PressureReliefNames[PR_CFLEX]=wxT("C-Flex"); + PressureReliefNames[PR_CFLEXPLUS]=wxT("C-Flex+"); + PressureReliefNames[PR_AFLEX]=wxT("A-Flex"); + PressureReliefNames[PR_BIFLEX]=wxT("Bi-Flex"); + PressureReliefNames[PR_EPR]=wxT("Exhalation Pressure Relief (EPR)"); + PressureReliefNames[PR_SMARTFLEX]=wxT("SmartFlex"); + + DefaultMCShortNames[CPAP_Obstructive]=wxT("OA"); + DefaultMCShortNames[CPAP_Hypopnea]=wxT("H"); + DefaultMCShortNames[CPAP_RERA]=wxT("RE"); + DefaultMCShortNames[CPAP_ClearAirway]=wxT("CA"); + DefaultMCShortNames[CPAP_CSR]=wxT("CSR"); + DefaultMCShortNames[CPAP_VSnore]=wxT("VS"); + DefaultMCShortNames[CPAP_FlowLimit]=wxT("FL"); + DefaultMCShortNames[CPAP_Pressure]=wxT("P"); + DefaultMCShortNames[CPAP_Leak]=wxT("LR"); + DefaultMCShortNames[CPAP_EAP]=wxT("EAP"); + DefaultMCShortNames[CPAP_IAP]=wxT("IAP"); + DefaultMCShortNames[PRS1_VSnore2]=wxT("VS"); + DefaultMCShortNames[PRS1_PressurePulse]=wxT("PP"); + +} + + + +// This is technically gui related.. however I have something in mind for it. +/*const map DefaultFlagTypes= { + {CPAP_Obstructive, FT_BAR}, + {CPAP_Hypopnea, FT_BAR}, + {CPAP_RERA, FT_BAR}, + {CPAP_VSnore, FT_BAR}, + {PRS1_VSnore2, FT_BAR}, + {CPAP_FlowLimit, FT_BAR}, + {CPAP_ClearAirway, FT_BAR}, + {CPAP_CSR, FT_SPAN}, + {PRS1_PressurePulse,FT_DOT}, + {CPAP_Pressure, FT_DOT} }; +const unsigned char flagalpha=0x80; +const map DefaultFlagColours= { + {CPAP_Obstructive, wxColour(0x80,0x80,0xff,flagalpha)}, + {CPAP_Hypopnea, wxColour(0x00,0x00,0xff,flagalpha)}, + {CPAP_RERA, wxColour(0x40,0x80,0xff,flagalpha)}, + {CPAP_VSnore, wxColour(0xff,0x20,0x20,flagalpha)}, + {CPAP_FlowLimit, wxColour(0x20,0x20,0x20,flagalpha)}, + {CPAP_ClearAirway, wxColour(0xff,0x40,0xff,flagalpha)}, + {CPAP_CSR, wxColour(0x40,0xff,0x40,flagalpha)}, + {PRS1_VSnore2, wxColour(0xff,0x20,0x20,flagalpha)}, + {PRS1_PressurePulse,wxColour(0xff,0x40,0xff,flagalpha)} +}; */ + + ////////////////////////////////////////////////////////////////////////////////////////// // Machine Base-Class implmementation ////////////////////////////////////////////////////////////////////////////////////////// @@ -611,14 +652,12 @@ void Day::OpenWaveforms() ////////////////////////////////////////////////////////////////////////////////////////// // Event implmementation ////////////////////////////////////////////////////////////////////////////////////////// -Event::Event(wxDateTime time,MachineCode code,list data) +Event::Event(wxDateTime time,MachineCode code, EventDataType * data, int fields) :e_time(time),e_code(code) { - e_fields=0; - list::iterator i; - for (i=data.begin(); i!=data.end(); i++) { - e_data.push_back(*i); - e_fields++; + e_fields=fields; + for (int i=0; i ED; + EventDataType ED[max_number_event_fields]; for (int c=0; c PressureReliefNames; extern map CPAPModeNames; // These are types supported by wxVariant class. To retain compatability, add to the end of this list only.. -enum MCDataType: -wxInt8 { MC_bool=0, MC_long, MC_float, MC_double, MC_string, MC_datetime }; +enum MCDataType//:wxInt8 +{ MC_bool=0, MC_long, MC_float, MC_double, MC_string, MC_datetime }; typedef wxInt16 SampleFormat; typedef float EventDataType; @@ -196,7 +200,7 @@ class Event { friend class Session; public: - Event(wxDateTime time,MachineCode code,list data); + Event(wxDateTime time,MachineCode code,EventDataType * data,int fields); ~Event(); const EventDataType operator[](short i) { if (i::iterator i=machlist.begin(); i!=machlist.end(); i++) { - delete i->second; + delete i->second; } } void Profile::LoadMachineData() @@ -235,6 +235,8 @@ Profile *Get() void Scan() { + InitMapsWithoutAwesomeInitializerLists(); + p_pref=new Preferences(wxT("Preferences")); p_layout=new Preferences(wxT("Layout")); diff --git a/libs/sleeplib/prs1_loader.cpp b/libs/sleeplib/prs1_loader.cpp index 22ab6c33..1fc8ea53 100644 --- a/libs/sleeplib/prs1_loader.cpp +++ b/libs/sleeplib/prs1_loader.cpp @@ -22,11 +22,7 @@ License: GPL extern wxProgressDialog *loader_progress; -map ModelMap= { - {34,wxT("RemStar Pro with C-Flex+")}, - {35,wxT("RemStar Auto with A-Flex")}, - {37,wxT("RemStar BIPAP Auto with Bi-Flex")} -}; +map ModelMap; PRS1::PRS1(Profile *p,MachineID id):CPAP(p,id) { @@ -34,7 +30,7 @@ PRS1::PRS1(Profile *p,MachineID id):CPAP(p,id) properties[wxT("Brand")]=wxT("Philips Respironics"); properties[wxT("Model")]=wxT("System One"); - SleepFlags= { CPAP_RERA, PRS1_VSnore2, CPAP_FlowLimit, CPAP_Hypopnea, CPAP_Obstructive, CPAP_ClearAirway, CPAP_CSR }; + //SleepFlags= { CPAP_RERA, PRS1_VSnore2, CPAP_FlowLimit, CPAP_Hypopnea, CPAP_Obstructive, CPAP_ClearAirway, CPAP_CSR }; } PRS1::~PRS1() { @@ -469,11 +465,15 @@ bool PRS1Loader::OpenSummary(Session *session,wxString filename) bool PRS1Loader::Parse002(Session *session,unsigned char *buffer,int size,time_t timestamp) { - vector Codes= { + MachineCode Codes[]={ PRS1_Unknown00, PRS1_Unknown01, CPAP_Pressure, CPAP_EAP, PRS1_PressurePulse, CPAP_RERA, CPAP_Obstructive, CPAP_ClearAirway, PRS1_Unknown08, PRS1_Unknown09, CPAP_Hypopnea, PRS1_Unknown0B, CPAP_FlowLimit, CPAP_VSnore, PRS1_Unknown0E, CPAP_CSR, PRS1_Unknown10, CPAP_Leak, PRS1_Unknown12 }; + int ncodes=sizeof(Codes)/sizeof(MachineCode); + + EventDataType data[4]; + wxDateTime start; start.Set(timestamp); wxDateTime t=start; @@ -496,12 +496,12 @@ bool PRS1Loader::Parse002(Session *session,unsigned char *buffer,int size,time_t case 0x00: // Unknown case 0x01: // Unknown case 0x02: // Pressure - data0=buffer[pos++]/10.0; - session->AddEvent(new Event(t,cpapcode, {data0})); + data[0]=buffer[pos++]/10.0; + session->AddEvent(new Event(t,cpapcode, data,1)); break; case 0x04: // Pressure Pulse - data0=buffer[pos++]; - session->AddEvent(new Event(t,cpapcode, {data0})); + data[0]=buffer[pos++]; + session->AddEvent(new Event(t,cpapcode, data,1)); break; case 0x05: // RERA @@ -510,50 +510,50 @@ bool PRS1Loader::Parse002(Session *session,unsigned char *buffer,int size,time_t case 0x0a: // Hypopnea case 0x0c: // Flow Limitation tt-=wxTimeSpan::Seconds((buffer[pos++])); // Subtract Time Offset - session->AddEvent(new Event(tt,cpapcode, {})); + session->AddEvent(new Event(tt,cpapcode,data,0)); break; case 0x0d: // Vibratory Snore - session->AddEvent(new Event(t,cpapcode, {})); + session->AddEvent(new Event(t,cpapcode, data,0)); break; case 0x03: // BIPAP Pressure case 0x0b: // Unknown case 0x11: // Leak Rate - data0=buffer[pos++]; - data1=buffer[pos++]; + data[0]=buffer[pos++]; + data[1]=buffer[pos++]; if (code==0x11) { - session->AddEvent(new Event(t,cpapcode, {data0})); - if (data1>0) { - session->AddEvent(new Event(tt,PRS1_VSnore2, {data1})); + session->AddEvent(new Event(t,cpapcode, data,1)); + if (data[1]>0) { + session->AddEvent(new Event(tt,PRS1_VSnore2, &data[1],1)); } } else if (code==0x03) { - data0/=10.0; - data1/=10.0; - session->AddEvent(new Event(t,CPAP_EAP, {data1})); - session->AddEvent(new Event(t,CPAP_IAP, {data0})); + data[0]/=10.0; + data[1]/=10.0; + session->AddEvent(new Event(t,CPAP_EAP, &data[1], 1)); + session->AddEvent(new Event(t,CPAP_IAP, data, 1)); } else { - session->AddEvent(new Event(t,cpapcode, {data0,data1})); + session->AddEvent(new Event(t,cpapcode, data, 2)); } break; case 0x0e: // Unknown case 0x10: // Unknown - data0=buffer[pos++]; - data1=buffer[pos++]; - data2=buffer[pos++]; - session->AddEvent(new Event(t,cpapcode, {data0,data1,data2})); + data[0]=buffer[pos++]; + data[1]=buffer[pos++]; + data[2]=buffer[pos++]; + session->AddEvent(new Event(t,cpapcode, data, 3)); break; case 0x0f: // Cheyne Stokes Respiration - data0=buffer[pos+1]<<8 | buffer[pos]; + data[0]=buffer[pos+1]<<8 | buffer[pos]; pos+=2; - data1=buffer[pos++]; + data[1]=buffer[pos++]; tt-=wxTimeSpan::Seconds(data1); - session->AddEvent(new Event(tt,cpapcode, {data0,data1})); + session->AddEvent(new Event(tt,cpapcode, data, 2)); break; case 0x12: // Summary - data0=buffer[pos++]; - data1=buffer[pos++]; - data2=buffer[pos+1]<<8 | buffer[pos]; + data[0]=buffer[pos++]; + data[1]=buffer[pos++]; + data[2]=buffer[pos+1]<<8 | buffer[pos]; pos+=2; - session->AddEvent(new Event(t,cpapcode, {data0,data1,data2})); + session->AddEvent(new Event(t,cpapcode, data,3)); break; default: // ERROR!!! @@ -729,6 +729,13 @@ bool PRS1Loader::OpenWaveforms(Session *session,wxString filename) return true; } +void InitModelMap() +{ + ModelMap[34]=wxT("RemStar Pro with C-Flex+"); + ModelMap[35]=wxT("RemStar Auto with A-Flex"); + ModelMap[37]=wxT("RemStar BIPAP Auto with Bi-Flex"); +}; + bool initialized=false; void PRS1Loader::Register() @@ -736,6 +743,7 @@ void PRS1Loader::Register() if (initialized) return; wxLogVerbose(wxT("Registering PRS1Loader")); RegisterLoader(new PRS1Loader()); + InitModelMap(); initialized=true; } diff --git a/version.h b/version.h index 763dabab..79a61d8a 100644 --- a/version.h +++ b/version.h @@ -16,14 +16,14 @@ namespace AutoVersion{ //Standard Version Type static const long MAJOR = 0; static const long MINOR = 7; - static const long BUILD = 2786; - static const long REVISION = 9853; + static const long BUILD = 2807; + static const long REVISION = 9954; //Miscellaneous Version Types - static const long BUILDS_COUNT = 8265; - #define RC_FILEVERSION 0,7,2786,9853 - #define RC_FILEVERSION_STRING "0, 7, 2786, 9853\0" - static const char FULLVERSION_STRING[] = "0.7.2786.9853"; + static const long BUILDS_COUNT = 8303; + #define RC_FILEVERSION 0,7,2807,9954 + #define RC_FILEVERSION_STRING "0, 7, 2807, 9954\0" + static const char FULLVERSION_STRING[] = "0.7.2807.9954"; //These values are to keep track of your versioning state, don't modify them. static const long BUILD_HISTORY = 62;