
SepOutput(UI)        Cube Reference Manual        SepOutput(UI)

NAME
     SepOutput - Base class for writing seplib data files.

SYNOPSIS
     #include <Cube/sepoutput.h>

DESCRIPTION
     SepOutput is responsible for writting data  descriptions  to
     the header file specified in the constructor.  This class is
     also responsible for puting the data on disk.  No  data  are
     stored in memory inside this class.

PUBLIC OPERATIONS
     SepOutput( char* name, SepData * )
          Create a SepOutput object from a SepData object and the
          name of the output header file. If the name is equal to
          stdout the standard output is taken as the header file.
          The  output  header file is opened. If the SepData con-
          tains a pointer to a SepInput object  then  the  header
          file  from  the SepInput is copied to the output header
          file. If an error occurs the status variable is set and
          must be tested with the function Status().

     ~SepOutput()
          If the object has not already been closed the  destruc-
          tor  closes  the  header file and then writes a copy of
          the data in SepData object to disk.  The  only  way  in
          which the object may have been already closed is if the
          SepData object was deleted. (  see  SepData::~SepData()
          ).

     boolean Putch(char*, int )
     boolean Putch(char*, float )
     boolean Putch(char*, char* )
          Put parameters into the output  header  file.  true  is
          returned  if  everything  is  Ok.  Otherwise  false  is
          returned.

     void PutLine(char* )
          Write a line of text to the output header,  this  func-
          tion does NOT append a newline to the character string.

     int Status()
          The status of the object, zero = OK. CHECK IT!.

PROTECTED FUNCTIONS
     void allParOut()
          Write all the default  parameters  (n,n2,...)  on  the
          header file.

     void doClose(boolean copy)
          Close up the dataset and write  the  data  to  disk  if

SepOutput(UI)        Cube Reference Manual        SepOutput(UI)

          required.  If the argument is true the data will always
          be copied. If the argument is false  and  the  data  is
          already  on disk it will not be copied. This routine is
          only called with the  argument  false  when  a  SepData
          object  is  deleted,  this  is the only time when it is
          safe to assume a copy is not necessary.  The  SepOutput
          destructor calls doClose(true).

     char * makeName()
          Make up a name for the output data file.

     void blipPipe()
          Do the standard seplib things if the output is a pipe.

PROTECTED VARIABLES
     char* hdrname:
          The output header name .

     boolean toStdout:
          true if the header file is the standard output.

     boolean isaPipe:
          true if the header file is going down a pipe.

     boolean pipeData:
          true if the data is going down the pipe.

     FILE* headstream:
          File descriptor of the header file.

     FILE* outstream:
          File descriptor of the data file.

     SepData* sepData:
          SepData object that will be written to output on close.

     int status:
          error status.

DERIVED CLASSES
NAME
     SepPipeOutput - piped output to a command.

SYNOPSIS
     #include <Cube/seppipeout.h>

DESCRIPTION
     SepPipeOutput is a  SepOutput  object  that  pipes  data  to
     another  command  instead  of writing it to a data file. The
     command is specified in the constructor. A pipe to the  com-
     mand is created with the unix "popen" routine.

SepOutput(UI)        Cube Reference Manual        SepOutput(UI)

PUBLIC OPERATIONS
     SepPipeOutput( char* command, SepData * )
          Create a SepPipeOutput object from a SepData object and
          the  command  to pipe the data to.  If the SepData con-
          tains a pointer to a SepInput object  then  the  header
          file from the SepInput is copied to the pipe.

     ~SepPipeOutput()
          If the object has not already been closed the  destruc-
          tor  copies  the data to a file and closes the pipe. It
          then returns without waiting for  the  command  on  the
          other end of the pipe to terminate.

SEE ALSO
     SepData, intro.

