ApplicationType.cpp
Go to the documentation of this file.
1 #include <DatabaseUtils/DAQAppMgr/ApplicationType.h>
2 
3 namespace dbutils {
4 namespace daqappmgr {
5 
6 const std::string ApplicationType::BNEVB_APPTYPE("Buffer Node EVB");
7 const std::string ApplicationType::DL_APPTYPE("Data Logger");
8 const std::string ApplicationType::DCMAPP_APPTYPE("DCM Application");
9 const std::string ApplicationType::GT_APPTYPE("Global Trigger");
10 
11 /**
12  * Creates an instance from the specified values.
13  */
15 ApplicationType(const std::string& typeName,
16  const std::vector<std::string>& exeNameList,
17  const std::string& startCommand,
18  const std::string& rshCommandForStart,
19  const std::string& stopCommand,
20  const std::string& rshCommandForStop,
21  const bool& supportsStatusRequest,
22  const bool& hasAppNameInProcessString) :
23  _typeName(typeName), _exeNameList(exeNameList),
24  _startCommand(startCommand),
25  _rshCommandForStart(rshCommandForStart),
26  _stopCommand(stopCommand),
27  _rshCommandForStop(rshCommandForStop),
28  _supportsStatusRequest(supportsStatusRequest),
29  _hasAppNameInProcessString(hasAppNameInProcessString)
30 {
31 }
32 
33 /**
34  * Tests if the specified instance is equal to this one.
35  */
38 {
39  if (other._supportsStatusRequest &&
40  ! this->_supportsStatusRequest) {return false;}
41  if (! other._supportsStatusRequest &&
42  this->_supportsStatusRequest) {return false;}
43 
44  if (other._hasAppNameInProcessString &&
45  ! this->_hasAppNameInProcessString) {return false;}
46  if (! other._hasAppNameInProcessString &&
47  this->_hasAppNameInProcessString) {return false;}
48 
49  if (other._exeNameList.size() != this->_exeNameList.size()) {return false;}
50  for (int idx = 0; idx < (int) this->_exeNameList.size(); ++idx) {
51  if (other._exeNameList[idx] != this->_exeNameList[idx]) {return false;}
52  }
53 
54  return (other._typeName == this->_typeName &&
55  other._startCommand == this->_startCommand &&
56  other._rshCommandForStart == this->_rshCommandForStart &&
57  other._stopCommand == this->_stopCommand &&
58  other._rshCommandForStop == this->_rshCommandForStop);
59 }
60 
61 /**
62  * Tests if the specified set is not equal to this one.
63  */
66 {
67  return !(*this==other);
68 }
69 
70 /**
71  * Tests if the specified instance is less than this one.
72  */
75 {
76  if (this->_typeName > other._typeName) {return false;}
77  if (this->_typeName < other._typeName) {return true;}
78  // else _typeName is equal
79 
80  if (this->_exeNameList.size() > other._exeNameList.size()) {return false;}
81  if (this->_exeNameList.size() < other._exeNameList.size()) {return true;}
82  for (int idx = 0; idx < (int) this->_exeNameList.size(); ++idx) {
83  if (this->_exeNameList[idx] > other._exeNameList[idx]) {return false;}
84  if (this->_exeNameList[idx] < other._exeNameList[idx]) {return true;}
85  }
86  // else _exeNameList contents are equal
87 
88  if (this->_startCommand > other._startCommand) {return false;}
89  if (this->_startCommand < other._startCommand) {return true;}
90  // else _startCommand is equal
91 
92  if (this->_rshCommandForStart > other._rshCommandForStart) {return false;}
93  if (this->_rshCommandForStart < other._rshCommandForStart) {return true;}
94  // else _rshCommandForStart is equal
95 
96  if (this->_stopCommand > other._stopCommand) {return false;}
97  if (this->_stopCommand < other._stopCommand) {return true;}
98  // else _stopCommand is equal
99 
100  if (this->_rshCommandForStop > other._rshCommandForStop) {return false;}
101  if (this->_rshCommandForStop < other._rshCommandForStop) {return true;}
102  // else _rshCommandForStop is equal
103 
104  if (! this->_supportsStatusRequest &&
105  other._supportsStatusRequest) {return true;}
106  if (this->_supportsStatusRequest &&
107  ! other._supportsStatusRequest) {return false;}
108  // else _supportsStatusRequest is equal
109 
110  if (! this->_hasAppNameInProcessString &&
111  other._hasAppNameInProcessString) {return true;}
112  else {return false;}
113 }
114 
115 } // end of namespace daqappmgr
116 } // end of namespace dbutils
static const std::string DL_APPTYPE
static const std::string BNEVB_APPTYPE
ApplicationType(const std::string &typeName, const std::vector< std::string > &exeNameList, const std::string &startCommand, const std::string &rshCommandForStart, const std::string &stopCommand, const std::string &rshCommandForStop, const bool &supportsStatusRequest, const bool &hasAppNameInProcessString)
static const std::string GT_APPTYPE
bool operator<(const ApplicationType &other) const
static const std::string DCMAPP_APPTYPE
bool operator!=(const ApplicationType &other) const
std::vector< std::string > _exeNameList
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
bool operator==(const ApplicationType &other) const