Belle II Software development
RawRevRb2Sock Class Reference

Public Member Functions

 RawRevRb2Sock (std::string rbuf, int port, std::string shmname, int id)
 Constuctor and Destructor.
 
int SendEvent (void)
 Event function.
 
int Reconnect (void)
 Reconnect.
 

Private Attributes

RingBufferm_rbuf
 
RSocketSendm_sock
 
RFFlowStatm_flow
 
int * m_evtbuf
 

Detailed Description

Definition at line 35 of file RawRevRb2Sock.h.

Constructor & Destructor Documentation

◆ RawRevRb2Sock()

RawRevRb2Sock ( std::string  rbuf,
int  port,
std::string  shmname,
int  id 
)

Constuctor and Destructor.

Definition at line 14 of file RawRevRb2Sock.cc.

15{
16 // m_rbuf = new RingBuffer((char*)rbuf.c_str(), RBUFSIZE);
17 m_rbuf = new RingBuffer((char*)rbuf.c_str());
18 m_sock = new RSocketSend(port);
19 m_evtbuf = new int[MAXEVTSIZE];
20 m_flow = new RFFlowStat((char*)shmname.c_str(), id, m_rbuf);
21
22 m_sock->accept();
23}
Class to manage a Ring Buffer placed in an IPC shared memory.
Definition: RingBuffer.h:39

◆ ~RawRevRb2Sock()

~RawRevRb2Sock ( void  )

Definition at line 25 of file RawRevRb2Sock.cc.

26{
27 delete m_sock;
28 delete m_rbuf;
29}

Member Function Documentation

◆ Reconnect()

int Reconnect ( void  )

Reconnect.

Definition at line 47 of file RawRevRb2Sock.cc.

48{
49 int port = m_sock->port();
50 delete m_sock;
51 m_sock = new RSocketSend((u_short)port);
52 m_sock->accept();
53 return 0; //TODO is it correct?
54}

◆ SendEvent()

int SendEvent ( void  )

Event function.

Definition at line 31 of file RawRevRb2Sock.cc.

32{
33 // Get a record from ringbuf
34 int size;
35 while ((size = m_rbuf->remq(m_evtbuf)) == 0) {
36 // printf ( "Rx : evtbuf is not available yet....\n" );
37 // usleep(100);
38 usleep(20);
39 }
40 m_flow->log(size * 4);
41
42 int is = m_sock->put_wordbuf(m_evtbuf, size);
43 // if (is < 0) perror("put_wordbuf");
44 return is;
45}
int remq(int *buf)
Pick up a buffer from the RingBuffer.
Definition: RingBuffer.cc:308

Member Data Documentation

◆ m_evtbuf

int* m_evtbuf
private

Definition at line 51 of file RawRevRb2Sock.h.

◆ m_flow

RFFlowStat* m_flow
private

Definition at line 50 of file RawRevRb2Sock.h.

◆ m_rbuf

RingBuffer* m_rbuf
private

Definition at line 48 of file RawRevRb2Sock.h.

◆ m_sock

RSocketSend* m_sock
private

Definition at line 49 of file RawRevRb2Sock.h.


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