Public Member Functions | Protected Attributes | Private Attributes | List of all members
novaddt::DDTRC Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-02-24/OnlineCalibration/online/DDTRC.h"

Inheritance diagram for novaddt::DDTRC:
novaddt::Responder< rcm::StatusRequest, rcm::StatusResponse > novaddt::Responder< rcm::RolloverRunRequest, rcm::RolloverRunResponse > novaddt::Responder< rcm::BeginRunRequest, rcm::BeginRunResponse > novaddt::Lockable novaddt::Lockable novaddt::Lockable novaddt::DDTRCService

Public Member Functions

 DDTRC (std::string applicationName, int partNumber)
 
 ~DDTRC ()
 
virtual void handle (const rcm::StatusRequest &message) override
 
virtual void handle (const rcm::RolloverRunRequest &message) override
 
virtual void handle (const rcm::BeginRunRequest &message) override
 
boost::shared_ptr< rcm::StatusResponse > handleMessage (boost::shared_ptr< rcm::StatusRequest > message)
 
boost::shared_ptr< rcm::RolloverRunResponse > handleMessage (boost::shared_ptr< rcm::RolloverRunRequest > message)
 
boost::shared_ptr< rcm::BeginRunResponse > handleMessage (boost::shared_ptr< rcm::BeginRunRequest > message)
 

Protected Attributes

int _runNumber
 
int _subrunNumber
 
boost::mutex _callbackMutex
 
boost::mutex _callbackMutex
 
boost::mutex _callbackMutex
 

Private Attributes

std::string _applicationName
 
boost::shared_ptr< novadaq::rcclient::RunControlReceiver > _rcReceiver
 
boost::shared_ptr< mf::Presence > _mfPresence
 
int _partNumber
 

Detailed Description

Definition at line 58 of file DDTRC.h.

Constructor & Destructor Documentation

novaddt::DDTRC::DDTRC ( std::string  applicationName,
int  partNumber 
)

Creates an instance with the specified application name.

Definition at line 17 of file DDTRC.cxx.

References _partNumber, _rcReceiver, allTimeWatchdog::endl, LogInfo, and mf::SetModuleName().

17  :
18  _applicationName(applicationName),_partNumber(partNumber) {
19 
20  // message facility already started my main program, just SetModuleName
21  mf::SetModuleName("DDTRC");
22 
23  std::vector<std::string> bcastTargets;
24  bcastTargets.push_back(base::RmsDestination::ALL_ELEMENT_TARGET);
25 
26  _rcReceiver.reset(new novadaq::rcclient::RunControlReceiver(applicationName, bcastTargets));
27 
28  // Use partition number from config globals - NovaGlovalTrigger only
29  // exists in one partition at a time
30 
31  // Set up the messages this program listens for
32  _rcReceiver->addListener<rcm::StatusRequest,
33  Responder<rcm::StatusRequest,rcm::StatusResponse>,
34  rcm::StatusResponse>
35  (_partNumber, this);
36 
37  _rcReceiver->addListener<rcm::RolloverRunRequest,
38  Responder<rcm::RolloverRunRequest,rcm::RolloverRunResponse>,
39  rcm::RolloverRunResponse>
40  (_partNumber, this);
41 
42  _rcReceiver->addListener<rcm::BeginRunRequest,
43  Responder<rcm::BeginRunRequest,rcm::BeginRunResponse>,
44  rcm::BeginRunResponse>
45  (_partNumber, this);
46 
47 
48  ::mf::LogInfo("Progress") << "DDTRC created" << endl;
49 }
boost::shared_ptr< novadaq::rcclient::RunControlReceiver > _rcReceiver
Definition: DDTRC.h:78
int _partNumber
Definition: DDTRC.h:80
void SetModuleName(std::string const &)
std::string _applicationName
Definition: DDTRC.h:77
novaddt::DDTRC::~DDTRC ( )

Destructor: clean up anything that we have allocated.

Definition at line 55 of file DDTRC.cxx.

References _partNumber, _rcReceiver, allTimeWatchdog::endl, and LogInfo.

55  {
56  if (_rcReceiver.get() != 0) {
57  _rcReceiver->disconnectFromPartition(_partNumber);
58  _rcReceiver.reset();
59  }
60  ::mf::LogInfo("Progress") << "DDTRC stopped" << endl;
61 }
boost::shared_ptr< novadaq::rcclient::RunControlReceiver > _rcReceiver
Definition: DDTRC.h:78
int _partNumber
Definition: DDTRC.h:80

Member Function Documentation

void novaddt::DDTRC::handle ( const rcm::StatusRequest &  message)
overridevirtual

Handle run control messages

Implements novaddt::Responder< rcm::StatusRequest, rcm::StatusResponse >.

Definition at line 81 of file DDTRC.cxx.

References allTimeWatchdog::endl, and LogInfo.

82 {
83  ::mf::LogInfo("Progress") << "Status heartbeat"<<std::endl;
84 }
void novaddt::DDTRC::handle ( const rcm::RolloverRunRequest &  message)
overridevirtual

