NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
NumeRe::GenericFile Class Referenceabstract

Template class representing a generic file. This class may be specified for the main data type contained in the read or written table. All other file classes are derived from this class. This class cannot be instantiated directly, because the read and write methods are declared as pure virtual. More...

#include <file.hpp>

Inheritance diagram for NumeRe::GenericFile:
Collaboration diagram for NumeRe::GenericFile:

Public Member Functions

 GenericFile (const std::string &fileName)
 Constructor from filename. More...
 
 GenericFile (const GenericFile &file)
 Copy constructor. More...
 
virtual ~GenericFile ()
 Virtual destructor: we'll work with instances on the heap, therefore we'll need virtual declared destructors. This destructor will clear the internal memory and closes the file stream, if it is still open. More...
 
bool is_open ()
 Wrapper for fstream::is_open() More...
 
void close ()
 Wrapper for fstream::close(). Will also clear the internal memory. More...
 
bool good ()
 Wrapper for fstream::good() More...
 
size_t tellg ()
 Wrapper for fstream::tellg() More...
 
size_t tellp ()
 Wrapper for fstream::tellp() More...
 
void seekg (size_t pos)
 Wrapper for fstream::seekg() with start from the beginning of the stream. More...
 
void seekp (size_t pos)
 Wrapper for fstream::seekp() with start from the beginning of the stream. More...
 
std::string getExtension ()
 Returns the file extension. More...
 
std::string getFileName ()
 Returns the file name. More...
 
std::string getTableName ()
 Returns the table name referenced in the file. Will default to the file name with non-alnum characters replaced with underscores, if the file does not reference a table name by itself. More...
 
std::string getComment ()
 Returns the comment stored with the referenced file. More...
 
void setComment (const std::string &comment)
 Sets the comment to be written to the referencedfile. More...
 
long long int getRows ()
 Returns the number of rows. More...
 
long long int getCols ()
 Returns the number of columns. More...
 
virtual FileHeaderInfo getFileHeaderInformation ()
 Returns the file header information structure. More...
 
virtual bool read ()=0
 Pure virtual declaration of the read access method. Has to be implemented in all derived classes and can be used to read the contents of the file to memory. More...
 
virtual bool write ()=0
 Pure virtual declaration of the write access method. Has to be implemented in all derived classes and can be used to write the contents in memory to the target file. More...
 
GenericFileoperator= (const GenericFile &file)
 Assignment operator definition. More...
 
void getData (TableColumnArray *data)
 This method copies the internal data to the passed memory address. The target memory must already exist. More...
 
TableColumnArraygetData (long long int &rows, long long int &cols)
 This method returns a pointer to the internal memory with read and write access. This pointer shall not stored for future use, because the referenced memory will be deleted upon destruction of this class instance. More...
 
void setDimensions (long long int rows, long long int cols)
 Sets the dimensions of the data table, which will be used in the future. Clears the internal memory in advance. More...
 
void setTableName (const std::string &name)
 Set the table's name. More...
 
void setTextfilePrecision (unsigned short nPrecision)
 Set the precision, which shall be used to convert the floating point numbers into strings. More...
 
void addData (TableColumnArray *data, long long int rows, long long int cols)
 This method created the internal storage and copies the passed data to this storage. More...
 
void setData (TableColumnArray *data, long long int rows, long long int cols)
 This method refernces the passed external data internally. The data is not copied and must exist as long as thos class exists. More...
 
- Public Member Functions inherited from FileSystem
 FileSystem ()
 Default constructor. More...
 
FileSystemassign (const FileSystem &_fSys)
 Assignment member function to copy the settings from another FileSystem instance. More...
 
std::string ValidFileName (std::string _sFileName, const std::string sExtension=".dat", bool checkExtension=true, bool doCleanPath=true) const
 This member function evaluates, whether the passed filename is a valid filename. One may supply a preferred filename extension. More...
 
std::string ValidFolderName (std::string _sFileName, bool doCleanPath=true, bool appendTrailingSeparator=true) const
 This member function evaluates, whether the passed foldername is a valid foldername. More...
 
std::string ValidizeAndPrepareName (const std::string &_sFileName, const std::string &sExtension=".dat") const
 This member function validizes the passed file name and creates the needed folders on-the-fly. More...
 
