-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRAMS7200Main.cxx
75 lines (61 loc) · 1.75 KB
/
RAMS7200Main.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/** © Copyright 2022 CERN
*
* This software is distributed under the terms of the
* GNU Lesser General Public Licence version 3 (LGPL Version 3),
* copied verbatim in the file “LICENSE”
*
* In applying this licence, CERN does not waive the privileges
* and immunities granted to it by virtue of its status as an
* Intergovernmental Organization or submit itself to any jurisdiction.
*
* Author: Adrien Ledeul (HSE)
*
**/
#include <RAMS7200Drv.hxx>
#include <RAMS7200Resources.hxx>
#include "Common/Logger.hxx"
#include "Common/Constants.hxx"
#include <signal.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
// an instance of our own Resources class is needed
RAMS7200Resources& resources = RAMS7200Resources::GetInstance();
resources.init(argc, argv);
RAMS7200Resources::setDriverType(Common::Constants::getDrvName().c_str());
// the user wants to know std. commandline options
if ( resources.getHelpFlag() )
{
resources.printHelp();
return 0;
}
// the user wants to know std. debug flags
if ( resources.getHelpDbgFlag() )
{
resources.printHelpDbg();
return 0;
}
// the user wants to know std. report flags
if ( resources.getHelpReportFlag() )
{
resources.printHelpReport();
return 0;
}
RAMS7200Drv *driver = nullptr;
try{
// handle std. signals
signal(SIGINT, Manager::sigHdl);
signal(SIGTERM, Manager::sigHdl);
// a pointer is needed, since the Manager dtor does a delete
RAMS7200Drv *driver = new RAMS7200Drv;
driver->mainProcedure(argc, argv);
return 0;
}
catch(std::exception& e){
Common::Logger::globalWarning("Exception");
if(driver)
driver->exit(0);
Common::Logger::globalError(e.what());
}
return 0;
}