CFEL - ASG Software Suite
2.5.0
CASS
|
file contains the main cass program More...
#include <iostream>
#include <signal.h>
#include <QtCore/QStringList>
#include <QtCore/QCoreApplication>
#include "cass.h"
#include "cass_version.h"
#include "log.h"
#include "input_base.h"
#include "ratemeter.h"
#include "rate_plotter.h"
#include "ringbuffer.hpp"
#include "tcpserver.h"
#include "processor_manager.h"
#include "worker.h"
#include "cass_settings.h"
#include "cl_parser.hpp"
#include "tcp_input.h"
Go to the source code of this file.
Namespaces | |
cass | |
Functions | |
void | cass::endInputThread (int) |
end the input thread More... | |
void | cass::setSignalHandler () |
set up the own handler to react on the sigquit (crtl+ \) signal More... | |
int | main (int argc, char **argv) |
The main program. More... | |
file contains the main cass program
Definition in file cass.cpp.
int main | ( | int | argc, |
char ** | argv | ||
) |
The main program.
construct Qt application object to hold the run loop
register used types as Qt meta type
set up details for QSettings and Co.
create a qsettings object from which one can retrieve the default cass.ini. After parsing one can then set the CASSSettings default object to the user requested .ini file or the keep the default .ini file to use
set up parameters to be retrieved from the command line and parse them with the help of the command line parser object
show help and exit if requested
show version and exit if requested
set the user requested .ini file name
since the settings for the log are now loaded one can now add things to the log
create a ratemeter objects for input and worker and the plotter to plot the rates that are calculated.
create workers and requested inputs which need a ringbuffer for passing the the events from one to the other. Once created connect their terminated and finished signals such that they notify each other about that they are done processing the events. Also create the processor singleton used by the worker to process the events.
connect a own signal handler that acts on when sigquit is sent by linux it will call the end member of the input.
set up the TCP/SOAP server
set up the optional http server
start worker and server threads, then start input and wait until input is done
periodically check if the Workers are still running, while the input is still running. If not all workers are still running quit the input at this point and wait until it is quitted. Then rethrow the reason why the worker have quitted running.
when the input was shut down gratiously, wait until the ringbuffer is empty (thus all events have been processed by the workers)
now stop the worker threads
rethrow the exceptions if any where thrown inside the Input threads
Definition at line 117 of file cass.cpp.
References cass::CommandlineArgumentParser::add(), QCoreApplication::arguments(), QSettings::fileName(), cass::RingBufferSize, QSettings::setDefaultFormat(), cass::setSignalHandler(), QThread::start(), httpServer::start(), QSettings::sync(), and cass::CommandlineArgumentParser::usage().