rogue
Loading...
Searching...
No Matches
TcpServer.h
Go to the documentation of this file.
1
17#ifndef __ROGUE_INTERFACES_MEMORY_TCP_SERVER_H__
18#define __ROGUE_INTERFACES_MEMORY_TCP_SERVER_H__
19#include "rogue/Directives.h"
20
21#include <stdint.h>
22
23#include <atomic>
24#include <memory>
25#include <string>
26#include <thread>
27
28#include "rogue/Logging.h"
30
31namespace rogue {
32namespace interfaces {
33namespace memory {
34
54 // Inbound Address
55 std::string reqAddr_;
56
57 // Outbound Address
58 std::string respAddr_;
59
60 void* zmqCtx_ = nullptr;
61 void* zmqReq_ = nullptr;
62 void* zmqResp_ = nullptr;
63
64 // Thread background
65 void runThread();
66
67 // Log
68 std::shared_ptr<rogue::Logging> bridgeLog_;
69
71 protected:
72 std::unique_ptr<std::thread> thread_;
73 std::atomic<bool> threadEn_{false};
74
81 virtual int sendResponseMsg_(void* msg, int flags);
83
84 public:
102 static std::shared_ptr<rogue::interfaces::memory::TcpServer> create(std::string addr, uint16_t port);
103
107 static void setup_python();
108
123 TcpServer(std::string addr, uint16_t port);
124
128 ~TcpServer();
129
135 [[deprecated("Use stop() instead")]] void close();
136
140 void stop();
141
150 void start();
151};
152
156typedef std::shared_ptr<rogue::interfaces::memory::TcpServer> TcpServerPtr;
157
158} // namespace memory
159} // namespace interfaces
160}; // namespace rogue
161
162#endif
Master endpoint for memory transactions.
Definition Master.h:50
static std::shared_ptr< rogue::interfaces::memory::Master > create()
Creates a memory master instance.
Definition Master.cpp:44
Memory TCP bridge server.
Definition TcpServer.h:53
void stop()
Stops the bridge interface and worker thread.
void close()
Closes bridge connections.
void start()
Managed-lifecycle startup hook.
static void setup_python()
Registers this type with Python bindings.
~TcpServer()
Destroys the TCP server and releases transport resources.
std::shared_ptr< rogue::interfaces::memory::TcpServer > TcpServerPtr
Shared pointer alias for TcpServer.
Definition TcpServer.h:156