// file: $(NEDC_NFC)/class/cpp/Wfdb/wfdb_00.cc // // This file contains basic required methods such as constructors // and destructors, as well as basic infrastructure (e.g., resizing). // // Revision History: // // 20240409 (JP): initial version // // local include files // #include "Wfdb.h" //***************************************************************************** // // public methods: required methods such as constructors // //***************************************************************************** // method: default constructor // // arguments: // long debug_level: the debug level (input) // // return: none // // This method implements the detaul constructor for the Wfdb class. // Wfdb::Wfdb() { // display debugging information // if (dbgl_d == Dbgl::FULL) { fprintf(stdout, "%s (line: %d) %s: initializing a Wfdb object\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); } // initialize variables used to store the annotation database headers // num_patients_d = (long)-1; num_classes_d = (long)-1; // initialize variables used to store the annotation database records // id_exam_d = (long*)NULL; id_patient_d = (long*)NULL; age_d = (long*)NULL; sex_d = (char**)NULL; annotations_d = (long**)NULL; date_exam_d = (char**)NULL; // initialize variables used to hold the first line of the header file // hdr_id_exam_d = (long)-1; hdr_num_channels_d = (long)-1; hdr_sample_frequency_d = (float)0.0; hdr_num_samples_per_channel_d = (long)-1; // define variables used to hold the channel-specific lines of the header: // no initialization needed // // display debugging information // if (dbgl_d == Dbgl::FULL) { fprintf(stdout, "%s (line: %d) %s: done initializing a Wfdb object\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); } // exit gracefully // } // method: destructor // // arguments: none // // return: none // // This method implements the destructor. // Wfdb::~Wfdb() { // display debugging information // if (dbgl_d == Dbgl::FULL) { fprintf(stdout, "%s (line: %d) %s: begin destroying a Wdfb object\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); } // clear variables used to store the annotation database records // if (id_exam_d != (long*)NULL) { delete [] id_exam_d; id_exam_d = (long*)NULL; } id_patient_d = (long*)NULL; if (id_patient_d != (long*)NULL) { delete [] id_patient_d; id_patient_d = (long*)NULL; } age_d = (long*)NULL; if (age_d != (long*)NULL) { delete [] age_d; age_d = (long*)NULL; } if (num_patients_d > (long)0) { for (long i = 0; i < num_patients_d; i++) { if (sex_d[i] != (char*)NULL) { delete [] sex_d[i]; } } delete [] sex_d; } else { sex_d = (char**)NULL; } if (annotations_d != (long**)NULL) { delete [] annotations_d; annotations_d = (long**)NULL; } if (num_patients_d > (long)0) { for (long i = 0; i < num_patients_d; i++) { if (date_exam_d[i] != (char*)NULL) { delete [] date_exam_d[i]; } } delete [] date_exam_d; } else { date_exam_d = (char**)NULL; } // reset variables used to store the annotation database headers // num_patients_d = (long)-1; num_classes_d = (long)-1; // reset any other variables dynamically allocated: // none needed at this time // display debugging information // if (dbgl_d == Dbgl::FULL) { fprintf(stdout, "%s (line: %d) %s: done initializing a Wfdb object\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); } // display debugging information // if (dbgl_d == Dbgl::FULL) { fprintf(stdout, "%s (line: %d) %s: end of destroying a Wfdb object\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); } // exit gracefully // } //***************************************************************************** // // static constants: define non-integral constants in the default constructor // //***************************************************************************** // constants: class name // const char* Wfdb::CLASS_NAME = "Wfdb"; // declare the file extension for a header file // const char* Wfdb::EXT_HEA = "hea"; const char* Wfdb::EDF_BLANK = (char*)"X"; const char* Wfdb::EDF_UNITS = (char*)"mV"; // // end of file