Plotter
class
The C++ binding for libplot
is provided by a class library, named
libplotter
. This library implements a Plotter
class,
of which all Plotters are instances. Actually, a Plotter would
normally be an instance of an appropriate derived class, determined by
the Plotter's output format. Derived classes currently include
XPlotter
, XDrawablePlotter
, PNMPlotter
,
GIFPlotter
, AIPlotter
, PSPlotter
,
FigPlotter
, PCLPlotter
, HPGLPlotter
,
TekPlotter
, and MetaPlotter
. The names should be
self-explanatory. The operations that may be applied to any Plotter
(e.g., the openpl
operation, which begins a page of graphics) are
implemented as public function members of the Plotter
class.
At the time a Plotter is created, its input, output, and error streams
must be specified. (The first is ignored, since at present, all
Plotters are write-only.) The streams may be specified either as
iostreams or as FILE
pointers. That is, the two constructors
Plotter(istream& instream, ostream& outstream, ostream& errstream); Plotter(FILE *infile, FILE *outfile, FILE *errfile);
are provided for the base Plotter class, and similarly for each of its derived classes. So, for example, both
PSPlotter plotter(cin, cout, cerr);
and
PSPlotter plotter(stdin, stdout, stderr);
are possible declarations of a Postscript Plotter that writes to
standard output. In the iostream case, an ostream with a null stream
buffer may be specified as the output stream and/or the error stream, to
request that no output take place. In the FILE
pointer case,
specifying a null FILE
pointer would accomplish the same thing.
Instances of the XPlotter
and XDrawablePlotter
classes
always ignore the output stream argument, since they write graphics to
an X Display rather than to a stream.
The parameter-setting function parampl
, which plays an important
role in all bindings of libplot
, is implemented in
libplotter
as a static function member of the Plotter
class. The following is a formal description.
char *
, i.e., a string. Unrecognized parameters are
ignored. For a list of the recognized parameters and their meaning, see
section Device driver parameters.
Just as in the C binding, Plotter::parampl
gives the programmer
fine control over the parameters of subsequently created Plotters. The
parameter values used by any Plotter are constant over the lifetime of
the Plotter, and are those that were set when the Plotter was created.
If at Plotter creation time a parameter is not set, its
default value will be used, unless the parameter is string-valued and
there is an environment variable of the same name, in which case the
value of that environment variable will be used.
Once set, a parameter may be unset by the programmer by calling
Plotter::parampl
with a value argument of NULL. This further
increases flexibility.
Go to the first, previous, next, last section, table of contents.