int setPath (std::string _sPath, bool bMkDir, std::string _sExePath)
 This member function may be used to set the preferred file path of the current FileSystem instance. More...
 
void createRevisionsFolder ()
 This member function creates the hidden revisions folders for the version control system. More...
 
std::string getPath () const
 Returns the default path of this FileSystem instance. More...
 
std::vector< std::string > getFileParts (const std::string &sFilePath) const
 This member function separates all path parts into single strings: the drive letter, the path, the name and the extension. This function may also handle folder paths and network paths. More...
 
FileInfo getFileInfo (const std::string &sFilePath) const
 Return the file information about the passed file path. More...
 
void setTokens (std::string _sTokens)
 This member function may be used to update the path placeholders of the current FileSystem instance. More...
 
bool isFile (const std::string &_sPath) const
 This function determines, whether a path name indicates a file or a folder. More...
 
void initializeFromKernel ()
 Member function to remote-initialize the class from the kernel. Cannot be used during kernel start-up. More...
 
void setProgramPath (std::string _sExePath)
 
std::string getProgramPath () const
 
void declareFileType (const std::string &sFileType)
 

Protected Member Functions

void open (std::ios::openmode mode)
 This method has to be used to open the target file in stream mode. If the file cannot be opened, this method throws an error. More...
 
void stripTrailingSpaces (std::string &_sToStrip)
 This method strips trailing spaces from the passed string. More...
 
void replaceDecimalSign (std::string &_sToReplace)
 This method simply replaces commas with dots in the passed string to enable correct parsing into a double. More...
 
void replaceTabSign (std::string &_sToReplace, bool bAddPlaceholders=false)
 This method replaces tabulator characters with whitespaces to simplify the column determination (the used tokenizer will only have to consider whitespaces as separator characters). Sometimes, replacing tabulators into whitespaces will destroy column information. To avoid this, placeholders (underscores) may be inserted as "empty" column cells. More...
 
std::pair< size_t, size_t > calculateCellExtents (const std::string &sContents)
 This method calculates the extents of the passed string, if it is used as a table column headlines. This method will return a std::pair<> with the maximal number of characters in a line in the first and the number of lines in the second component. More...
 
std::string getLineFromHead (long long int nCol, size_t nLineNumber)
 This method gets the selected line number from the table column headline in the selected column. If the selected text does not contain enough lines, a simple whitespaces is returned. More...
 
template<typename T >
readNumField ()
 This method is a template fo reading a numeric field of the selected template type in binary mode. More...
 
std::string readStringField ()
 This mehtod can be used to read a string field from the file in binary mode. More...
 
std::string getZipFileItem (const std::string &filename)
 This method may be used to get the contents of an embedded file in a zipfile and return the contents as string. More...
 
template<typename T >
T * readNumBlock (long long int &size)
 This method template is for reading a block of numeric data into memory in binary mode. More...
 
template<typename T >
T ** readDataArray (long long int &rows, long long int &cols)
 This method template is for reading a whole two-dimensional array of data into memory in binary mode. More...
 
std::string * readStringBlock (long long int &size)
 This method can be used for reading a block of string data to memory in binary mode. More...
 
std::vector< std::string > readTextFile (bool stripEmptyLines)
 This method may be used to read the file in text mode and to obtain the data as a vector. More...
 
std::vector< std::string > tokenize (std::string sString, const std::string &sSeparators, bool skipEmptyTokens=false)
 This method may be used to separater a line into multiple tokens using a set of separator characters. If empty token shall be skipped, then only tokens with a non-zero length are stored. More...
 
template<typename T >
void writeNumField (T num)
 This method template can be used to write a numeric value to file in binary mode. More...
 
void writeStringField (const std::string &sString)
 This method may be used to write a string to file in binary mode. More...
 
template<typename T >
void writeNumBlock (T *data, long long int size)
 This method template may be used to write a block of data of the selected type to the file in binary mode. More...
 
template<typename T >
void writeDataArray (T **data, long long int rows, long long int cols)
 This method may be used to write a two-dimensional array of data to the file in binary mode. More...
 
