Belle II Software development
RCNodeDaemon Class Reference

Public Member Functions

 RCNodeDaemon (ConfigFile &config, RCCallback *callback, RCCallback *callback2=NULL, DBInterface *db=NULL)
 
void run ()
 

Private Attributes

std::string m_title
 
NSMNodeDaemon m_daemon
 

Detailed Description

Definition at line 25 of file RCNodeDaemon.h.

Constructor & Destructor Documentation

◆ RCNodeDaemon()

RCNodeDaemon ( ConfigFile config,
RCCallback callback,
RCCallback callback2 = NULL,
DBInterface db = NULL 
)

Definition at line 16 of file RCNodeDaemon.cc.

20{
21 std::string host = config.get("nsm.host");
22 if (host.size() == 0) {
23 LogFile::error("nsm.host is empty");
24 exit(1);
25 }
26 int port = config.getInt("nsm.port");
27 if (port < 0) {
28 LogFile::error("nsm.port is not a positive integer");
29 exit(1);
30 }
31 std::string name = config.get("nsm.nodename");
32 if (name.size() == 0) {
33 LogFile::error("nsm.nodename is empty");
34 exit(1);
35 }
36 callback->setNode(NSMNode(name));
37 std::string rcconfig = config.get("rcconfig");
38 callback->setRunTypeRecord(config.get("runtype.record"));
39 if (rcconfig.size() > 0) {
40 callback->setRCConfig(rcconfig);
41 } else {
42 LogFile::notice("rcconfig is empty");
43 }
44 int timeout = config.getInt("timeout");
45 if (timeout > 0) {
46 callback->setTimeout(timeout);
47 }
48 callback->setCategory(config.get("log.category"));
49 std::string file = config.get("file");
50 std::string dbtable = config.get("dbtable");
51 if (file.size() > 0) {
52 LogFile::info("read file %s", file.c_str());
53 callback->setDBFile(file);
54 }
55 if (dbtable.size() > 0) {
56 LogFile::debug("database.use=%s", config.getBool("database.use") ? "TRUE" : "FALSE");
57 if (config.getBool("database.use") && db != NULL) {
58 callback->setDB(db, dbtable);
59 } else {
60 callback->setDBTable(dbtable);
61 callback->setProvider(config.get("provider.host"),
62 config.getInt("provider.port"));
63 }
64 } else if (file.size() > 0) {
65
66 } else {
67 LogFile::notice("dbtable is empty");
68 }
69 m_daemon.add(callback, host, port);
70 host = config.get("nsm.global.host");
71 port = config.getInt("nsm.global.port");
72 if (callback2 != NULL && host.size() > 0 && port > 0) {
73 callback2->setNode(NSMNode(name));
74 m_daemon.add(callback2, host, port);
75 }
76}

◆ ~RCNodeDaemon()

~RCNodeDaemon ( )
inline

Definition at line 32 of file RCNodeDaemon.h.

32{}

Member Function Documentation

◆ run()

void run ( )

Definition at line 78 of file RCNodeDaemon.cc.

79{
80 m_daemon.run();
81}

Member Data Documentation

◆ m_daemon

NSMNodeDaemon m_daemon
private

Definition at line 39 of file RCNodeDaemon.h.

◆ m_title

std::string m_title
private

Definition at line 38 of file RCNodeDaemon.h.


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