lichao
2021-04-02 dc12826dd61ce18fac3a9561c5843d30a0cf9660
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * =====================================================================================
 *
 *       Filename:  reqrep_center.h
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2021年04月01日 14时09分13秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Li Chao (), 
 *   Organization:  
 *
 * =====================================================================================
 */
#ifndef REQREP_CENTER_US3RBM60
#define REQREP_CENTER_US3RBM60
 
#include "defs.h"
#include "socket.h"
 
class ReqRepCenter
{
    class Socket : public ShmSocket
    {
    public:
        Socket(ShmSocket::Shm &shm) :
            ShmSocket(shm, &kBHTopicReqRepCenter, 1000) {}
        using ShmSocket::shm;
    };
    Socket socket_;
    ShmSocket::Shm &shm() { return socket_.shm(); }
 
public:
    ReqRepCenter(ShmSocket::Shm &shm) :
        socket_(shm) {}
    ReqRepCenter() :
        ReqRepCenter(BHomeShm()) {}
    ~ReqRepCenter() { Stop(); }
    bool Start(const int nworker = 2);
    bool Stop() { return socket_.Stop(); }
};
 
#endif // end of include guard: REQREP_CENTER_US3RBM60