void writeStringBlock (std::string *data, long long int size)
 This method may be used to write a block of strings into the file in binary mode. More...
 
void createStorage ()
 This method prepares the internal storage, so that it may contain the read data. This method is only used for textual files. More...
 
void clearStorage ()
 This method cleares the internal storage. This method is called by the destructor automatically. More...
 
template<typename T >
void copyDataArray (T **from, T **to, long long int rows, long long int cols)
 This method may be used to copy two- dimensional arrays of data. Both source and target arrays have to exist in advance. More...
 
void copyStringArray (std::string *from, std::string *to, long long int nElements)
 This method may be used to copy string arrays. Both source and target arrays have to exist in advance. More...
 
template<typename T >
void copyArray (T *from, T *to, long long int nElements)
 This method template may be used to copy arrays of data of the selected type. Both source and target arrays have to exist in advance. More...
 
bool isNumeric (const std::string &sString)
 This method may be used to determine, whether a string contains only numeric data. More...
 
void assign (const GenericFile &file)
 This method is used by the assignment operator and the copy constructor to copy the contents of the passed GenericFile instance. More...
 
- Protected Member Functions inherited from FileSystem
int createFolders (const std::string &_sPath) const
 This member function creates all missing directories in the passed path. More...
 

Protected Attributes

std::fstream fFileStream
 
std::string sFileExtension
 
std::string sFileName
 
std::string sTableName
 
std::string sComment
 
long long int nRows
 
long long int nCols
 
unsigned short nPrecFields
 
bool useExternalData
 
std::ios::openmode openMode
 
TableColumnArrayfileData
 
- Protected Attributes inherited from FileSystem
std::string sPath
 
std::string sExecutablePath
 
std::string sTokens [7][2]
 
std::string sValidExtensions
 

Detailed Description

Template class representing a generic file. This class may be specified for the main data type contained in the read or written table. All other file classes are derived from this class. This class cannot be instantiated directly, because the read and write methods are declared as pure virtual.

Definition at line 67 of file file.hpp.

Constructor & Destructor Documentation

◆ GenericFile() [1/2]

NumeRe::GenericFile::GenericFile ( const std::string &  fileName)
inline

Constructor from filename.

Parameters
fileNameconst std::string&

Definition at line 828 of file file.hpp.

References FileSystem::getFileParts(), FileSystem::initializeFromKernel(), sFileExtension, sFileName, and FileSystem::ValidFileName().

Here is the call graph for this function:

◆ GenericFile() [2/2]

NumeRe::GenericFile::GenericFile ( const GenericFile file)
inline

Copy constructor.

Parameters
fileconst GenericFile&

Definition at line 842 of file file.hpp.

References assign().

Here is the call graph for this function:

◆ ~GenericFile()

virtual NumeRe::GenericFile::~GenericFile ( )
inlinevirtual

Virtual destructor: we'll work with instances on the heap, therefore we'll need virtual declared destructors. This destructor will clear the internal memory and closes the file stream, if it is still open.

Definition at line 854 of file file.hpp.

References clearStorage(), and fFileStream.

Here is the call graph for this function:

Member Function Documentation

◆ addData()

void NumeRe::GenericFile::addData ( TableColumnArray data,
long long int  rows,
long long int  cols 
)
inline

This method created the internal storage and copies the passed data to this storage.

Parameters
dataTableColumnArray*
rowslong long int
colslong long int
Returns
void

Definition at line 1200 of file file.hpp.

References createStorage(), fileData, nCols, and nRows.

Here is the call graph for this function:

◆ assign()

void NumeRe::GenericFile::assign ( const GenericFile file)
inlineprotected

This method is used by the assignment operator and the copy constructor to copy the contents of the passed GenericFile instance.

Parameters
fileconst GenericFile&
Returns
void

Definition at line 796 of file file.hpp.

References clearStorage(), createStorage(), fileData, nCols, nPrecFields, nRows, sComment, sFileExtension, sFileName, sTableName, and useExternalData.

Referenced by GenericFile(), operator=(), NumeRe::IgorBinaryWave::operator=(), NumeRe::ZygoDat::operator=(), and NumeRe::NumeReDataFile::operator=().

Here is the call graph for this function:

