1#ifndef DISTBOSS_WRITER_RPC_CC
2#define DISTBOSS_WRITER_RPC_CC
9 : DimRpc(svrName.c_str(),
"I",
"I"),
14 m_svrName = svrName.substr( svrName.find_last_of(
'/')+1 );
20 if ( m_writer->stat() == 0 ) {
21 while ( m_evtBak.size() > 0 ) {
24 if ( dis_get_n_clients(itsIdOut) > 0 ) {
25 std::cout <<
"[" << m_svrName <<
"] PROBLEMS @ TERMINATING. FORCE TO QUIT" << std::endl;
28 m_writer->writeEvent(&code, 4);
33 for (std::map<int, AutoEnlargeBuffer*>::iterator it = m_evtBak.begin(); it != m_evtBak.end(); ++it) {
37 std::cout <<
"[" << m_svrName <<
"] Terminated. Total events processed: " << m_evtDone << std::endl;
52 nClients = dis_get_n_clients(itsIdOut);
54 while ( nClients > 0 );
65 int clientId = DimServer::getClientId();
69 unsigned int inCode = *(
unsigned int*)m_pEvt;
72 std::cout <<
"[" << m_svrName <<
"] Client [" << DimServer::getClientName() <<
"] finalized" << std::endl;
74 if ( dis_get_n_clients(itsIdOut) <= 1 ) {
75 m_writer->writeEvent(m_pEvt, m_size);
79 std::cout <<
"[" << m_svrName <<
"] Client [" << DimServer::getClientName() <<
"] connected" << std::endl;
82 else if ( m_size > 4 ) {
83 std::map<int, AutoEnlargeBuffer*>::iterator it = m_evtBak.find( clientId );
84 if ( it == m_evtBak.end() ) {
86 m_evtBak[clientId]->copy(m_pEvt, m_size );
89 void* pbak = m_evtBak[clientId]->data();
90 if ( *(
int*)pbak != *(
int*)m_pEvt ) {
91 m_writer->writeEvent(pbak, m_evtBak[clientId]->size());
95 m_evtBak[clientId]->copy(m_pEvt, m_size );
104template<
class Writer>
107 std::map<int, AutoEnlargeBuffer*>::iterator it = (clientId<0) ? m_evtBak.begin() : m_evtBak.find( clientId );
108 if ( it != m_evtBak.end() ) {
109 m_writer->writeEvent( it->second->data(), it->second->size() );