17 base_class ( name, sl ),
21 declareProperty(
"Hostname",
m_hostName=
"localhost",
"The name of the host the external server is running on [ default: \"localhost\" ]");
22 declareProperty(
"Timeout",
m_timeOut=10,
"Timeout when calling the server in seconds [ default: 10 ]");
40 if (Service::initialize().isFailure())
return StatusCode::FAILURE;
43 msg().setLevel(outputLevel());
51 return StatusCode::SUCCESS;
73 return StatusCode::FAILURE;
78# pragma GCC diagnostic push
79# pragma GCC diagnostic ignored "-Wcast-function-type"
81#if defined(__clang__) && __clang_major__ >= 19
82# pragma clang diagnostic push
83# pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
86 clnt_stat ret = clnt_call(
m_client, NULLPROC, (xdrproc_t)xdr_void, NULL,
88#if defined(__clang__) && __clang_major__ >= 19
89# pragma clang diagnostic pop
92# pragma GCC diagnostic pop
96 if (ret != RPC_SUCCESS){
102 return StatusCode::FAILURE;
108 return StatusCode::SUCCESS;
116 struct timeval timeout = { 0, 0 };
120 timeout.tv_sec =
static_cast<long>(
m_timeOut);
122 timeout.tv_usec =
static_cast<long>((
m_timeOut - timeout.tv_sec)*1e6);
136 return StatusCode::SUCCESS;
152 return StatusCode::SUCCESS;
165 ATH_MSG_ERROR(
"Invalid event stream identifier - cannot add event" );
166 return StatusCode::FAILURE;
172 event.isAvailable = false ;
event.isIdentical = false ;
event.isCompressed = false ;
173 event.RunNumber = evtStreamID.
RunNumber();
175 event.StreamName=strdup(evtStreamID.
StreamName().c_str());
176 event.NBytes = strlen(eventStr.c_str())+1;
177 event.EventData = strdup(eventStr.c_str());
179 ATH_MSG_VERBOSE(
"Created event structure for event " << event.EventNumber
180 <<
" from run " << event.RunNumber
181 <<
" to be put in stream " << event.StreamName
182 <<
" with " << event.NBytes <<
" bytes" );
189 <<
" from run " << evtStreamID.
RunNumber() );
192 auto *p1 =
const_cast<char*
>(
event.StreamName);
193 auto *p2 =
const_cast<char*
>(
event.EventData);
196 return StatusCode::FAILURE;
200 bool isSuccess =
false;
202 (xdrproc_t)xdr_bool,(caddr_t)&isSuccess,
GetTimeout());
205 if (ret != RPC_SUCCESS){
209 <<
" from run " << evtStreamID.
RunNumber() );
210 return StatusCode::FAILURE;
218 <<
" from run " << evtStreamID.
RunNumber() );
219 return StatusCode::FAILURE;
226 <<
" from run " << evtStreamID.
RunNumber() );
229 xdr_free((xdrproc_t)
xdr_event,(caddr_t)&event);
231 return StatusCode::SUCCESS;
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ONCRPC_SETEVENT_PROC
For the client-server communication, each event is uniquely identified by the run number,...
unsigned int RunNumber() const
unsigned long EventNumber() const
const std::string & StreamName() const
virtual StatusCode initialize() override
Gaudi default methods.
StatusCode ReleaseClient()
Destroy the private client handle.
StatusCode GetClient()
Obtain a client handle by.
virtual StatusCode finalize() override
Finalize - called once at the end.
virtual ~ExternalONCRPCServerSvc()
Destructor.
virtual StatusCode UpdateEventForStream(const EventStreamID &evtStreamID, const std::string &event) override
Put this event as new current event for stream given by name.
struct timeval GetTimeout()
Convert timeout double in seconds to struct timeval.
ExternalONCRPCServerSvc(const std::string &name, ISvcLocator *sl)
Default constructor.
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
bool_t xdr_event(XDR *xdrsp, Event *event)
De-/Encoding of Event_t.