/* * Copyright (c) 1995, 1996 Gunther Schadow. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "pg_config.h" IDENT("@(#) LabEventInfo.cc (Gunther Schadow) 12/19/96"); #pragma implementation "LabEventInfo.h" #include "LabEventInfo.h" #include #include #include #include #include #include #include #include // for sprintf(3) only static const char *labEventInfo_db_base = "LabEventInfo.db"; static char *labEventInfo_db_file = NULL; odbm::odbm_file LabEventInfo::odbmf = odbm::null_dbf; u_int LabEventInfo::odbm_obj_cnt = 0; LabEventInfo::LabEventInfo() : odbm(&loinc_num, &labEventClass, &constVal, sizeof(double) * 8 + sizeof(int), &odbmf, &odbm_obj_cnt, ExternalCode::new_dbf_path(labEventInfo_db_file, labEventInfo_db_base)) { constVal= 0; minValue = 0; lowAlert = 0; lowNormal= 0; highNormal=0; highAlert= 0; maxValue = 0; increment= 0; precision= 0; } LabEventInfo::LabEventInfo(int mode) : odbm(&loinc_num, &labEventClass, &constVal, sizeof(double) * 8 + sizeof(int), &odbmf, &odbm_obj_cnt, ExternalCode::new_dbf_path(labEventInfo_db_file, labEventInfo_db_base), mode) { constVal= 0; minValue = 0; lowAlert = 0; lowNormal= 0; highNormal=0; highAlert= 0; maxValue = 0; increment= 0; precision= 0; } LabEventInfo::LabEventInfo(const char *name) : odbm(&loinc_num, &labEventClass, &constVal, sizeof(double) * 8 + sizeof(int), &odbmf, &odbm_obj_cnt, ExternalCode::new_dbf_path(labEventInfo_db_file, labEventInfo_db_base)) { set(name); } /* * Set the LabEventInfo according to the loinc_num with check digit */ void LabEventInfo::set(const char *s) { if(fetch(s) == FAIL) ERROR("labEventInfo code `%s' not found", s); } LabEventInfo& LabEventInfo::operator = (const char *s) { free(); set(s); return *this; } bool LabEventInfo::lookup(const char *s) { if(fetch(s) == SUCCESS) return TRUE; else return FALSE; }