◆ calculateCellExtents()

std::pair< size_t, size_t > NumeRe::GenericFile::calculateCellExtents ( const std::string &  sContents)
inlineprotected

This method calculates the extents of the passed string, if it is used as a table column headlines. This method will return a std::pair<> with the maximal number of characters in a line in the first and the number of lines in the second component.

Parameters
sContentsconst std::string&
Returns
std::pair<size_t, size_t>

Definition at line 220 of file file.hpp.

Referenced by NumeRe::TextDataFile::calculateColumnWidths(), and NumeRe::LaTeXTable::countHeadLines().

◆ clearStorage()

void NumeRe::GenericFile::clearStorage ( )
inlineprotected

This method cleares the internal storage. This method is called by the destructor automatically.

Returns
void

Definition at line 687 of file file.hpp.

References fileData, nCols, nRows, and useExternalData.

Referenced by assign(), close(), NumeRe::CacheFile::reset(), setDimensions(), and ~GenericFile().

◆ close()

void NumeRe::GenericFile::close ( )
inline

Wrapper for fstream::close(). Will also clear the internal memory.

Returns
void

Definition at line 880 of file file.hpp.

References clearStorage(), and fFileStream.

Referenced by MemoryManager::loadFromNewCacheFile().

Here is the call graph for this function:

◆ copyArray()

template<typename T >
void NumeRe::GenericFile::copyArray ( T *  from,
T *  to,
long long int  nElements 
)
inlineprotected

This method template may be used to copy arrays of data of the selected type. Both source and target arrays have to exist in advance.

Parameters
fromT*
toT*
nElementslong long int
Returns
void

Definition at line 761 of file file.hpp.

Referenced by NumeRe::CacheFile::readCacheHeader().

◆ copyDataArray()

template<typename T >
void NumeRe::GenericFile::copyDataArray ( T **  from,
T **  to,
long long int  rows,
long long int  cols 
)
inlineprotected

This method may be used to copy two- dimensional arrays of data. Both source and target arrays have to exist in advance.

Parameters
fromT**
toT**
rowslong long int
colslong long int
Returns
void

Definition at line 717 of file file.hpp.

◆ copyStringArray()

void NumeRe::GenericFile::copyStringArray ( std::string *  from,
std::string *  to,
long long int  nElements 
)
inlineprotected

This method may be used to copy string arrays. Both source and target arrays have to exist in advance.

Parameters
fromstd::string*
tostd::string*
nElementslong long int
Returns
void

Definition at line 740 of file file.hpp.

◆ createStorage()

◆ getCols()

long long int NumeRe::GenericFile::getCols ( )
inline

◆ getComment()

std::string NumeRe::GenericFile::getComment ( )
inline

Returns the comment stored with the referenced file.

Returns
std::string

Definition at line 1008 of file file.hpp.

References sComment.

Referenced by MemoryManager::loadFromNewCacheFile().

◆ getData() [1/2]

TableColumnArray * NumeRe::GenericFile::getData ( long long int &  rows,
long long int &  cols 
)
inline

This method returns a pointer to the internal memory with read and write access. This pointer shall not stored for future use, because the referenced memory will be deleted upon destruction of this class instance.

Parameters
rowslong long int&
colslong long int&
Returns
TableColumnArray*

Definition at line 1137 of file file.hpp.

References fileData, nCols, and nRows.

◆ getData() [2/2]

void NumeRe::GenericFile::getData ( TableColumnArray data)
inline

This method copies the internal data to the passed memory address. The target memory must already exist.

Parameters
dataTableColumnArray*
Returns
void

Definition at line 1113 of file file.hpp.

References fileData, and nCols.

Referenced by NumeRe::GenericFileView::getColumnHead(), NumeRe::GenericFileView::getElement(), NumeRe::GenericFileView::getStringElement(), MemoryManager::loadFromNewCacheFile(), and NumeRe::FileAdapter::openFile().

◆ getExtension()

std::string NumeRe::GenericFile::getExtension ( )
inline

Returns the file extension.

Returns
std::string

Definition at line 951 of file file.hpp.

References sFileExtension.

Referenced by NumeRe::FileAdapter::openFile(), and Memory::save().

