1#ifndef DISTBOSS_READER_RPC_CC
2#define DISTBOSS_READER_RPC_CC
10 : DimRpc(svrName.c_str(),
"I",
"I"),
15 sem_init(&m_sem, 0, 0);
18 m_svrName = svrName.substr( svrName.find_last_of(
'/')+1 );
28 for (std::map<int, AutoEnlargeBuffer*>::iterator it = m_evtBak.begin(); it != m_evtBak.end(); ++it) {
32 std::cout <<
"[" << m_svrName <<
"] Terminated. Total events processed: " << m_evtDone << std::endl;
40 int nClients = dis_get_n_clients(itsIdOut);
43 while ( nClients > 0 ) {
49 nClients = dis_get_n_clients(itsIdOut);
58 int clientId = DimServer::getClientId();
68 if ( m_stopFlag != 0 ) {
69 throw RawExMessage((
"["+ m_svrName+
"] Server stopflag is set, now waiting clients to exit!").c_str());
71 m_pEvt = m_freader->nextEvent();
74 if ( ++m_stopFlag < 3 ) e.
print();
76 setData( (
int&)m_outCode );
77 if ( m_stopFlag == 1 ) sem_post(&m_sem);
81 setData((
void*)m_pEvt, (m_pEvt[1]*4) );
83 std::map<int, AutoEnlargeBuffer*>::iterator it = m_evtBak.find( clientId );
84 if ( it == m_evtBak.end() ) {
87 m_evtBak[clientId]->copy((
void*)m_pEvt, (m_pEvt[1]*4) );
91 if ( m_evtMax >= 0 && m_evtDone >= m_evtMax ) {
93 std::cout <<
"[" << m_svrName <<
"] We have reach the EvtMax!" << std::endl;
105 m_pEvt = (uint32_t*)m_evtBak[clientId]->
data();
106 setData((
void*)m_pEvt, (m_pEvt[1]*4) );
114 std::string fname = m_freader->currentFile();
115 setData( (
void*)fname.c_str(), (fname.length()+1) );
122 std::cout <<
"[" << m_svrName <<
"] Error code from client["
124 << DimServer::getClientName()
131 std::cout <<
"[" << m_svrName <<
"] Unknown code(0x"
132 << std::hex << m_inCode << std::dec
133 <<
") from client[" << clientId <<
"]: "
134 << DimServer::getClientName()
virtual void print() const