Belle II Software  release-05-02-19
Connection.cc
1 #include "daq/slc/base/Connection.h"
2 
3 using namespace Belle2;
4 
5 const Connection Connection::ONLINE(10000, "ONLINE");
6 const Connection Connection::OFFLINE(20000, "OFFLINE");
7 
8 Connection::Connection() : Enum()
9 {
10 
11 }
12 
13 Connection::Connection(const Enum& st)
14  : Enum(st.getId(), st.getLabel())
15 {
16 
17 }
18 
19 Connection::Connection(const Connection& st)
20  : Enum(st.getId(), st.getLabel())
21 {
22 
23 }
24 
25 Connection::Connection(int id, const char* label)
26  : Enum(id, label)
27 {
28 
29 }
30 
31 Connection::~Connection()
32 {
33 
34 }
35 
36 const Connection& Connection::operator=(const std::string& msg)
37 {
38  if (msg == ONLINE.getLabel()) *this = ONLINE;
39  else if (msg == OFFLINE.getLabel()) *this = OFFLINE;
40  else *this = UNKNOWN;
41  return *this;
42 }
43 
44 const Connection& Connection::operator=(const char* msg)
45 {
46  if (msg != NULL) *this = std::string(msg);
47  else *this = UNKNOWN;
48  return *this;
49 }
50 
51 const Connection& Connection::operator=(int i)
52 {
53  if (i == ONLINE.getId()) *this = ONLINE;
54  else if (i == OFFLINE.getId()) *this = OFFLINE;
55  else *this = UNKNOWN;
56  return *this;
57 }
58 
Belle2::Enum
Definition: Enum.h:12
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Connection
Definition: Connection.h:12