Belle II Software  release-06-01-15
Connection.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include "daq/slc/base/Connection.h"
9 
10 using namespace Belle2;
11 
12 const Connection Connection::ONLINE(10000, "ONLINE");
13 const Connection Connection::OFFLINE(20000, "OFFLINE");
14 
15 Connection::Connection() : Enum()
16 {
17 
18 }
19 
20 Connection::Connection(const Enum& st)
21  : Enum(st.getId(), st.getLabel())
22 {
23 
24 }
25 
26 Connection::Connection(const Connection& st)
27  : Enum(st.getId(), st.getLabel())
28 {
29 
30 }
31 
32 Connection::Connection(int id, const char* label)
33  : Enum(id, label)
34 {
35 
36 }
37 
38 Connection::~Connection()
39 {
40 
41 }
42 
43 const Connection& Connection::operator=(const std::string& msg)
44 {
45  if (msg == ONLINE.getLabel()) *this = ONLINE;
46  else if (msg == OFFLINE.getLabel()) *this = OFFLINE;
47  else *this = UNKNOWN;
48  return *this;
49 }
50 
51 const Connection& Connection::operator=(const char* msg)
52 {
53  if (msg != NULL) *this = std::string(msg);
54  else *this = UNKNOWN;
55  return *this;
56 }
57 
58 const Connection& Connection::operator=(int i)
59 {
60  if (i == ONLINE.getId()) *this = ONLINE;
61  else if (i == OFFLINE.getId()) *this = OFFLINE;
62  else *this = UNKNOWN;
63  return *this;
64 }
65 
Abstract base class for different kinds of events.