 |
ATLAS Offline Software
|
Go to the documentation of this file.
27 if (RetVal == 0)
return true ;
30 std::ostringstream
msg;
32 msg <<
"Error in " << Module <<
": " << strerror_r(RetVal, errbuf,
sizeof(errbuf));
48 # pragma GCC diagnostic push
49 # pragma GCC diagnostic ignored "-Wcast-function-type"
51 #if defined(__clang__) && __clang_major__ >= 19
52 # pragma clang diagnostic push
53 # pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
55 if (!svc_sendreply(transp, (xdrproc_t)xdr_void, 0))
57 checkResult(errno,
"dispatch thread sending reply to NULLPROC call",ServerSvc);
59 #if defined(__clang__) && __clang_major__ >= 19
60 # pragma clang diagnostic pop
63 # pragma GCC diagnostic pop
72 if (!svc_sendreply(transp, (xdrproc_t)xdr_int, (caddr_t)&state))
74 checkResult(errno,
"dispatch thread sending reply to GETSTATUS call",ServerSvc);
95 for (
unsigned int iName = 0; iName <
StreamNames.size(); ++iName)
99 if (!svc_sendreply(transp, (xdrproc_t)
xdr_streams, (caddr_t)&XDRStreams))
100 checkResult(errno,
"dispatch thread sending reply to GETSTREAMS call",ServerSvc);
103 xdr_free((xdrproc_t)
xdr_streams,(caddr_t)&XDRStreams);
115 std::ostringstream
msg;
117 msg <<
"Request to return event with void event request structure";
119 svcerr_systemerr(transp);
125 <<
" with existing event " << eventReq->
EventNumber
142 event.isAvailable = false ;
143 event.isIdentical = false ;
144 event.isCompressed = false ;
146 event.RunNumber = currEvtStreamID.
RunNumber();
148 event.NBytes = 0;
event.EventData = NULL ;
151 if (!currEvtStreamID.
isValid()) {
154 if (!svc_sendreply(transp, (xdrproc_t)
xdr_event, (caddr_t)&
event))
155 checkResult(errno,
"dispatch thread sending reply to GETEVENT call",ServerSvc);
159 event.isAvailable = true ;
162 if ( currEvtStreamID.
isSameEvent(reqEvtStreamID) ){
164 event.isIdentical = true ;
167 if (!svc_sendreply(transp, (xdrproc_t)
xdr_event, (caddr_t)&
event))
168 checkResult(errno,
"dispatch thread sending reply to GETEVENT call",ServerSvc);
173 std::string
evt = ServerSvc->
GetEvent( currEvtStreamID );
174 event.EventData =
evt.c_str();
175 event.NBytes = strlen(
evt.c_str())+1;
177 msg <<
"Sending response NEW EVENT (" <<
event.EventNumber <<
","<<
event.RunNumber <<
")" ;
179 if (!svc_sendreply(transp, (xdrproc_t)
xdr_event, (caddr_t)&
event))
180 checkResult(errno,
"dispatch thread sending reply to GETEVENT call",ServerSvc);
193 std::ostringstream
msg;
195 msg <<
"Request to set new event with void or invalid event structure";
197 svcerr_systemerr(transp);
202 msg <<
"Request to set new event " <<
event->EventNumber
203 <<
" from run " <<
event->RunNumber
204 <<
" for stream " <<
event->StreamName;
210 bool_t isSuccess=
false;
216 if (! newEvtStreamID.
isValid()) {
217 msg <<
"Request to set new event with invalid stream name or event/run number";
219 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
220 checkResult(errno,
"dispatch thread sending reply to SETEVENT call",ServerSvc);
225 if ((!
event->EventData ) || (strlen(
event->EventData) == 0)){
226 msg <<
"Request to set new event with invalid event data";
228 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
229 checkResult(errno,
"dispatch thread sending reply to SETEVENT call",ServerSvc);
234 if ( strlen(
event->EventData) !=
event->NBytes -1 ){
235 msg <<
"Event string length does not match claimed number of bytes (null-termination problem?)";
237 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
238 checkResult(errno,
"dispatch thread sending reply to SETEVENT call",ServerSvc);
242 std::string EvtData(
event->EventData);
250 msg <<
"Sending response for set new event: ";
251 if (isSuccess)
msg <<
" SUCCESS!";
else msg <<
" FAILED!";
254 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
255 checkResult(errno,
"dispatch thread sending reply to SETEVENT call",ServerSvc);
void SetNewEvent(SVCXPRT *transp, const Event *event, IServer *const ServerSvc)
Implementation of ONCRPC_SETEVENT_PROC Set a new event for a certain streams.
void ReturnStreams(SVCXPRT *transp, IServer *const ServerSvc)
Implementation of ONCRPC_GETSTREAMS_PROC Return the currently available event streams.
unsigned long EventNumber() const
virtual std::vector< std::string > GetStreamNames() const =0
get the names of all the streams
const char * StreamNameCStr() const
void ReturnState(SVCXPRT *transp, IServer *const ServerSvc)
Implementation of ONCRPC_ATHENASTATUS_PROC Return the current athena status in XDR representation.
virtual int GetState() const =0
get the Status of the application
bool isSameEvent(const EventStreamID &id) const
virtual const EventStreamID GetEventStreamID(const std::string &streamName) const =0
get the current EventStreamID for a particular stream
bool_t xdr_streams(XDR *xdrsp, Streams *streams)
De- and Encoding of Streams_t.
POOL::TEvent event(POOL::TEvent::kClassAccess)
void ReturnEvent(SVCXPRT *transp, const EventRequest *eventReq, IServer *const ServerSvc)
Implementation of ONCRPC_GETEVENT_PROC Return an event from a certain streams.
bool_t xdr_event_req(XDR *xdrsp, EventRequest *eventReq)
De-/Encoding of EventRequest_t.
bool_t xdr_event(XDR *xdrsp, Event *event)
De-/Encoding of Event_t.
Pure abstract interface to provide some athena-indepandant messaging Note that only MSG::Level enum i...
For the client-server communication, each event is uniquely identified by the run number,...
virtual StatusCode UpdateEventForStream(const EventStreamID &, const std::string &)=0
Put this event as new current event for stream given by name.
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
virtual void Message(const MSG::Level level, const std::string &msg) const =0
void ReturnNull(SVCXPRT *transp, IServer *const ServerSvc)
Implementation of NULLPROC Return nothing - server has just been pinged.
Pure abstract interface for all full server implementations.
pthread_key_t ServerSvcKey ATLAS_THREAD_SAFE
bool checkResult(const int RetVal, const std::string &Module, IMessage *const ServerSvc)
Simple result checking routine, that will output an errorMsg throught the ServerSvc if there was an e...
virtual const std::string GetEvent(const EventStreamID &evtStreamID) const =0
get the current event for a particular stream
Define macros for attributes used to control the static checker.
unsigned int RunNumber() const