CFEL - ASG Software Suite  2.5.0
CASS
Public Member Functions | Private Attributes | List of all members
cass::TxtReader Class Reference

class for reading txt files More...

#include <txt_reader.h>

+ Inheritance diagram for cass::TxtReader:
+ Collaboration diagram for cass::TxtReader:

Public Member Functions

 TxtReader ()
 constructor More...
 
bool operator() (std::ifstream &file, CASSEvent &event)
 read the frms6 file contents put them into cassevent More...
 
void loadSettings ()
 load the settings of the reader More...
 
void readHeaderInfo (std::ifstream &file)
 read the file header More...
 
- Public Member Functions inherited from cass::FileReader
virtual ~FileReader ()
 virtual destructor More...
 
void filename (const std::string &filename)
 set the filename of the instance More...
 
const std::string & filename () const
 retrieve the filename that this instance is working on More...
 
std::string type () const
 return the type of file that this is for More...
 

Private Attributes

std::vector< std::string > _headers
 the value names More...
 
Splitter _split
 a splitter object to split up the lines More...
 
char _delim
 the deliminator by which the values are separated in the ascii file More...
 
std::string _eventIdhead
 the header name under which the event id is stored More...
 
size_t _linesToSkip
 how many lines should be skipped before reading the header line More...
 

Additional Inherited Members

- Public Types inherited from cass::FileReader
typedef std::tr1::shared_ptr< FileReadershared_pointer
 typedef the shared pointer of this More...
 
- Static Public Member Functions inherited from cass::FileReader
static shared_pointer instance (const std::string &filename)
 create an instance of the requested type More...
 
- Protected Member Functions inherited from cass::FileReader
 FileReader ()
 only inheritants can create this More...
 
 FileReader (const std::string &type)
 set the readers type More...
 
- Protected Attributes inherited from cass::FileReader
std::string _filename
 the name of the file that we read the values from More...
 
std::string _type
 the reader type as string More...
 

Detailed Description

class for reading txt files

first line has to give the names of the variables, which are then ordered line by line.

User definable Parameters:

TxtReader/%filename%/{Deliminator}
The deliminator that is used to separate the values. Default is '\t', which is a tab.

TxtReader/%filename%/{EventIdHeader}
The name of the Header under which the Event Id is stored. Default is "".

TxtReader/%filename%/{LinesToSkip}
How many lines do we have to skip before the line appears that contains the headers. Default is 3

Author
Lutz Foucar

Definition at line 41 of file txt_reader.h.

Constructor & Destructor Documentation

TxtReader::TxtReader ( )

constructor

Definition at line 25 of file txt_reader.cpp.

Member Function Documentation

void TxtReader::loadSettings ( )
virtual
bool TxtReader::operator() ( std::ifstream &  file,
CASSEvent event 
)
virtual

read the frms6 file contents put them into cassevent

Returns
true when the workers should work on the filled cassevent, false if not.
Parameters
filethe file that contains the data to be put into the cassevent
eventthe CASSEvent where the data will be put into

Implements cass::FileReader.

Definition at line 57 of file txt_reader.cpp.

References _delim, _eventIdhead, cass::FileReader::_filename, _headers, _split, cass::CASSEvent::devices(), cass::CASSEvent::id(), cass::CASSEvent::MachineData, cass::toString(), and value.

void TxtReader::readHeaderInfo ( std::ifstream &  file)
virtual

read the file header

Parameters
filethe filestream to the header information of the file

Reimplemented from cass::FileReader.

Definition at line 41 of file txt_reader.cpp.

References _delim, cass::FileReader::_filename, _headers, _linesToSkip, _split, cass::Log::add(), info, and cass::Log::VERBOSEINFO.

Member Data Documentation

char cass::TxtReader::_delim
private

the deliminator by which the values are separated in the ascii file

Definition at line 73 of file txt_reader.h.

Referenced by loadSettings(), operator()(), and readHeaderInfo().

std::string cass::TxtReader::_eventIdhead
private

the header name under which the event id is stored

Definition at line 76 of file txt_reader.h.

Referenced by loadSettings(), and operator()().

std::vector<std::string> cass::TxtReader::_headers
private

the value names

Definition at line 67 of file txt_reader.h.

Referenced by operator()(), and readHeaderInfo().

size_t cass::TxtReader::_linesToSkip
private

how many lines should be skipped before reading the header line

Definition at line 79 of file txt_reader.h.

Referenced by loadSettings(), and readHeaderInfo().

Splitter cass::TxtReader::_split
private

a splitter object to split up the lines

Definition at line 70 of file txt_reader.h.

Referenced by operator()(), and readHeaderInfo().


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