UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
LatexExporter Class Reference

Provides a possibility to generate Latex files from GTS objects or graph sets. More...

#include <LatexExporter.h>

Public Types

enum  TargetType { PS, PDF }
 This Enumeration Type specifies for which resulting file formats the Latex file will be generated and finally compiled. More...
 

Public Member Functions

 LatexExporter ()
 Generates a new LatexExporter with default values.
 
virtual ~LatexExporter ()
 Destroys this instance of a LatexExporter.
 
void writeToLatex (graphs::GTS const &gts, string filename, LatexExporter::TargetType target=TargetType::PDF, unordered_map< IDType, IDType > const *ruleIDSubs=nullptr, unordered_map< IDType, IDType > const *graphIDSubs=nullptr) const
 Creates (and compiles if not deactivated) a Latex file representing the given GTS. More...
 
void writeToLatex (vector< graphs::Hypergraph_sp > const &graphs, string filename, LatexExporter::TargetType target=TargetType::PDF, unordered_map< IDType, IDType > const *nameSubs=nullptr) const
 Creates (and compiles if not deactivated) a Latex file containing all given graphs. More...
 
void setScale (double scale)
 Sets a scaling factor for all images. More...
 
double getScale () const
 Returns the scaling factor currently used. More...
 
void setCompilation (bool compile)
 Sets whether the Latex file should be compiled after its generation or not. More...
 
bool willCompile () const
 Returns whether the Latex file will be compiled after its generation. More...
 

Private Member Functions

void writeToLatex (graphs::GTS const *gts, vector< graphs::Hypergraph_sp > const *graphs, string filename, LatexExporter::TargetType target, unordered_map< IDType, IDType > const *ruleIDSubs, unordered_map< IDType, IDType > const *graphIDSubs) const
 Implementation of both writeToLatex(...) functions. More...
 
void writeLatexHeader (std::ofstream &of) const
 Writes the header information of the Latex document (the preamble) to the given filestream. More...
 
void writeLatexAndGraphs (vector< graphs::Hypergraph_sp > const &graphs, std::ofstream &of, string filename, GraphDrawer::PictureFormat format, unordered_map< IDType, IDType > const *nameSubs) const
 Creates an image file for each graph in the collection and writes a Latex file including these graphs to the given stream. More...
 
