Lattice Tester Guide  1.0-9
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
LatticeTester::Writer< Int > Class Template Referenceabstract

This is an abstract class that represents an interface to Writer classes. More...

#include <latticetester/Writer.h>

Inherited by LatticeTester::WriterRes< Int >.

Public Member Functions

 Writer (const char *fileName)
 Constructor that opens a Writer to write in the file filename. More...
 
 Writer (std::ostream *stream)
 Constructor that opens a Writer to write directly in an ostream. More...
 
virtual ~Writer ()
 Destructor. More...
 
virtual void beginTabbedSection ()=0
 Begins a tabbed section. More...
 
virtual void endTabbedSection ()=0
 Ends a tabbed section. More...
 
virtual void addTab ()=0
 After this is called, newlines in tabbed sections will have an additional tab. More...
 
virtual void removeTab ()=0
 After this is called, newlines in tabbed sections will have one less tab. More...
 
virtual void clearTab ()=0
 After this is called, newlines in tabbed sections will have no tab. More...
 
virtual void defaultTab ()=0
 After this is called, newlines in tabbed sections will use the default amount of tabs and spaces of the class. More...
 
virtual void newLine ()=0
 Starts a new line and adds the right amount of tabs if in a tabbed section. More...
 
virtual void newParagraph ()=0
 Starts a new paragraph. More...
 
virtual void writeBool (const bool &value)
 Writes a bool on the stream. More...
 
virtual void writeInt (const int &value)
 Writes an int on the stream. More...
 
virtual void writeString (const std::string &value)
 Writes a string on the stream. More...
 
virtual void writeDouble (const double &value)
 Writes a double on the stream. More...
 
virtual void writeIntScal (const Int &value)
 Writes a IntScal on the stream. More...
 
virtual void writeMMat (const IntMat &A)
 Writes a IntMat on the stream. More...
 
virtual void writeMathString (const std::string)=0
 Writes a string that is formated and in LaTeX math mode. More...
 
virtual void writeStandOutMathString (const std::string)=0
 Writes a string that is formated and in LaTeX math mode with a newline after and before the string. More...
 
virtual std::ostream & getStream ()
 Returns the stream on which this object writes. More...
 

Protected Attributes

std::ostream * m_stream
 The stream in which the writings are done. More...
 

Detailed Description

template<typename Int>
class LatticeTester::Writer< Int >

This is an abstract class that represents an interface to Writer classes.

That is, this class methods are intended to be used as a way to format an output on an ostream or a file. It already implements functions to write basic data types. A subclass of this class must be implemented if you want to use it. WriterRes offers utilities to print in a file or on the command line. Since this class must be overridden, it is possible to implement subclasses to format text for different kind of output such as plain text, \(\LaTeX\) or HTML.

If this class is used on a file, it will automatically print at the start of the file and overwrite it. But if a stream is passed to this object, it will not be modified. That means that it is possible to write on a single stream with multiple writers.

Constructor & Destructor Documentation

◆ Writer() [1/2]

template<typename Int >
LatticeTester::Writer< Int >::Writer ( const char *  fileName)

Constructor that opens a Writer to write in the file filename.

This will overwrite the file and start printing at the start. The program will make/ovewrite a file in the working directory from which the program was called.

◆ Writer() [2/2]

template<typename Int >
LatticeTester::Writer< Int >::Writer ( std::ostream *  stream)

Constructor that opens a Writer to write directly in an ostream.

This will not change the stream object. That means that it is possible to create a stream and pass it to different implementations of this interface via this constructor to use different printing formats.

◆ ~Writer()

template<typename Int >
LatticeTester::Writer< Int >::~Writer ( )
virtual

Destructor.

Member Function Documentation

◆ addTab()

template<typename Int >
virtual void LatticeTester::Writer< Int >::addTab ( )
pure virtual

After this is called, newlines in tabbed sections will have an additional tab.

This is a pure virtual method that has no implementation.

Implemented in LatticeTester::WriterRes< Int >.

◆ beginTabbedSection()

template<typename Int >
virtual void LatticeTester::Writer< Int >::beginTabbedSection ( )
pure virtual

Begins a tabbed section.

In a tabbed section, every newline character is followed by a series of whitespace or tab characters such that the first non-blank characters of the lines in this section are aligned. The amount of tabs in the begginning of the section can be modified with the addTab(), removeTab() and clearTab() methods.

