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

process a file More...

+ Inheritance diagram for cass::FileProcessor:
+ Collaboration diagram for cass::FileProcessor:

Public Types

typedef std::tr1::shared_ptr< FileProcessorshared_pointer
 define 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

 FileProcessor (const string &filename)
 constructor More...
 
void runthis ()
 process the file More...
 
double progress ()
 retrieve the progess within the file More...
 
uint64_t nEventsProcessed ()
 retrieve the number of events processed by this thread More...
 
uint64_t nSkippedEvents ()
 retrieve the number of skipped events by this thread More...
 
- 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...
 
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 ()
 

Private Attributes

string _filename
 the filename to work on More...
 
FileReader::shared_pointer _read
 shared pointer to the actual reader More...
 
ifstream _file
 the file stream More...
 
streampos _filesize
 the size of the file More...
 
uint64_t _counter
 a counter for the events More...
 
uint64_t _skippedcounter
 a counter for the skipped events More...
 

Additional Inherited Members

- Public Slots inherited from lmf::PausableThread
virtual void end ()
 tell the thread to quit More...
 
- Protected Member Functions inherited from lmf::PausableThread
void pausePoint ()
 point where the thread will be paused 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...
 

Detailed Description

process a file

Author
Lutz Foucar

Definition at line 33 of file file_input.cpp.

Member Typedef Documentation

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

define the shared pointer of this

Definition at line 37 of file file_input.cpp.

Constructor & Destructor Documentation

cass::FileProcessor::FileProcessor ( const string &  filename)
inline

constructor

set the filename and initializes all parameters for the thread to be able to process the data

Parameters
filenameThe name of the file to process

load the right reader for the file type depending on its extension

Definition at line 46 of file file_input.cpp.

Member Function Documentation

uint64_t cass::FileProcessor::nEventsProcessed ( )
inline

retrieve the number of events processed by this thread

Returns
the number of processed events

Definition at line 139 of file file_input.cpp.

uint64_t cass::FileProcessor::nSkippedEvents ( )
inline

retrieve the number of skipped events by this thread

Returns
the number of skippted events

Definition at line 145 of file file_input.cpp.

double cass::FileProcessor::progress ( )
inline

retrieve the progess within the file

Returns
the current progress

Definition at line 128 of file file_input.cpp.

void cass::FileProcessor::runthis ( )
inlinevirtual

process the file

get a pointer to the calling thread

make a container with all event ids

iterate through the file until we've reached the filesize

retrieve a new element from the ringbuffer

fill the cassevent object with the contents from the file

check if id is unique, if not skip event

Todo:
count the number of skipped events and make is accessible to rateplotter

give item back to the ringbuffer

Implements lmf::PausableThread.

Definition at line 64 of file file_input.cpp.

References input, and cass::toString().

Member Data Documentation

uint64_t cass::FileProcessor::_counter
private

a counter for the events

Definition at line 161 of file file_input.cpp.

ifstream cass::FileProcessor::_file
private

the file stream

Definition at line 155 of file file_input.cpp.

string cass::FileProcessor::_filename
private

the filename to work on

Definition at line 149 of file file_input.cpp.

streampos cass::FileProcessor::_filesize
private

the size of the file

Definition at line 158 of file file_input.cpp.

FileReader::shared_pointer cass::FileProcessor::_read
private

shared pointer to the actual reader

Definition at line 152 of file file_input.cpp.

uint64_t cass::FileProcessor::_skippedcounter
private

a counter for the skipped events

Definition at line 164 of file file_input.cpp.


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