BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
WriterRpc< Writer > Class Template Reference

#include <WriterRpc.h>

+ Inheritance diagram for WriterRpc< Writer >:

Public Member Functions

 WriterRpc (const std::string &svrName, const std::string &fname)
 
virtual ~WriterRpc ()
 
int wait_to_end ()
 
 WriterRpc (const std::string &svrName, const std::string &fname)
 
virtual ~WriterRpc ()
 
int wait_to_end ()
 
- Public Member Functions inherited from RpcInterface
virtual ~RpcInterface ()
 
virtual int wait_to_end ()=0
 
virtual ~RpcInterface ()
 
virtual int wait_to_end ()=0
 

Detailed Description

template<class Writer>
class WriterRpc< Writer >

Definition at line 11 of file DistBoss/DistBossServer/DistBossServer-00-00-04/DistBossServer/WriterRpc.h.

Constructor & Destructor Documentation

◆ WriterRpc() [1/2]

template<class Writer >
WriterRpc< Writer >::WriterRpc ( const std::string &  svrName,
const std::string &  fname 
)

Definition at line 8 of file DistBoss/DistBossServer/DistBossServer-00-00-04/DistBossServer/template/WriterRpc.cc.

9 : DimRpc(svrName.c_str(), "I", "I"),
10 m_evtDone(0)
11{
12 m_writer = new PthrWriterBufPool<Writer>(fname);
13
14 m_svrName = svrName.substr( svrName.find_last_of('/')+1 );
15}

◆ ~WriterRpc() [1/2]

template<class Writer >
WriterRpc< Writer >::~WriterRpc
virtual

Definition at line 18 of file DistBoss/DistBossServer/DistBossServer-00-00-04/DistBossServer/template/WriterRpc.cc.

19{
20 if ( m_writer->stat() == 0 ) {
21 while ( m_evtBak.size() > 0 ) {
22 clearBak(-1);
23 }
24 if ( dis_get_n_clients(itsIdOut) > 0 ) {
25 std::cout << "[" << m_svrName << "] PROBLEMS @ TERMINATING. FORCE TO QUIT" << std::endl;
26 }
28 m_writer->writeEvent(&code, 4);
29 }
30
31 delete m_writer;
32
33 for (std::map<int, AutoEnlargeBuffer*>::iterator it = m_evtBak.begin(); it != m_evtBak.end(); ++it) {
34 delete it->second;
35 }
36
37 std::cout << "[" << m_svrName << "] Terminated. Total events processed: " << m_evtDone << std::endl;
38}

◆ WriterRpc() [2/2]

template<class Writer >
WriterRpc< Writer >::WriterRpc ( const std::string &  svrName,
const std::string &  fname 
)

◆ ~WriterRpc() [2/2]

template<class Writer >
virtual WriterRpc< Writer >::~WriterRpc ( )
virtual

Member Function Documentation

◆ wait_to_end() [1/2]

template<class Writer >
int WriterRpc< Writer >::wait_to_end
virtual

Implements RpcInterface.

Definition at line 41 of file DistBoss/DistBossServer/DistBossServer-00-00-04/DistBossServer/template/WriterRpc.cc.

42{
43 int nClients = 0;
44 int i = 0;
45
46 do {
47 // wait for all the clients dis-connecting to this server
48 // and force the server to stop when the total waiting time
49 // is greater than 10s(5*1s)
50 if ( ++i > 5 ) break;
51 sleep(2);
52 nClients = dis_get_n_clients(itsIdOut);
53 }
54 while ( nClients > 0 );
55
56 return nClients;
57}

◆ wait_to_end() [2/2]

template<class Writer >
int WriterRpc< Writer >::wait_to_end ( )
virtual

Implements RpcInterface.


The documentation for this class was generated from the following files: