Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | Related Pages

GraceTMPL::Data Class Reference

Container for x/y data pairs, optionally with dx and dy. More...

#include <gracetmpl.h>

Inheritance diagram for GraceTMPL::Data:

GraceTMPL::EnvironmentUser List of all members.

Public Member Functions

 Data ()
 Initialized a dummy dataset.

 Data (const std::string &name, int n, const double *x, const double *y, const double *dx=0, const double *dy=0)
 Initialized the dataset's name and data fields.

std::string name ()
 Returns the dataset's name.

int hasErrors ()
 Checks if at least one of x or y errors are present.

void setNum (int i)
 Set the dataset's number.

int num ()
 Query dataset's number.

void setXOffset (double x)
 Set the data's x-offset.

void setYOffset (double y)
 Set the data's y-offset.

void setScaling (double s)
 Set a factor by which the data will be scaled.

void autoscale (double &xmin, double &xmax, double &ymin, double &ymax, double XMIN, double XMAX, double YMIN, double YMAX, double errorfac=1.0)
 Query autoscale information from the datset.

void saveinfo (FILE *f, const StringVec *daSet=0)
 Save information strings info file.

void savedata (FILE *f, int correctLog=0)
 Save data-fields info file.


Detailed Description

Container for x/y data pairs, optionally with dx and dy.

Beware that a Data object is not to be used more than once. Each data object has it's own Environment and at some point of gracefile generation the Data object is assigned with a certain name (e.g. "S0") - this is done for all Data objects on the page and very essential for variable substitution.


Constructor & Destructor Documentation

GraceTMPL::Data::Data  ) 
 

Initialized a dummy dataset.

This dummy dataset can be used to represent literal data.

GraceTMPL::Data::Data const std::string &  name,
int  n,
const double *  x,
const double *  y,
const double *  dx = 0,
const double *  dy = 0
 

Initialized the dataset's name and data fields.

The name is used for the dataset's legend string. N denotes the number of values in each x,y,dx and dy. The latter two can be NULL pointers if errors are not of interest. The data referenced by x,y,dx and dy is copied to internal data structures.


Member Function Documentation

void GraceTMPL::Data::autoscale double &  xmin,
double &  xmax,
double &  ymin,
double &  ymax,
double  XMIN,
double  XMAX,
double  YMIN,
double  YMAX,
double  errorfac = 1.0
 

Query autoscale information from the datset.

The dataset's maximum and minumum x and y values are stored in xmin, xmax, ymin and ymax. If error values are present, they are taken into account scaled by errorfac. Errorfac defaults to 1.0 and can be set to 0.0 if errors are present and should not be taken into account. Autoscaling can be turned of by prepending and appending two spaces to the according axislabel: use "\ \ mylabel\ \ " instead of "mylabel" or "\ \ \ \ " instead of "" to turn off autoscaling.

autoscale only honours points within the x/y range [XMIN:XMAX]/[YMIN:YMAX].

void GraceTMPL::Data::savedata FILE *  f,
int  correctLog = 0
 

Save data-fields info file.

if correctLog is specified as !=0 the data will be cleaned of any points with non-positive y or y-dy values. This way the data is ready for a logarithic plot (dirty hack to avoid problem in xmgrace).

void GraceTMPL::Data::saveinfo FILE *  f,
const StringVec daSet = 0
 

Save information strings info file.

DaSet contains the information strings relevant for this dataset. if DaSet is empty or a NULL pointer NO information is being written to the file. This is a mandatory behaviour for bare dataset saving.

If a legend string ends with "$'" it is not replaced with the string provided by the program.

Todo:
Make this a stream

void GraceTMPL::Data::setNum int  i  )  [inline]
 

Set the dataset's number.

Called by GraceTMPL::Graph::save() when the dataset order is known. Default is 0.


The documentation for this class was generated from the following file:
Generated on Mon Sep 27 10:56:44 2004 for GraceTMPL by doxygen 1.3.2