CFEL - ASG Software Suite  2.5.0
CASS
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cass::FileParser Class Reference

base class for all file parsers More...

#include <file_parser.h>

+ Inheritance diagram for cass::FileParser:
+ Collaboration diagram for cass::FileParser:

Public Types

typedef std::tr1::shared_ptr< FileParsershared_pointer
 typedef the shared pointer of this More...
 
- Public Types inherited from lmf::PausableThread
enum  status_t { running, paused, notstarted }
 enum describing the internal status of the thread More...
 
enum  control_t { _run, _quit, _pause }
 enum describing the control status of the thread More...
 
enum  exception_t {
  NO_EXCEPTION, INVALID_ARGUMENT_EXCEPTION, RUNTIME_ERROR_EXCEPTION, OUT_OF_RANGE_EXCEPTION,
  LOGIC_ERROR_EXCEPTION, STANDART_EXCEPTION, UNKNOWN_EXCEPTION
}
 enum describing which exception was thrown More...
 

Public Member Functions

 FileParser (const filereaderpointerpair_t readerpointerpair, event2positionreaders_t &event2posreader, QReadWriteLock &lock)
 constructor More...
 
virtual ~FileParser ()
 virtual destructor More...
 
virtual const std::string type ()
 
- Public Member Functions inherited from lmf::PausableThread
 PausableThread (control_t control=_run, QObject *parent=0)
 constructor More...
 
virtual ~PausableThread ()
 destructor More...
 
void run ()
 run the thread More...
 
virtual void runthis ()=0
 contains the code to run in the thread More...
 
void pause (bool block=false)
 pause the thread More...
 
void waitUntilPaused ()
 waits until thread is paused More...
 
void resume ()
 resume the thread More...
 
status_t status () const
 return the current status of the thread More...
 
bool shouldQuit () const
 query whether this thread is told to quit More...
 
void rethrowException () const
 rethrow the thrown exception More...
 
exception_t exceptionThrown () const
 
- Public Member Functions inherited from QThread
 QThread (QObject *parent=0)
 
 currentThread ()
 
 HANDLE QThread::currentThreadId()
 
 exec ()
 
 exit (int returnCode=0)
 
 finished ()
 
 idealThreadCount ()
 
 isFinished ()
 
 isRunning ()
 
 msleep (unsigned long msecs)
 
 priority ()
 
 quit ()
 
 run ()
 
 setPriority (Priority priority)
 
 setStackSize (uint stackSize)
 
 setTerminationEnabled (bool enabled=true)
 
 sleep (unsigned long secs)
 
 stackSize ()
 
 start (Priority priority=InheritPriority)
 
 started ()
 
 terminate ()
 
 terminated ()
 
 usleep (unsigned long usecs)
 
 wait (unsigned long time=ULONG_MAX)
 
 yieldCurrentThread ()
 

Static Public Member Functions

static shared_pointer instance (const std::string type, const filereaderpointerpair_t readerpointerpair, event2positionreaders_t &event2posreader, QReadWriteLock &lock)
 create an instance of the requested type More...
 

Protected Member Functions

void savePos (const std::streampos &eventStartPos, const uint64_t eventId)
 put current file position in the eventmap More...
 
- Protected Member Functions inherited from lmf::PausableThread
void pausePoint ()
 point where the thread will be paused More...
 

Protected Attributes

filereaderpointerpair_t _readerpointerpair
 the file pointer More...
 
event2positionreaders_t_event2posreader
 reference to the map containing the beginnings of the event More...
 
QReadWriteLock_lock
 Lock that protects the map. More...
 
- Protected Attributes inherited from lmf::PausableThread
QMutex _pauseMutex
 mutex to wait on until thread is paused More...
 
QWaitCondition _pauseCondition
 wait condition to wait on until thread is resumed More...
 
QWaitCondition _waitUntilPausedCondition
 wait condition to wait unitl thread is paused More...
 
status_t _status
 the internal status of the thread More...
 
control_t _control
 the internal control status of the thread More...
 
size_t _pausecount
 a counter how many threads have pause this thread More...
 
exception_t _exception_thrown
 flag to show that general exception was thrown More...
 
std::invalid_argument _invarg_excep
 the invalid arguemnt exception thrown More...
 
std::runtime_error _runt_excep
 the invalid arguemnt exception thrown More...
 
std::out_of_range _outrange_excep
 the invalid arguemnt exception thrown More...
 
std::logic_error _logic_excep
 the invalid arguemnt exception thrown More...
 

Additional Inherited Members

- Public Slots inherited from lmf::PausableThread
virtual void end ()
 tell the thread to quit More...
 

Detailed Description

base class for all file parsers

Author
Lutz Foucar

Definition at line 29 of file file_parser.h.

Member Typedef Documentation

typedef std::tr1::shared_ptr<FileParser> cass::FileParser::shared_pointer

typedef the shared pointer of this

Definition at line 45 of file file_parser.h.

Constructor & Destructor Documentation

FileParser::FileParser ( const filereaderpointerpair_t  readerpointerpair,
event2positionreaders_t event2posreader,
QReadWriteLock lock 
)

constructor

Parameters
readerpointerpairthe filereader the will read the event from files
event2posreaderreference to container that maps events to the position in file, reader pair vector
lockreference to the protector of the eventlist map

Definition at line 30 of file file_parser.cpp.

FileParser::~FileParser ( )
virtual

virtual destructor

Definition at line 39 of file file_parser.cpp.

Member Function Documentation

FileParser::shared_pointer FileParser::instance ( const std::string  type,
const filereaderpointerpair_t  readerpointerpair,
event2positionreaders_t event2posreader,
QReadWriteLock lock 
)
static

create an instance of the requested type

returns an instance of the right fileparser. To figure out the right fileparser the filname is inspected and depending on the extension the right file parser is created.

Returns
a shared pointer to the requested type
Parameters
typethe type of the parser requested
readerpointerpairthe filereader the will read the event from files
event2posreaderreference to container that maps events to the position in file, reader pair vector
lockreference to the protector of the eventlist map

Definition at line 42 of file file_parser.cpp.

Referenced by cass::MultiFileInput::runthis().

void FileParser::savePos ( const std::streampos &  eventStartPos,
const uint64_t  eventId 
)
protected

put current file position in the eventmap

save the current position of the filestream in the filepointer and put a copy of the file pointer in the eventmap.

Parameters
eventStartPosthe position in the file where the event starts
eventIdthe event id that should be associated with this position

Definition at line 62 of file file_parser.cpp.

References _event2posreader, _lock, _readerpointerpair, cass::Log::add(), cass::toString(), type(), and cass::Log::WARNING.

virtual const std::string cass::FileParser::type ( )
inlinevirtual
Returns
the type of file parser

Reimplemented in cass::ACQIRIS::LMAParser, cass::RAWSSSParser, cass::TxtParser, and cass::Frms6Parser.

Definition at line 69 of file file_parser.h.

Referenced by savePos().

Member Data Documentation

event2positionreaders_t& cass::FileParser::_event2posreader
protected

reference to the map containing the beginnings of the event

Definition at line 87 of file file_parser.h.

Referenced by savePos().

QReadWriteLock& cass::FileParser::_lock
protected

Lock that protects the map.

Definition at line 90 of file file_parser.h.

Referenced by savePos().

filereaderpointerpair_t cass::FileParser::_readerpointerpair
protected

the file pointer

Definition at line 84 of file file_parser.h.

Referenced by savePos().


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