/* * 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. */ #ifndef PG_PARSETRACE_ #define PG_PARSETRACE_ #pragma interface #include #include #include #include #include #include class ParseTrace { public: typedef void (*record_f)(const char *type, const char *msg, va_list); friend void null_record(const char *, const char *, va_list); public: ParseTrace(record_f f = null_record); void setMesType(UniMesIdCode::Value); void incrGroupDepth(); void decrGroupDepth(); void setPlace(int); void incrPlace(); void incrSRepetition(); void incrSegOfMsg(); void acceptGroup(); void rejectGroup(); void setSegType(SegTypeCode::Value); void incrField(); void incrField(const char*); void setFieldName(const char*); void incrFRepetition(); void incrCompDepth(); void decrCompDepth(); void incrComponent(); void setDataType(DataTypeCode::Value); void output(ostream&); void reset(int level = 0); void log(const char*); public: // yes, it's public const int max_group_depth = 6; // 6 should be more than sufficient const int max_component_depth = 3; // 3 is fixed by HL7 encoding rules UniMesIdCode::Value message; int group_depth; int place[max_group_depth]; int s_repetition[max_group_depth]; int seg_of_msg[max_group_depth]; // a trial and error stack SegTypeCode::Value segment; int field; const char *field_name; int f_repetition; int component_depth; DataTypeCode::Value data_type[max_component_depth]; int component[max_component_depth]; record_f record_function; friend void record_parse_error(const char *msg, ...); friend void record_parse_warning(const char *msg, ...); }; extern ParseTrace parseTrace; class SegStrucTracer { bool is_a_group; public: SegStrucTracer(UniMesIdCode::Value); SegStrucTracer(PGObject::subclass_t = PGObject::group); ~SegStrucTracer(); void operator=(int); void operator++(int); void accept(); void reject(); }; class RepStrucTracer { public: void operator++(int); }; class SegmentTracer { public: SegmentTracer(SegTypeCode::Value sid = SegTypeCode::not_present); ~SegmentTracer(); void operator++(int); void next(DataTypeCode::Value, const char*); void setFieldName(const char*); }; class RepFieldTracer { public: void operator++(int); }; class CompositeTracer { public: CompositeTracer(DataTypeCode::Value); ~CompositeTracer(); void operator++(int); void next(DataTypeCode::Value); }; #ifndef OUTLINE # include "ParseTrace.icc" #endif #endif /* ! PG_PARSETRACE_ */