This is a pure virtual method that has no implementation.

Implemented in LatticeTester::WriterRes< Int >.

◆ clearTab()

template<typename Int >
virtual void LatticeTester::Writer< Int >::clearTab ( )
pure virtual

After this is called, newlines in tabbed sections will have no tab.

This is a pure virtual method that has no implementation.

Implemented in LatticeTester::WriterRes< Int >.

◆ defaultTab()

template<typename Int >
virtual void LatticeTester::Writer< Int >::defaultTab ( )
pure virtual

After this is called, newlines in tabbed sections will use the default amount of tabs and spaces of the class.

This is a pure virtual method that has no implementation.

Implemented in LatticeTester::WriterRes< Int >.

◆ endTabbedSection()

template<typename Int >
virtual void LatticeTester::Writer< Int >::endTabbedSection ( )
pure virtual

Ends a tabbed section.

This is a pure virtual method that has no implementation.

Implemented in LatticeTester::WriterRes< Int >.

◆ getStream()

template<typename Int >
virtual std::ostream& LatticeTester::Writer< Int >::getStream ( )
inlinevirtual

Returns the stream on which this object writes.

If the stream is a simple ostream, this can be used to then print on standard output for example. If this is a file. It can be possible to used different writers in succession.

◆ newLine()

template<typename Int >
virtual void LatticeTester::Writer< Int >::newLine ( )
pure virtual

Starts a new line and adds the right amount of tabs if in a tabbed section.

This is a pure virtual method that has no implementation.

Implemented in LatticeTester::WriterRes< Int >.

◆ newParagraph()

template<typename Int >
virtual void LatticeTester::Writer< Int >::newParagraph ( )
pure virtual

Starts a new paragraph.

Automatically ends the tabbed section if the writer was in one.

This is a pure virtual method that has no implementation.

Implemented in LatticeTester::WriterRes< Int >.

◆ removeTab()

template<typename Int >
virtual void LatticeTester::Writer< Int >::removeTab ( )
pure virtual

After this is called, newlines in tabbed sections will have one less tab.

This is a pure virtual method that has no implementation.

Implemented in LatticeTester::WriterRes< Int >.

◆ writeBool()

template<typename Int >
void LatticeTester::Writer< Int >::writeBool ( const bool &  value)
virtual

Writes a bool on the stream.

◆ writeDouble()

template<typename Int >
void LatticeTester::Writer< Int >::writeDouble ( const double &  value)
virtual

Writes a double on the stream.

◆ writeInt()

template<typename Int >
void LatticeTester::Writer< Int >::writeInt ( const int &  value)
virtual

Writes an int on the stream.

◆ writeIntScal()

template<typename Int >
void LatticeTester::Writer< Int >::writeIntScal ( const Int &  value)
virtual

Writes a IntScal on the stream.

◆ writeMathString()

template<typename Int >
virtual void LatticeTester::Writer< Int >::writeMathString ( const std::string  )
pure virtual

Writes a string that is formated and in LaTeX math mode.

This can be used to print mathemetical formulas in a standardised format.

This method can be implemented in various way. For example, it is possible to have it print with or without the LaTeX $ signs.

This is a pure virtual method that has no implementation.

Implemented in LatticeTester::WriterRes< Int >.

◆ writeMMat()

template<typename Int >
void LatticeTester::Writer< Int >::writeMMat ( const IntMat A)
virtual

Writes a IntMat on the stream.

◆ writeStandOutMathString()

template<typename Int >
virtual void LatticeTester::Writer< Int >::writeStandOutMathString ( const std::string  )
pure virtual

Writes a string that is formated and in LaTeX math mode with a newline after and before the string.

This can be used to print mathemetical formulas in a standardised format.

This method can be implemented in various way. For example, it is possible to have it print with or without the LaTeX \equation delimiters.

This is a pure virtual method that has no implementation.

Implemented in LatticeTester::WriterRes< Int >.

◆ writeString()

template<typename Int >
void LatticeTester::Writer< Int >::writeString ( const std::string &  value)
virtual

Writes a string on the stream.

Member Data Documentation

◆ m_stream

template<typename Int >
std::ostream* LatticeTester::Writer< Int >::m_stream
protected

The stream in which the writings are done.


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