ConfiguredHosts.cpp
Go to the documentation of this file.
1 #include <DatabaseUtils/DAQAppMgr/ConfiguredHosts.h>
2 #include <NovaDatabase/Table.h>
3 #include <NovaDatabase/Util.h>
4 #include <boost/shared_ptr.hpp>
5 
6 namespace NOVADB = nova::database;
7 
8 namespace dbutils {
9 namespace daqappmgr {
10 
11 /**
12  * Creates a new instance based on the specified detector name
13  * (NDOS, NearDet, FarDet) and partition number
14  */
16 ConfiguredHosts(const std::string& detectorName, int partitionNumber,
17  const bool& useDBData)
18 {
19  _hasValidData = false;
21 }
22 
23 /**
24  * Fetches the host with the specified name.
25  */
26 boost::shared_ptr<Host> ConfiguredHosts::
27 getHostByName(const std::string& hostName) const
28 {
29  boost::shared_ptr<Host> hostPtr;
30  if (! _hasValidData) {return hostPtr;}
31 
32  for (int idx = 0; idx < (int) _hostList.size(); ++idx) {
33  if (_hostList[idx]->getHostName() == hostName) {
34  hostPtr = _hostList[idx];
35  break;
36  }
37  }
38 
39  return hostPtr;
40 }
41 
42 /**
43  * Adds the specified type to the list
44  */
46 _addHost(boost::shared_ptr<Host> host)
47 {
48  if (host.get() == 0) {return;}
49 
50  _hasValidData = true;
51 
52  _hostList.push_back(host);
53 }
54 
55 } // end of namespace daqappmgr
56 } // end of namespace dbutils
std::vector< boost::shared_ptr< Host > > _hostList
void _addHost(boost::shared_ptr< Host > host)
boost::shared_ptr< Host > getHostByName(const std::string &hostName) const
ConfiguredHosts(const std::string &detectorName, int partitionNumber=0, const bool &useDBData=false)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154