Extended Input and Output Stream Classes

The pt_ofstream class is used in the SDF primitive Printer. Include the header file pt_fstream.h. The pt_ofstream constructor is invoked in the setup method with the call to new. It would not work to invoke it in the constructor for the primitive, since the fileName parameter would not have been initialized. Notice that the setup method reclaims the memory allocated in previous runs (or previous invocations of the setup method) before creating a new pt_ofstream object. Notice that we are not using a wrapup method to reclaim the memory, since this method is not invoked if an error occurs during a run.

The classes pt_ifstream and pt_ofstream are only a slight extension of the C++ standard classes ifstream and ofstream. They add the following features:

These classes can be used for binary character data as well as ASCII.