Belle II Software  release-08-01-10
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 Connection& connection)
44 {
45  Enum::operator=(connection);
46  return *this;
47 }
48 
49 const Connection& Connection::operator=(const std::string& msg)
50 {
51  if (msg == ONLINE.getLabel()) *this = ONLINE;
52  else if (msg == OFFLINE.getLabel()) *this = OFFLINE;
53  else *this = UNKNOWN;
54  return *this;
55 }
56 
57 const Connection& Connection::operator=(const char* msg)
58 {
59  if (msg != NULL) *this = std::string(msg);
60  else *this = UNKNOWN;
61  return *this;
62 }
63 
65 {
66  if (i == ONLINE.getId()) *this = ONLINE;
67  else if (i == OFFLINE.getId()) *this = OFFLINE;
68  else *this = UNKNOWN;
69  return *this;
70 }
71 
const Connection & operator=(const Connection &connection)
Operator =.
Definition: Connection.cc:43
Abstract base class for different kinds of events.