Implements novaddt::Responder< rcm::RolloverRunRequest, rcm::RolloverRunResponse >.

Definition at line 72 of file DDTRC.cxx.

References _runNumber, allTimeWatchdog::endl, and LogInfo.

73 {
74  ::mf::LogInfo("Progress") << "Run rolling over:"<<_runNumber
75  <<"->"<<message.newRunNumber
76  << " on partition #" << message.header.partitionNumber
77  << std::endl;
78  _runNumber=message.newRunNumber;
79 }
int _runNumber
Definition: DDTRC.h:84
void novaddt::DDTRC::handle ( const rcm::BeginRunRequest &  message)
overridevirtual

Implements novaddt::Responder< rcm::BeginRunRequest, rcm::BeginRunResponse >.

Definition at line 64 of file DDTRC.cxx.

References _runNumber, allTimeWatchdog::endl, and LogInfo.

65 {
66  ::mf::LogInfo("Progress") << "Run Start:"<<message.runNumber
67  << " on partition #" << message.header.partitionNumber
68  << std::endl;
69  _runNumber=message.runNumber;
70 }
int _runNumber
Definition: DDTRC.h:84
boost::shared_ptr<rcm::StatusResponse > novaddt::Responder< rcm::StatusRequest , rcm::StatusResponse >::handleMessage ( boost::shared_ptr< rcm::StatusRequest >  message)
inlineinherited

Definition at line 42 of file DDTRC.h.

42  {
43  boost::mutex::scoped_lock sl(_callbackMutex);
44  // create the reply
45  try{
46  handle(*message);
47  }
48  catch(std::exception e){
49  return Response<response_t>(1,std::string("Reques failed: ")+e.what());
50  }
51 
52  return Response<response_t>(0,"Success");
53  }
virtual void handle(const rcm::StatusRequest &request)=0
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
boost::mutex _callbackMutex
Definition: DDTRC.h:17
Float_t e
Definition: plot.C:35
enum BeamMode string
boost::shared_ptr<rcm::RolloverRunResponse > novaddt::Responder< rcm::RolloverRunRequest , rcm::RolloverRunResponse >::handleMessage ( boost::shared_ptr< rcm::RolloverRunRequest >  message)
inlineinherited

Definition at line 42 of file DDTRC.h.

42  {
43  boost::mutex::scoped_lock sl(_callbackMutex);
44  // create the reply
45  try{
46  handle(*message);
47  }
48  catch(std::exception e){
49  return Response<response_t>(1,std::string("Reques failed: ")+e.what());
50  }
51 
52  return Response<response_t>(0,"Success");
53  }
virtual void handle(const rcm::RolloverRunRequest &request)=0
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
boost::mutex _callbackMutex
Definition: DDTRC.h:17
Float_t e
Definition: plot.C:35
enum BeamMode string
boost::shared_ptr<rcm::BeginRunResponse > novaddt::Responder< rcm::BeginRunRequest , rcm::BeginRunResponse >::handleMessage ( boost::shared_ptr< rcm::BeginRunRequest >  message)
inlineinherited

Definition at line 42 of file DDTRC.h.

References novaddt::Lockable::_callbackMutex, e, datagram_client::sl, and string.

42  {
43  boost::mutex::scoped_lock sl(_callbackMutex);
44  // create the reply
45  try{
46  handle(*message);
47  }
48  catch(std::exception e){
49  return Response<response_t>(1,std::string("Reques failed: ")+e.what());
50  }
51 
52  return Response<response_t>(0,"Success");
53  }
virtual void handle(const rcm::BeginRunRequest &request)=0
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
boost::mutex _callbackMutex
Definition: DDTRC.h:17
Float_t e
Definition: plot.C:35
enum BeamMode string

Member Data Documentation

std::string novaddt::DDTRC::_applicationName
private

Definition at line 77 of file DDTRC.h.

boost::mutex novaddt::Lockable::_callbackMutex
mutableprotectedinherited
boost::mutex novaddt::Lockable::_callbackMutex
mutableprotectedinherited
boost::mutex novaddt::Lockable::_callbackMutex
mutableprotectedinherited
boost::shared_ptr<mf::Presence> novaddt::DDTRC::_mfPresence
private

Definition at line 79 of file DDTRC.h.

int novaddt::DDTRC::_partNumber
private

Definition at line 80 of file DDTRC.h.

Referenced by DDTRC(), and ~DDTRC().

boost::shared_ptr<novadaq::rcclient::RunControlReceiver> novaddt::DDTRC::_rcReceiver
private

Definition at line 78 of file DDTRC.h.

Referenced by DDTRC(), and ~DDTRC().

int novaddt::DDTRC::_runNumber
protected

Definition at line 84 of file DDTRC.h.

Referenced by handle(), and novaddt::DDTRCService::Run().

int novaddt::DDTRC::_subrunNumber
protected

Definition at line 85 of file DDTRC.h.

Referenced by novaddt::DDTRCService::Subrun().


The documentation for this class was generated from the following files: