|
libGDF
|
00001 // 00002 // This file is part of libGDF. 00003 // 00004 // libGDF is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU Lesser General Public License as 00006 // published by the Free Software Foundation, either version 3 of 00007 // the License, or (at your option) any later version. 00008 // 00009 // libGDF is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Lesser General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU Lesser General Public License 00015 // along with libGDF. If not, see <http://www.gnu.org/licenses/>. 00016 // 00017 // Copyright 2010 Martin Billinger 00018 00019 #include "GDF/MainHeader.h" 00020 #include <memory.h> 00021 00022 namespace gdf 00023 { 00024 MainHeader::MainHeader( ) 00025 { 00026 setDefaultValues( ); 00027 } 00028 00029 //=================================================================================================== 00030 //=================================================================================================== 00031 00032 void MainHeader::setDefaultValues( ) 00033 { 00034 set_version_id( "GDF 2.10" ); 00035 memset( patient_id.item, ' ', patient_id.len ); 00036 set_patient_id( "X X X" ); 00037 memset( reserved_1.item, ' ', reserved_1.len ); 00038 set_patient_drugs( 0 ); 00039 set_patient_weight( 0 ); 00040 set_patient_height( 0 ); 00041 set_patient_flags( 0 ); 00042 memset( recording_id.item, 0, recording_id.len ); 00043 recording_location[0] = 0; 00044 recording_location[1] = 0; 00045 recording_location[2] = 0; 00046 recording_location[3] = 0; 00047 set_recording_start( 0 ); 00048 set_patient_birthday( 0 ); 00049 set_header_length( 0 ); 00050 memset( patient_ICD.item, ' ', patient_ICD.len ); 00051 set_equipment_provider_classification( 0 ); 00052 memset( reserved_2.item, 0, reserved_2.len ); 00053 patient_headsize[0] = 0; 00054 patient_headsize[1] = 0; 00055 patient_headsize[2] = 0; 00056 pos_reference[0] = 0; 00057 pos_reference[1] = 0; 00058 pos_reference[2] = 0; 00059 pos_ground[0] = 0; 00060 pos_ground[1] = 0; 00061 pos_ground[2] = 0; 00062 set_num_datarecords( -1 ); 00063 datarecord_duration[0] = 0; 00064 datarecord_duration[1] = 1; 00065 set_num_signals( 0 ); 00066 memset( reserved_3.item, 0, reserved_3.len ); 00067 } 00068 00069 //=================================================================================================== 00070 //=================================================================================================== 00071 00072 void MainHeader::copyFrom( const MainHeader &other ) 00073 { 00074 set_version_id( other.get_version_id() ); 00075 memcpy( patient_id.item, other.patient_id.item, patient_id.len ); 00076 memset( reserved_1.item, ' ', reserved_1.len ); 00077 set_patient_drugs( other.get_patient_drugs() ); 00078 set_patient_weight( other.get_patient_weight() ); 00079 set_patient_height( other.get_patient_height() ); 00080 set_patient_flags( other.get_patient_flags() ); 00081 memcpy( recording_id.item, other.recording_id.item, recording_id.len ); 00082 recording_location[0] = other.recording_location[0]; 00083 recording_location[1] = other.recording_location[1]; 00084 recording_location[2] = other.recording_location[2]; 00085 recording_location[3] = other.recording_location[3]; 00086 set_recording_start( other.get_recording_start() ); 00087 set_patient_birthday( other.get_patient_birthday() ); 00088 set_header_length( other.get_header_length() ); 00089 memcpy( patient_ICD.item, other.patient_ICD.item, patient_ICD.len ); 00090 set_equipment_provider_classification( other.get_equipment_provider_classification() ); 00091 memset( reserved_2.item, 0, reserved_2.len ); 00092 patient_headsize[0] = other.patient_headsize[0]; 00093 patient_headsize[1] = other.patient_headsize[1]; 00094 patient_headsize[2] = other.patient_headsize[2]; 00095 pos_reference[0] = other.pos_reference[0]; 00096 pos_reference[1] = other.pos_reference[1]; 00097 pos_reference[2] = other.pos_reference[2]; 00098 pos_ground[0] = other.pos_ground[0]; 00099 pos_ground[1] = other.pos_ground[1]; 00100 pos_ground[2] = other.pos_ground[2]; 00101 set_num_datarecords( other.get_num_datarecords() ); 00102 datarecord_duration[0] = other.datarecord_duration[0]; 00103 datarecord_duration[1] = other.datarecord_duration[0]; 00104 set_num_signals( other.get_num_signals() ); 00105 memset( reserved_3.item, 0, reserved_3.len ); 00106 } 00107 }