ApplicationInstance.h
Go to the documentation of this file.
1 #ifndef _DBUTILS_DAQAPPMGR_APPLICATIONINSTANCE_H
2 #define _DBUTILS_DAQAPPMGR_APPLICATIONINSTANCE_H
3 
4 #include <DatabaseUtils/DAQAppMgr/ApplicationType.h>
5 #include <DatabaseUtils/DAQAppMgr/Host.h>
6 #include <DatabaseUtils/SimpleParameterSet.h>
7 #include <boost/shared_ptr.hpp>
8 #include <string>
9 
10 namespace dbutils {
11 namespace daqappmgr {
12 
13 /**
14  * Simple container class for the information that describes
15  * an instance of a DAQ application.
16  *
17  * @author Kurt Biery
18  * @version $Revision: 1.5.12.1 $ $Date: 2019/09/27 00:07:03 $
19  */
20 
22 
23  public:
24 
25  // ********************
26  // *** Constructors ***
27  // ********************
28 
29  ApplicationInstance(const std::string& appName,
30  const std::string& typeName,
31  const std::string& hostName,
32  boost::shared_ptr<ApplicationType> typePtr =
33  boost::shared_ptr<ApplicationType>(),
34  boost::shared_ptr<Host> hostPtr =
35  boost::shared_ptr<Host>(),
36  const bool& isEnabled = true,
37  const int& monitorMSec = 10000);
38 
39  ApplicationInstance(const ApplicationInstance& appInstance);
40 
41  // *****************
42  // *** Accessors ***
43  // *****************
44 
45  std::string getAppName() const {return _appName;}
46  std::string getTypeName() const {return _typeName;}
47  std::string getHostName() const {return _hostName;}
48  boost::shared_ptr<ApplicationType> getTypePtr() const {
49  return _typePtr;
50  }
51  boost::shared_ptr<Host> getHostPtr() const {
52  return _hostPtr;
53  }
54  bool isEnabled() const {return _isEnabled;}
55 
56  template <class T>
57  bool getParameter(const std::string& key, T& resultValue) const {
58  if (_additionalParams.get() == 0) {return false;}
59  return _additionalParams->get(key, resultValue);
60  }
61 
62  int getMonitorMSec() const { return _monitorMSec; }
63 
64  // *****************
65  // *** Modifiers ***
66  // *****************
67 
68  void setTypePtr(boost::shared_ptr<ApplicationType> typePtr) {
69  _typePtr = typePtr;
70  }
71  void setHostPtr(boost::shared_ptr<Host> hostPtr) {
72  _hostPtr = hostPtr;
73  }
75  SimpleParameterSet> additionalParams) {
76  _additionalParams = additionalParams;
77  }
78 
79  // *****************
80  // *** Operators ***
81  // *****************
82 
83  bool operator==(const ApplicationInstance& other) const;
84  bool operator!=(const ApplicationInstance& other) const;
85  bool operator<(const ApplicationInstance& other) const;
86 
87  private:
88 
92  boost::shared_ptr<ApplicationType> _typePtr;
93  boost::shared_ptr<Host> _hostPtr;
94  boost::shared_ptr<dbutils::SimpleParameterSet> _additionalParams;
95  bool _isEnabled;
97 
98 };
99 
100 } // end of namespace daqappmgr
101 } // end of namespace dbutils
102 
103 #endif
boost::shared_ptr< ApplicationType > _typePtr
bool operator!=(const ApplicationInstance &other) const
void setHostPtr(boost::shared_ptr< Host > hostPtr)
std::shared_ptr< T > shared_ptr
Definition: memory.h:15
boost::shared_ptr< Host > getHostPtr() const
bool operator<(const ApplicationInstance &other) const
boost::shared_ptr< dbutils::SimpleParameterSet > _additionalParams
bool operator==(const ApplicationInstance &other) const
bool getParameter(const std::string &key, T &resultValue) const
void setTypePtr(boost::shared_ptr< ApplicationType > typePtr)
ApplicationInstance(const std::string &appName, const std::string &typeName, const std::string &hostName, boost::shared_ptr< ApplicationType > typePtr=boost::shared_ptr< ApplicationType >(), boost::shared_ptr< Host > hostPtr=boost::shared_ptr< Host >(), const bool &isEnabled=true, const int &monitorMSec=10000)
double T
Definition: Xdiff_gwt.C:5
void setParameterSet(boost::shared_ptr< dbutils::SimpleParameterSet > additionalParams)
boost::shared_ptr< ApplicationType > getTypePtr() const
enum BeamMode string