|
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 (!svc_sendreply(transp, (xdrproc_t)xdr_void, 0))
53 checkResult(errno,
"dispatch thread sending reply to NULLPROC call",ServerSvc);
56 # pragma GCC diagnostic pop
65 if (!svc_sendreply(transp, (xdrproc_t)xdr_int, (caddr_t)&state))
67 checkResult(errno,
"dispatch thread sending reply to GETSTATUS call",ServerSvc);
88 for (
unsigned int iName = 0; iName <
StreamNames.size(); ++iName)
92 if (!svc_sendreply(transp, (xdrproc_t)
xdr_streams, (caddr_t)&XDRStreams))
93 checkResult(errno,
"dispatch thread sending reply to GETSTREAMS call",ServerSvc);
96 xdr_free((xdrproc_t)
xdr_streams,(caddr_t)&XDRStreams);
108 std::ostringstream
msg;
110 msg <<
"Request to return event with void event request structure";
112 svcerr_systemerr(transp);
118 <<
" with existing event " << eventReq->
EventNumber
135 event.isAvailable = false ;
136 event.isIdentical = false ;
137 event.isCompressed = false ;
139 event.RunNumber = currEvtStreamID.
RunNumber();
141 event.NBytes = 0;
event.EventData = NULL ;
144 if (!currEvtStreamID.
isValid()) {
147 if (!svc_sendreply(transp, (xdrproc_t)
xdr_event, (caddr_t)&
event))
148 checkResult(errno,
"dispatch thread sending reply to GETEVENT call",ServerSvc);
152 event.isAvailable = true ;
155 if ( currEvtStreamID.
isSameEvent(reqEvtStreamID) ){
157 event.isIdentical = true ;
160 if (!svc_sendreply(transp, (xdrproc_t)
xdr_event, (caddr_t)&
event))
161 checkResult(errno,
"dispatch thread sending reply to GETEVENT call",ServerSvc);
166 std::string
evt = ServerSvc->
GetEvent( currEvtStreamID );
167 event.EventData =
evt.c_str();
168 event.NBytes = strlen(
evt.c_str())+1;
170 msg <<
"Sending response NEW EVENT (" <<
event.EventNumber <<
","<<
event.RunNumber <<
")" ;
172 if (!svc_sendreply(transp, (xdrproc_t)
xdr_event, (caddr_t)&
event))
173 checkResult(errno,
"dispatch thread sending reply to GETEVENT call",ServerSvc);
186 std::ostringstream
msg;
188 msg <<
"Request to set new event with void or invalid event structure";
190 svcerr_systemerr(transp);
195 msg <<
"Request to set new event " <<
event->EventNumber
196 <<
" from run " <<
event->RunNumber
197 <<
" for stream " <<
event->StreamName;
203 bool_t isSuccess=
false;
209 if (! newEvtStreamID.
isValid()) {
210 msg <<
"Request to set new event with invalid stream name or event/run number";
212 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
213 checkResult(errno,
"dispatch thread sending reply to SETEVENT call",ServerSvc);
218 if ((!
event->EventData ) || (strlen(
event->EventData) == 0)){
219 msg <<
"Request to set new event with invalid event data";
221 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
222 checkResult(errno,
"dispatch thread sending reply to SETEVENT call",ServerSvc);
227 if ( strlen(
event->EventData) !=
event->NBytes -1 ){
228 msg <<
"Event string length does not match claimed number of bytes (null-termination problem?)";
230 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
231 checkResult(errno,
"dispatch thread sending reply to SETEVENT call",ServerSvc);
235 std::string EvtData(
event->EventData);
243 msg <<
"Sending response for set new event: ";
244 if (isSuccess)
msg <<
" SUCCESS!";
else msg <<
" FAILED!";
247 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
248 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