ATLAS Offline Software
Loading...
Searching...
No Matches
StreamToServerTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7namespace JiveXML {
8
14 StreamToServerTool::StreamToServerTool( const std::string& type , const std::string& name, const IInterface* p):
15 AthAlgTool(type,name,p),
16 m_ServerSvc("JiveXML::ONCRPCServerSvc",name){
17
18 //Provide interface
19 declareInterface<IStreamTool>(this);
20
22 declareProperty("StreamName", m_StreamName = "default");
24 declareProperty("ServerService", m_ServerSvc );
25 }
26
31
32 //Make sure we can get hold of the server and the online event displays service
33 if (m_ServerSvc.retrieve().isFailure()){
34 ATH_MSG_ERROR("Unable to initialize server service with name " << m_ServerSvc.name());
35 return StatusCode::FAILURE;
36 }
37
38 if( m_onlineEDsvc.retrieve().isFailure()){
39 ATH_MSG_ERROR("Could not locate the online event displays service");
40 return StatusCode::FAILURE;
41 }
42
43 return StatusCode::SUCCESS;
44 }
45
50 return StatusCode::SUCCESS;
51 }
52
59 StatusCode StreamToServerTool::StreamEvent( const unsigned long EventNumber,
60 const unsigned int RunNumber,
61 const std::ostringstream* const EventBuffer ) {
62 m_StreamName = m_onlineEDsvc->getStreamName();
63 ATH_MSG_VERBOSE("Streaming event Number " << EventNumber
64 << " from run Number " << RunNumber
65 << " to stream " << m_StreamName
66 << " on " << m_ServerSvc.name() << " service");
67
69 EventStreamID evtStreamID(EventNumber,RunNumber,m_StreamName);
70
72 return m_ServerSvc->UpdateEventForStream(evtStreamID,EventBuffer->str());
73 }
74
75} //namespace
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
For the client-server communication, each event is uniquely identified by the run number,...
Definition EventStream.h:19
virtual StatusCode initialize()
Initialize.
ServiceHandle< IOnlineEventDisplaysSvc > m_onlineEDsvc
StreamToServerTool(const std::string &, const std::string &, const IInterface *)
Constructor.
std::string m_StreamName
Stream name under which these events shall appear.
virtual StatusCode StreamEvent(const unsigned long EventNumber, const unsigned int RunNumber, const std::ostringstream *const EventBuffer)
Stream one event.
ServiceHandle< IServerSvc > m_ServerSvc
Handle to the server that this tools shall stream events to.
virtual StatusCode finalize()
Finalize.
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.