◆ getFileHeaderInformation()

virtual FileHeaderInfo NumeRe::GenericFile::getFileHeaderInformation ( )
inlinevirtual

Returns the file header information structure.

Returns
FileHeaderInfo

Reimplemented in NumeRe::NumeReDataFile.

Definition at line 1055 of file file.hpp.

References getTableName(), NumeRe::FileHeaderInfo::nCols, nCols, NumeRe::FileHeaderInfo::nRows, nRows, NumeRe::FileHeaderInfo::sComment, sComment, NumeRe::FileHeaderInfo::sFileExtension, sFileExtension, NumeRe::FileHeaderInfo::sFileName, sFileName, and NumeRe::FileHeaderInfo::sTableName.

Referenced by NumeRe::FileAdapter::openFile().

Here is the call graph for this function:

◆ getFileName()

std::string NumeRe::GenericFile::getFileName ( )
inline

Returns the file name.

Returns
std::string

Definition at line 962 of file file.hpp.

References sFileName.

◆ getLineFromHead()

std::string NumeRe::GenericFile::getLineFromHead ( long long int  nCol,
size_t  nLineNumber 
)
inlineprotected

This method gets the selected line number from the table column headline in the selected column. If the selected text does not contain enough lines, a simple whitespaces is returned.

Parameters
nCollong longint
nLineNumbersize_t
Returns
std::string

Definition at line 277 of file file.hpp.

References fileData, and TableColumn::getDefaultColumnHead().

Referenced by NumeRe::LaTeXTable::writeTableHeads(), and NumeRe::TextDataFile::writeTableHeads().

Here is the call graph for this function:

◆ getRows()

long long int NumeRe::GenericFile::getRows ( )
inline

Returns the number of rows.

Returns
long long int

Definition at line 1032 of file file.hpp.

References nRows.

Referenced by NumeRe::GenericFileView::getElement(), NumeRe::GenericFileView::getRows(), NumeRe::GenericFileView::getStringElement(), and MemoryManager::loadFromNewCacheFile().

◆ getTableName()

std::string NumeRe::GenericFile::getTableName ( )
inline

Returns the table name referenced in the file. Will default to the file name with non-alnum characters replaced with underscores, if the file does not reference a table name by itself.

Returns
std::string

Definition at line 977 of file file.hpp.

References FileSystem::getFileParts(), sFileName, and sTableName.

Referenced by getFileHeaderInformation(), NumeRe::NumeReDataFile::getFileHeaderInformation(), MemoryManager::loadFromNewCacheFile(), NumeRe::XLSSpreadSheet::writeFile(), and NumeRe::NumeReDataFile::writeHeader().

Here is the call graph for this function:

◆ getZipFileItem()

std::string NumeRe::GenericFile::getZipFileItem ( const std::string &  filename)
inlineprotected

This method may be used to get the contents of an embedded file in a zipfile and return the contents as string.

Parameters
filenameconst std::string&
Returns
std::string

Definition at line 384 of file file.hpp.

References Zipfile::close(), SyntaxError::DATAFILE_NOT_EXIST, Zipfile::getZipItem(), SyntaxError::invalid_position, Zipfile::open(), and sFileName.

Referenced by NumeRe::OpenDocumentSpreadSheet::readFile(), and NumeRe::XLSXSpreadSheet::readFile().

Here is the call graph for this function:

◆ good()

bool NumeRe::GenericFile::good ( )
inline

Wrapper for fstream::good()

Returns
bool

Definition at line 892 of file file.hpp.

References fFileStream.

◆ is_open()

bool NumeRe::GenericFile::is_open ( )
inline

Wrapper for fstream::is_open()

Returns
bool

Definition at line 868 of file file.hpp.

References fFileStream.

Referenced by NumeRe::NumeReDataFile::readFile(), and NumeRe::NumeReDataFile::writeFile().

◆ isNumeric()

bool NumeRe::GenericFile::isNumeric ( const std::string &  sString)
inlineprotected

This method may be used to determine, whether a string contains only numeric data.

Parameters
sStringconst std::string&
Returns
bool

Definition at line 779 of file file.hpp.

References CONVTYPE_VALUE, and isConvertible().

Referenced by NumeRe::TextDataFile::decodeTableHeads(), NumeRe::TextDataFile::readFile(), and NumeRe::OpenDocumentSpreadSheet::readFile().

Here is the call graph for this function:

◆ open()

void NumeRe::GenericFile::open ( std::ios::openmode  mode)
inlineprotected

◆ operator=()

GenericFile & NumeRe::GenericFile::operator= ( const GenericFile file)
inline

Assignment operator definition.

Parameters
fileconst GenericFile&
Returns
GenericFile&

Definition at line 1098 of file file.hpp.

References assign().

Here is the call graph for this function:

◆ read()

virtual bool NumeRe::GenericFile::read ( )
pure virtual

Pure virtual declaration of the read access method. Has to be implemented in all derived classes and can be used to read the contents of the file to memory.

Returns
bool

Implemented in NumeRe::TextDataFile, NumeRe::NumeReDataFile, NumeRe::CacheFile, NumeRe::CassyLabx, NumeRe::CommaSeparatedValues, NumeRe::LaTeXTable, NumeRe::JcampDX, NumeRe::OpenDocumentSpreadSheet, NumeRe::XLSSpreadSheet, NumeRe::XLSXSpreadSheet, NumeRe::IgorBinaryWave, and NumeRe::ZygoDat.

Referenced by NumeRe::SavitzkyGolayFilter::createKernel(), and NumeRe::FileAdapter::openFile().

◆ readDataArray()

template<typename T >
T ** NumeRe::GenericFile::readDataArray ( long long int &  rows,
long long int &  cols 
)
inlineprotected

This method template is for reading a whole two-dimensional array of data into memory in binary mode.

Parameters
rowslong longint&
colslong longint&
Returns
template <typenameT>T*

Definition at line 444 of file file.hpp.

References fFileStream.

◆ readNumBlock()

template<typename T >
T * NumeRe::GenericFile::readNumBlock ( long long int &  size)
inlineprotected

This method template is for reading a block of numeric data into memory in binary mode.

Parameters
sizelong longint&
Returns
template <typename T>T*

Definition at line 416 of file file.hpp.

References fFileStream.

◆ readNumField()

template<typename T >
T NumeRe::GenericFile::readNumField ( )
inlineprotected

This method is a template fo reading a numeric field of the selected template type in binary mode.

Returns
T

Definition at line 338 of file file.hpp.

References fFileStream.

◆ readStringBlock()

std::string * NumeRe::GenericFile::readStringBlock ( long long int &  size)
inlineprotected

This method can be used for reading a block of string data to memory in binary mode.

Parameters
sizelong longint&
Returns
std::string*

Definition at line 476 of file file.hpp.

References readStringField().

Referenced by NumeRe::NumeReDataFile::readColumn(), NumeRe::NumeReDataFile::readColumnV4(), NumeRe::NumeReDataFile::readFile(), and NumeRe::NumeReDataFile::readGenericField().

Here is the call graph for this function:

◆ readStringField()

std::string NumeRe::GenericFile::readStringField ( )
inlineprotected

◆ readTextFile()

std::vector< std::string > NumeRe::GenericFile::readTextFile ( bool  stripEmptyLines)
inlineprotected

This method may be used to read the file in text mode and to obtain the data as a vector.

Parameters
stripEmptyLinesbool
Returns
std::vector<std::string>

Definition at line 507 of file file.hpp.

References fFileStream, and stripTrailingSpaces().

Referenced by NumeRe::TextDataFile::readFile(), NumeRe::CommaSeparatedValues::readFile(), and NumeRe::JcampDX::readFile().

Here is the call graph for this function:

◆ replaceDecimalSign()

void NumeRe::GenericFile::replaceDecimalSign ( std::string &  _sToReplace)
inlineprotected

This method simply replaces commas with dots in the passed string to enable correct parsing into a double.

Parameters
_sToReplacestd::string&
Returns
void

Definition at line 132 of file file.hpp.

◆ replaceTabSign()

void NumeRe::GenericFile::replaceTabSign ( std::string &  _sToReplace,
bool  bAddPlaceholders = false 
)
inlineprotected

