#include <gracetmpl.h>
Inheritance diagram for GraceTMPL::Save:
Public Member Functions | |
Save () | |
Default constructor. Does nothing special. | |
virtual | ~Save () |
Destructor. Cleans up things. | |
virtual Graph * | newGraph (int logplot=0) |
Create and store a new Graph within this object. | |
int | isCopydata (int g, int s) |
Used to query if a certain dataset should be copied from another. | |
Data * | copydata (int g, int s) |
Used to query the source set of a set copy operation. | |
void | regCopydata (int g, int s, Data *src) |
Used to set a reference to a dataset copy source. | |
void | clearCopydata () |
Used to clear all references to dataset copy sources. | |
virtual Graph * | graph (int i) |
Returns the number of stored graphs. | |
virtual int | graphs () |
Returns the number of stored graphs. | |
void | setOutputName (const std::string &name) |
Set the template for the output filename. | |
void | enablePipe (int i) |
Enables writing output data to a pipe. | |
int | pipeEnabled () |
Query the state of pipe handling. | |
virtual int | loadTemplate (const char *filename, int useS0=0) |
Load an xmgrace file as template. | |
virtual String2Vec | templateDataRequestInfo () |
Query information about datasets the template requests. | |
virtual void | save () |
Save all graphs to at least one file, optionally using a template. | |
Protected Types | |
typedef std::map< int, CopySrc > | CopyMap |
convenience type definition | |
typedef std::map< int, CopyMap > | Copy2Map |
convenience type definition | |
Protected Attributes | |
Template | tmpl_ |
Used to store template data. | |
std::vector< Graph * > | graphsVec_ |
StringStringMap | docEnvs_ |
StringMap | myEnv_ |
std::string | nameTmpl_ |
int | allowPipe_ |
For saving the data, an existing xmgrace file can be used as a template by calling loadTemplate(templatename)
So what happens in a typical livecycle of GraceTMPL usage?
|
Used to clear all references to dataset copy sources. Used internally only. |
|
Used to query the source set of a set copy operation. Used internally only by Graph::savedata() |
|
Enables writing output data to a pipe. If output to a pipe is enables and the outputname set with setOutputName() starts with a '|' symbol, the rest of the outputname will be interpreted as a process to which a pipe is opened and the outputdata is written. This might not work as expected if only works if no template has been loaded. For this case, pipe support might be disabled in the future
|
|
Used to query if a certain dataset should be copied from another. Used internally only by Graph::saveprep |
|
Load an xmgrace file as template. In the template file, environment variables can be used in a way of writing '$NAME' of ${NAME} with NAME consisting of alphanumerical characters and the underscore ('_'). This will be replaced by the string related to NAME. An environment variable can be set by calling setenv(). Any environment variable belonging to a certain graph is exported to the sheet using a naming style of ${GRAPH::NAME} with GRAPH denoting the graph name (e.g. "g0", "g1", etc.). Note this naming style explicitly requires the brackets "{}". Additionally, the might be an arbitrary number of parameters related to a graph. To specify the positions of these parameters (if they should be printed at all) the template can contain string objects of the form "PARAMg0:1" where g0 stands for graph "g0" and 1 stands for set number 1 withing that graph. If any, at least two strings per graph should be present, namely "PARAMg0:0" and "PARAMg0:1" for graph 0, "PARAMg1:0" and "PARAMg1:1" for graph 1 and so on. The positions of the last two strings of this kind will be used to interpolate the positions of further strings, so there should be enough space to hold the expected number of strings.
|
|
Used to set a reference to a dataset copy source. Used internally only by Graph::saveprep() |
|
Save all graphs to at least one file, optionally using a template. If no template was loaded with loadTemplate(), each graph will result in one datafile wich can be imported into an xmgrace-graph as ascii data. In case a template was successfully loaded, it will be used to store as many graphs in a file as specified in the template. The resulting files can be loaded by the same xmgrace version used to generate the template file. For notes on templates, see loadTemplate(). On saving, the environment variable '$p' will be expanded to the file number currently written, while '$pz' is this same number formatted with enough leading zeros to give a fixed-length string for all written files. To generate outputfilenames which can be sorted in ascending order, include "$pz" in your filename-template (see setOutputName()). '$P' will expand to the number of outputfiles necessary to save all graphs. |
|
Set the template for the output filename. The accessible environment for the output template is the same as for the whole file plus the environment of the first graph in the file.
|
|
Query information about datasets the template requests. In each of the graphs defined within the template, the contained sets can request the program using GraceTMPL to supply certain kind of data for the according set. This is done by adding a file/data specifier to the legendstring. A specifier starts with $' for sets which should keep their name from the legend entry and with $= for sets which get their name from the application. This is followed by a string of arbitrary length which is actually passed to the application when it calls this function. The result will be a 2-dimensional string vec with the first index being the graph number and the second index the setnumber within that graph. The setnumber must not necessarily represent the S* number as known from XmGrace - literal data sets will be missing as they can not be changed anyway. |
|
Used to set flag if opening a pipe for output is allowed |
|
Used to store the output file's environment |
|
Used to store all graphs |
|
Used to store the environment specific to the saver |
|
Used to store the filename template |
|
Used to store template data.
|