void writeLatexBody (graphs::GTS const &gts, std::ofstream &of, string filename, string ext, unordered_map< IDType, IDType > const *ruleIDSubs, unordered_map< IDType, IDType > const *graphIDSubs) const
 Writes the body (including {document} and {document} to the given filestream. More...
 
void writeGraphs (graphs::GTS const &gts, string filename, GraphDrawer::PictureFormat format) const
 Creates an image file for each graph stored in the given gts object. More...
 
string getNameOrNoName (string name) const
 Returns either the string or <noname> if the string was empty. More...
 

Private Attributes

double scale
 Stores a scaling factor used when including the image files.
 
bool compile
 Stores whether the generated Latex file will be compiled or not.
 

Detailed Description

Provides a possibility to generate Latex files from GTS objects or graph sets.

The generated Latex file will be automatically be converted to a PDF or postscript file. This compilation can also be deactivated.

Author
Jan Stückrath

Member Enumeration Documentation

enum TargetType

This Enumeration Type specifies for which resulting file formats the Latex file will be generated and finally compiled.

Enumerator
PS 

Postscript file format.

PDF 

pdf file format.

Member Function Documentation

string getNameOrNoName ( string  name) const
inlineprivate

Returns either the string or <noname> if the string was empty.

Parameters
thestring to be checked
Returns
the input string if non-empty, <noname> otherwise
double getScale ( ) const

Returns the scaling factor currently used.

Returns
the scaling factor currently used
void setCompilation ( bool  compile)

Sets whether the Latex file should be compiled after its generation or not.

Parameters
compiletrue activates compilation, false deactivates
void setScale ( double  scale)

Sets a scaling factor for all images.

Semantic of this factor can depend on chosen TargetType.

Parameters
scalethe scaling factor
bool willCompile ( ) const

Returns whether the Latex file will be compiled after its generation.

Returns
true iff the Latex file will be compiled after its generation
void writeGraphs ( graphs::GTS const &  gts,
string  filename,
GraphDrawer::PictureFormat  format 
) const
private

Creates an image file for each graph stored in the given gts object.

These graphs are stored in a folder named by the given filename appended with '_files' (which is created if non-existent).

Parameters
gtsthe GTS containing the graphs to be written
filenamethe name of the Latex file which is being generated (including extension)
formata PictureFormat value representing the generated image format
void writeLatexAndGraphs ( vector< graphs::Hypergraph_sp > const &  graphs,
std::ofstream &  of,
string  filename,
GraphDrawer::PictureFormat  format,
unordered_map< IDType, IDType > const *  nameSubs 
) const
private

Creates an image file for each graph in the collection and writes a Latex file including these graphs to the given stream.

These graphs are stored in a folder named by the given filename appended with '_files' (which is created if non-existent).

Parameters
graphsthe collection of graphs to be layouted
ofthe file stream to which the Latex file will be written
filenamethe name of the resulting Latex file (including extension)
formatthe picture format used for generating the graph files
nameSubsthe value of IDs of graphs mapped by this parameter is exported in addition to the name
void writeLatexBody ( graphs::GTS const &  gts,
std::ofstream &  of,
string  filename,
string  ext,
unordered_map< IDType, IDType > const *  ruleIDSubs,
unordered_map< IDType, IDType > const *  graphIDSubs 
) const
private

Writes the body (including {document} and {document} to the given filestream.

This body includes Latex code layouting the given GTS and referencing the files created by writeGraphs(...).

See Also
LatexExporter::writeGraphs(graphs::GTS&, string, GraphDrawer::PictureFormat)
Parameters
gtsthe GTS to be layouted
ofthe filestream to which the Latex body will be written
filenamethe filename used to open the given filestream
extthe extension of the used image format (not including the point)
ruleIDSubsif given, the mapping of IDs of rules is printed instead of the normal IDs
graphIDSubsif given, the mapping of IDs of graphs is printed instead of the normal IDs
void writeLatexHeader ( std::ofstream &  of) const
private

Writes the header information of the Latex document (the preamble) to the given filestream.

This contains all necessary definitions except any includes for packages needed for the image format and the definition of the command.

Parameters
ofthe filestream to be used
void writeToLatex ( graphs::GTS const &  gts,
string  filename,
LatexExporter::TargetType  target = TargetType::PDF,
unordered_map< IDType, IDType > const *  ruleIDSubs = nullptr,
unordered_map< IDType, IDType > const *  graphIDSubs = nullptr 
) const

Creates (and compiles if not deactivated) a Latex file representing the given GTS.

Depending on the given TargetType, a subfolder is created to store all images of graphs and a file displaying all initial graphs and rules is generated.

Parameters
gtsthe GTS which should be layouted
filenamethe name of the file in which the latex code will be written (including extension)
ruleIDSubsif given, not the rule IDs are printed, but their mapping
graphIDSubsif given, not the graph IDs are printed, but their mapping
targetthe TargetType to be generated
void writeToLatex ( vector< graphs::Hypergraph_sp > const &  graphs,
string  filename,
LatexExporter::TargetType  target = TargetType::PDF,
unordered_map< IDType, IDType > const *  nameSubs = nullptr 
) const

Creates (and compiles if not deactivated) a Latex file containing all given graphs.

Depending on the given TargetType, a subfolder is created to store all images of graphs which will subsequently be merged to a single file.

Parameters
graphsthe graphs which should be layouted
filenamethe name of the file in which the latex code will be written (including extension)
targetthe TargetType to be generated
nameSubsevery graph with a mapping in this map will have its value (in this map) be displayed in addition to its name
void writeToLatex ( graphs::GTS const *  gts,
vector< graphs::Hypergraph_sp > const *  graphs,
string  filename,
LatexExporter::TargetType  target,
unordered_map< IDType, IDType > const *  ruleIDSubs,
unordered_map< IDType, IDType > const *  graphIDSubs 
) const
private

Implementation of both writeToLatex(...) functions.

If the given GTS is not null (has priority), it will be layouted. If a graph collection is given, it will be layouted and the ruleIDSubs parameter will be ignored. Either 'gts' or 'graphs' has to be defined!

See Also
writeToLatex(graphs::GTS const&, string, LatexExporter::TargetType,unordered_map<IDType, IDType> const*,unordered_map<IDType, IDType> const*)
writeToLatex(vector<graphs::Hypergraph_sp> const&, string, LatexExporter::TargetType, unordered_map<IDType, IDType> const*)
Parameters
gtsthe gts to be layouted; may be null if graphs parameter is not
graphsthe graph collection to be layouted; may be null if gts parameter is not
filenamethe Latex filename to be created (including extension)
targetthe target format
ruleIDSubsif layouting a gts, the mapping of IDs of rules is printed instead of the normal IDs
graphIDSubsif layouting a graph or gts, the mapping of IDs of graphs is printed instead of the normal IDs

The documentation for this class was generated from the following files: