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

File Input for cass. More...

#include <file_input.h>

+ Inheritance diagram for cass::FileInput:
+ Collaboration diagram for cass::FileInput:

Public Member Functions

void runthis ()
 function with the main loop More...
 
void load ()
 load the parameters used for the multifile input More...
 
double progress ()
 retrieve the averaged progress state of all file processors More...
 
uint64_t eventcounter ()
 retrieve the number of processed events More...
 
uint64_t skippedeventcounter ()
 retrieve the number of skipped processed events More...
 
- Public Member Functions inherited from cass::InputBase
virtual ~InputBase ()
 destructor More...
 
void newEventAdded (const size_t eventsize)
 increment the numer of events received in the ratemeter More...
 
RingBuffer< CASSEvent > & ringbuffer ()
 retrieve a reference to the the ringbuffer More...
 
rbItem_t getNextFillable (unsigned timeout=500)
 retrieve an iterator to the next fillable event 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 ()
 

Static Public Member Functions

static void instance (std::string filelistname, RingBuffer< CASSEvent > &, Ratemeter &ratemeter, Ratemeter &loadmeter, bool quitwhendone, QObject *parent=0)
 create instance of this More...
 
- Static Public Member Functions inherited from cass::InputBase
static shared_pointer instance ()
 get the signelton instance More...
 
static shared_pointer::element_type & reference ()
 get reference to the singelton instance More...
 

Private Types

typedef std::vector< std::tr1::shared_ptr< FileProcessor > > fileProcessors_t
 define the container for all file processors More...
 

Private Member Functions

 FileInput (std::string filelistname, RingBuffer< CASSEvent > &, Ratemeter &ratemeter, Ratemeter &loadmeter, bool quitwhendone, QObject *parent=0)
 constructor More...
 

Private Attributes

bool _parallelize
 flag that tells the input should analyze the files in parallel More...
 
bool _quitWhenDone
 flag to tell the thread to quit when its done with all files More...
 
std::string _filelistname
 name of the file containing all files that we need to process More...
 
fileProcessors_t _fProcs
 the file processor container More...
 

Additional Inherited Members

- Public Types inherited from cass::InputBase
typedef std::tr1::shared_ptr< InputBaseshared_pointer
 shared pointer of this type More...
 
typedef RingBuffer< CASSEvent >::iter_type rbItem_t
 define an item in the ringbuffer 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 Slots inherited from lmf::PausableThread
virtual void end ()
 tell the thread to quit More...
 
- Public Attributes inherited from cass::InputBase
QMutex lock
 a mutex so that external program can lock access to this More...
 
- Protected Member Functions inherited from cass::InputBase
 InputBase (RingBuffer< CASSEvent > &ringbuffer, Ratemeter &ratemeter, Ratemeter &loadmeter, QObject *parent=0)
 protected constructor since it should be a singelton More...
 
- Protected Member Functions inherited from lmf::PausableThread
void pausePoint ()
 point where the thread will be paused More...
 
- Protected Attributes inherited from cass::InputBase
RingBuffer< CASSEvent > & _ringbuffer
 reference to the ringbuffer More...
 
Ratemeter_ratemeter
 ratemeter to measure the rate More...
 
Ratemeter_loadmeter
 meter to measure the data load 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...
 
- Static Protected Attributes inherited from cass::InputBase
static shared_pointer _instance
 singelton instance More...
 

Detailed Description

File Input for cass.

This class will be used in offline modus. I will take an string that contains a filename. In the file that the filename points to has to be a list with files, that one wants to analyze. The filename name must be passed to the program with the -i parameter.

For each file in the filelist it will open the file, and call the readers to extract the data from the file.

User definable Parameters:
FileInput/{Parallelize}
When true, it will read the files on the fileinput list in parallel. Default is false.
Author
Lutz Foucar

Definition at line 41 of file file_input.h.

Member Typedef Documentation

typedef std::vector<std::tr1::shared_ptr<FileProcessor> > cass::FileInput::fileProcessors_t
private

define the container for all file processors

Definition at line 115 of file file_input.h.

Constructor & Destructor Documentation