This method replaces tabulator characters with whitespaces to simplify the column determination (the used tokenizer will only have to consider whitespaces as separator characters). Sometimes, replacing tabulators into whitespaces will destroy column information. To avoid this, placeholders (underscores) may be inserted as "empty" column cells.

Parameters
_sToReplacestd::string&
bAddPlaceholdersbool
Returns
void

Definition at line 157 of file file.hpp.

Referenced by NumeRe::TextDataFile::readFile().

◆ seekg()

void NumeRe::GenericFile::seekg ( size_t  pos)
inline

Wrapper for fstream::seekg() with start from the beginning of the stream.

Parameters
possize_t
Returns
void

Definition at line 927 of file file.hpp.

References fFileStream.

Referenced by NumeRe::NumeReDataFile::readColumnV4(), and NumeRe::NumeReDataFile::readHeader().

◆ seekp()

void NumeRe::GenericFile::seekp ( size_t  pos)
inline

Wrapper for fstream::seekp() with start from the beginning of the stream.

Parameters
possize_t
Returns
void

Definition at line 940 of file file.hpp.

References fFileStream.

Referenced by NumeRe::NumeReDataFile::writeColumn(), NumeRe::NumeReDataFile::writeFile(), and NumeRe::CacheFile::~CacheFile().

◆ setComment()

void NumeRe::GenericFile::setComment ( const std::string &  comment)
inline

Sets the comment to be written to the referencedfile.

Parameters
commentconst std::string&
Returns
void

Definition at line 1021 of file file.hpp.

References sComment.

Referenced by MemoryManager::saveToCacheFile().

◆ setData()

void NumeRe::GenericFile::setData ( TableColumnArray data,
long long int  rows,
long long int  cols 
)
inline

This method refernces the passed external data internally. The data is not copied and must exist as long as thos class exists.

Parameters
dataTableColumnArray*
rowslong long int
colslong long int
Returns
void

Definition at line 1229 of file file.hpp.

References fileData, nCols, nRows, and useExternalData.

Referenced by Memory::save(), and MemoryManager::saveToCacheFile().

◆ setDimensions()

void NumeRe::GenericFile::setDimensions ( long long int  rows,
long long int  cols 
)
inline

Sets the dimensions of the data table, which will be used in the future. Clears the internal memory in advance.

Parameters
rowslong long int
colslong long int
Returns
void

Definition at line 1155 of file file.hpp.

References clearStorage(), nCols, and nRows.

Referenced by Memory::save(), and MemoryManager::saveToCacheFile().

Here is the call graph for this function:

◆ setTableName()

void NumeRe::GenericFile::setTableName ( const std::string &  name)
inline

Set the table's name.

Parameters
nameconst std::string&
Returns
void

Definition at line 1170 of file file.hpp.

References name, and sTableName.

Referenced by Memory::save(), and MemoryManager::saveToCacheFile().

◆ setTextfilePrecision()

void NumeRe::GenericFile::setTextfilePrecision ( unsigned short  nPrecision)
inline

Set the precision, which shall be used to convert the floating point numbers into strings.

Parameters
nPrecisionunsigned short
Returns
void

Definition at line 1184 of file file.hpp.

References nPrecFields.

Referenced by Memory::save().

◆ stripTrailingSpaces()

void NumeRe::GenericFile::stripTrailingSpaces ( std::string &  _sToStrip)
inlineprotected

This method strips trailing spaces from the passed string.

Parameters
_sToStripstd::string&
Returns
void

Definition at line 117 of file file.hpp.

Referenced by NumeRe::TextDataFile::readFile(), and readTextFile().

◆ tellg()

size_t NumeRe::GenericFile::tellg ( )
inline

Wrapper for fstream::tellg()

Returns
size_t

Definition at line 903 of file file.hpp.

References fFileStream.

Referenced by NumeRe::NumeReDataFile::readHeader(), and NumeRe::CacheFile::readSome().

◆ tellp()

size_t NumeRe::GenericFile::tellp ( )
inline

◆ tokenize()

std::vector< std::string > NumeRe::GenericFile::tokenize ( std::string  sString,
const std::string &  sSeparators,
bool  skipEmptyTokens = false 
)
inlineprotected

