Go to the first, previous, next, last section, table of contents.

The HL7 base class

Properties which are common to all HL7 objects are inherited from the class HL7Object. The HL7Object contains abstract functions that must be provided by any class that can have instances. In addition, the class HL7Object knows about the type of object of the inheriting class. The "type of object" is expressed as a pair. First there is the subclass that tells the abstract class that an object belongs to. For example, the ACK message has the subclass "message". The type tells what exact type an object is, i.e. whether it is an NM data type or an MSH segment, etc.

HL7Object::subclass_t HL7Object::subclass() const
The function telling the subclass of an object. The type "HL7Object::subclass_t" is an enumeration and has the following possible values:
HL7Object::primtype
object is a basic data type
HL7Object::composite
object is a composite data type
HL7Object::repfld
object is a repeated data type
HL7Object::segment
object is a segment
HL7Object::group
object is a group of segments
HL7Object::repstrc
object is a repeated segment or group
HL7Object::anyseg
object is a segment that can be of various types
HL7Object::message
object is a message
HL7Object::delimiters
object is the set of delimiters
int HL7Object::type() const
Returns the type of the object. The int can be transformed to a coded value using the appropriate code for the subclass.
bool HL7Object::ispresent() const
This is a predicate that tells if an object is present or not. A newly created object and it's parts are generally not present. An object that is not present can be present only if some value is written into it.
result HL7Object::unset()
Make an object and it's part to be not present. The result is always SUCCESS. Actually the unset() function should be declared void.(2)
result input(istream&)
result output(ostream&) const
These functions are declared as pure virtual, since any class that inherits HL7Object must define an input and an output function. These functions take iostreams as parameter which must be prepared for the use of HL7 (see section Send and receive messages with iostreams).

Finally there are the operators >> and << defined, which input or output a HL7Object respectively. These are declared as friend functions to the HL7Object and don't do much more than calling the input() or output() function respectively.


Go to the first, previous, next, last section, table of contents.