FileInput::FileInput ( std::string  filelistname,
RingBuffer< CASSEvent > &  ringbuffer,
Ratemeter ratemeter,
Ratemeter loadmeter,
bool  quitwhendone,
QObject parent = 0 
)
private

constructor

Parameters
filelistnamename of the file containing all files that should be processed
ringbufferreference to the ringbuffer containing the CASSEvents
ratemeterreference to the ratemeter to measure the rate of the input
loadmeterreference to the ratemeter to measure the load of the input
quitwhendoneflag that tells this class that it should quit the Program when its done reading all events
parentThe parent QT Object of this class

Definition at line 180 of file file_input.cpp.

References cass::Log::add(), load(), and cass::Log::VERBOSEINFO.

Member Function Documentation

uint64_t FileInput::eventcounter ( )
virtual

retrieve the number of processed events

Returns
number of processed events

Reimplemented from cass::InputBase.

Definition at line 281 of file file_input.cpp.

References _fProcs.

Referenced by runthis().

void FileInput::instance ( std::string  filelistname,
RingBuffer< CASSEvent > &  ringbuffer,
Ratemeter ratemeter,
Ratemeter loadmeter,
bool  quitwhendone,
QObject parent = 0 
)
static

create instance of this

Parameters
filelistnamename of the file containing all files that should be processed
ringbufferreference to the ringbuffer containing the CASSEvents
ratemeterreference to the ratemeter to measure the rate of the input
loadmeterreference to the ratemeter to measure the load of the input
quitwhendoneflag that tells this class that it should quit the Program when its done reading all events
parentThe parent QT Object of this class

Definition at line 169 of file file_input.cpp.

void FileInput::load ( )
virtual

load the parameters used for the multifile input

Implements cass::InputBase.

Definition at line 193 of file file_input.cpp.

References _parallelize, QSettings::beginGroup(), and QSettings::value().

Referenced by FileInput().

double FileInput::progress ( )
virtual

retrieve the averaged progress state of all file processors

Returns
the processing progress

Reimplemented from cass::InputBase.

Definition at line 273 of file file_input.cpp.

References _fProcs.

void FileInput::runthis ( )
virtual

function with the main loop

retrieve all files in a list from the file

go through the list of files and create a processor for each file and add them to the list of processors

if there was such a file then we want to load it

process the files using the processors

Note
we don't need to check for quitting at this point and the loop below because the threads themselves will check if the input should quit and if it does they will shut down graciously, thus wait will only wait until all the threads are finished, no need to shortcut by not starting the threads. Also because using the shortcuts in these loops will prevent gathering the correct information about how many events have been analyzed so far.

wait until the processors are done and gather information about the number of events they processed.

Implements cass::InputBase.

Definition at line 200 of file file_input.cpp.

References _filelistname, _fProcs, _parallelize, _quitWhenDone, lmf::PausableThread::_status, cass::Log::add(), cass::Log::ERROR, eventcounter(), QFileInfo::exists(), QString::fromStdString(), cass::Log::INFO, info, lmf::PausableThread::running, lmf::PausableThread::shouldQuit(), QThread::sleep(), cass::toString(), and cass::Log::VERBOSEINFO.

uint64_t FileInput::skippedeventcounter ( )
virtual

retrieve the number of skipped processed events

Returns
number of processed events

Reimplemented from cass::InputBase.

Definition at line 289 of file file_input.cpp.

References _fProcs.

Member Data Documentation

std::string cass::FileInput::_filelistname
private

name of the file containing all files that we need to process

Definition at line 112 of file file_input.h.

Referenced by runthis().

fileProcessors_t cass::FileInput::_fProcs
private

the file processor container

Definition at line 118 of file file_input.h.

Referenced by eventcounter(), progress(), runthis(), and skippedeventcounter().

bool cass::FileInput::_parallelize
private

flag that tells the input should analyze the files in parallel

Definition at line 106 of file file_input.h.

Referenced by load(), and runthis().

bool cass::FileInput::_quitWhenDone
private

flag to tell the thread to quit when its done with all files

Definition at line 109 of file file_input.h.

Referenced by runthis().


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