This method may be used to separater a line into multiple tokens using a set of separator characters. If empty token shall be skipped, then only tokens with a non-zero length are stored.

Parameters
sStringstd::string
sSeparatorsconst std::string&
skipEmptyTokensbool
Returns
std::vector<std::string>

Definition at line 544 of file file.hpp.

Referenced by NumeRe::TextDataFile::decodeTableHeads(), NumeRe::TextDataFile::readFile(), and NumeRe::CommaSeparatedValues::readFile().

◆ write()

virtual bool NumeRe::GenericFile::write ( )
pure virtual

Pure virtual declaration of the write access method. Has to be implemented in all derived classes and can be used to write the contents in memory to the target file.

Returns
bool

Implemented in NumeRe::TextDataFile, NumeRe::NumeReDataFile, NumeRe::CacheFile, NumeRe::CassyLabx, NumeRe::CommaSeparatedValues, NumeRe::LaTeXTable, NumeRe::JcampDX, NumeRe::OpenDocumentSpreadSheet, NumeRe::XLSSpreadSheet, NumeRe::XLSXSpreadSheet, NumeRe::IgorBinaryWave, and NumeRe::ZygoDat.

Referenced by Memory::save().

◆ writeDataArray()

template<typename T >
void NumeRe::GenericFile::writeDataArray ( T **  data,
long long int  rows,
long long int  cols 
)
inlineprotected

This method may be used to write a two-dimensional array of data to the file in binary mode.

Parameters
dataT**
rowslong long int
colslong long int
Returns
void

Definition at line 626 of file file.hpp.

References fFileStream.

◆ writeNumBlock()

template<typename T >
void NumeRe::GenericFile::writeNumBlock ( T *  data,
long long int  size 
)
inlineprotected

This method template may be used to write a block of data of the selected type to the file in binary mode.

Parameters
dataT*
sizelong long int
Returns
void

Definition at line 608 of file file.hpp.

References fFileStream.

Referenced by NumeRe::CacheFile::writeCacheHeader(), and NumeRe::CacheFile::~CacheFile().

◆ writeNumField()

template<typename T >
void NumeRe::GenericFile::writeNumField ( num)
inlineprotected

This method template can be used to write a numeric value to file in binary mode.

Parameters
numT
Returns
void

Definition at line 578 of file file.hpp.

References fFileStream.

Referenced by NumeRe::CacheFile::writeCacheHeader(), NumeRe::NumeReDataFile::writeDummyHeader(), and NumeRe::NumeReDataFile::writeHeader().

◆ writeStringBlock()

void NumeRe::GenericFile::writeStringBlock ( std::string *  data,
long long int  size 
)
inlineprotected

This method may be used to write a block of strings into the file in binary mode.

Parameters
datastd::string*
sizelong long int
Returns
void

Definition at line 646 of file file.hpp.

References writeStringField().

Referenced by NumeRe::NumeReDataFile::writeColumn().

Here is the call graph for this function:

◆ writeStringField()

void NumeRe::GenericFile::writeStringField ( const std::string &  sString)
inlineprotected

This method may be used to write a string to file in binary mode.

Parameters
sStringconst std::string&
Returns
void

Definition at line 591 of file file.hpp.

References fFileStream.

Referenced by NumeRe::CacheFile::writeCacheHeader(), NumeRe::NumeReDataFile::writeColumn(), NumeRe::NumeReDataFile::writeDummyHeader(), NumeRe::NumeReDataFile::writeFile(), NumeRe::NumeReDataFile::writeHeader(), and writeStringBlock().

Member Data Documentation

◆ fFileStream

◆ fileData

◆ nCols

◆ nPrecFields

◆ nRows

◆ openMode

std::ios::openmode NumeRe::GenericFile::openMode
protected

Definition at line 82 of file file.hpp.

Referenced by open().

◆ sComment

◆ sFileExtension

std::string NumeRe::GenericFile::sFileExtension
protected

◆ sFileName

◆ sTableName

std::string NumeRe::GenericFile::sTableName
protected

◆ useExternalData

bool NumeRe::GenericFile::useExternalData
protected

Definition at line 81 of file file.hpp.

Referenced by assign(), clearStorage(), and setData().


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