rogue
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
rogue::interfaces::memory::TcpClient Class Reference

Memory TCP bridge client. More...

#include <TcpClient.h>

Inheritance diagram for rogue::interfaces::memory::TcpClient:
rogue::interfaces::memory::Slave rogue::EnableSharedFromThis< rogue::interfaces::memory::Slave > rogue::EnableSharedFromThisBase

Public Member Functions

 TcpClient (std::string addr, uint16_t port, bool waitReady=false)
 Constructs a TCP memory bridge client.
 
 ~TcpClient ()
 Destroys the TCP client and releases transport resources.
 
void close ()
 Closes bridge connections.
 
void stop ()
 Stops the bridge interface and worker thread.
 
bool waitReady (double timeout, double period)
 Wait for the remote TcpServer path to respond to a bridge probe.
 
void start ()
 Managed-lifecycle startup hook.
 
void doTransaction (std::shared_ptr< rogue::interfaces::memory::Transaction > tran)
 Processes a transaction received from the upstream master.
 
- Public Member Functions inherited from rogue::interfaces::memory::Slave
 Slave (uint32_t min, uint32_t max)
 Constructs a memory slave.
 
virtual ~Slave ()
 Destroys the memory slave instance.
 
void addTransaction (std::shared_ptr< rogue::interfaces::memory::Transaction > transaction)
 Adds a transaction to the internal tracking map.
 
std::shared_ptr< rogue::interfaces::memory::TransactiongetTransaction (uint32_t index)
 Gets a transaction from the internal tracking map.
 
uint32_t min ()
 Returns configured minimum transaction size.
 
uint32_t max ()
 Returns configured maximum transaction size.
 
uint32_t id ()
 Returns unique slave ID.
 
void setName (std::string name)
 Sets slave name.
 
std::string name ()
 Returns slave name.
 
virtual uint32_t doSlaveId ()
 Services SlaveId request from a master.
 
virtual std::string doSlaveName ()
 Services SlaveName request from a master.
 
virtual uint32_t doMinAccess ()
 Services getMinAccess request from an attached master.
 
virtual uint32_t doMaxAccess ()
 Services getMaxAccess request from an attached master.
 
virtual uint64_t doAddress ()
 Services getAddress request from an attached master.
 
void lshiftPy (boost::python::object p)
 Supports << operator usage from Python.
 
std::shared_ptr< rogue::interfaces::memory::Master > & operator<< (std::shared_ptr< rogue::interfaces::memory::Master > &other)
 Connects this slave to a master via chaining operator.
 
- Public Member Functions inherited from rogue::EnableSharedFromThis< rogue::interfaces::memory::Slave >
std::shared_ptr< rogue::interfaces::memory::Slaveshared_from_this ()
 Returns a shared_ptr<T> for this instance.
 
- Public Member Functions inherited from rogue::EnableSharedFromThisBase
virtual ~EnableSharedFromThisBase ()
 Virtual destructor for polymorphic base usage.
 

Static Public Member Functions

static std::shared_ptr< rogue::interfaces::memory::TcpClientcreate (std::string addr, uint16_t port, bool waitReady=false)
 Creates a TCP memory bridge client.
 
static void setup_python ()
 Registers this type with Python bindings.
 
- Static Public Member Functions inherited from rogue::interfaces::memory::Slave
static std::shared_ptr< rogue::interfaces::memory::Slavecreate (uint32_t min, uint32_t max)
 Creates a memory slave.
 
static void setup_python ()
 Registers this type with Python bindings.
 

Detailed Description

Memory TCP bridge client.

Bridges a local memory transaction source to a remote TcpServer.

The client accepts transactions through its Slave interface and sends them over a two-socket request/response transport (base port and base port + 1). Non-posted transactions are tracked by transaction ID until a response is received by the background thread.

Operational behavior:

Definition at line 53 of file TcpClient.h.

Constructor & Destructor Documentation

◆ TcpClient()

rogue::interfaces::memory::TcpClient::TcpClient ( std::string  addr,
uint16_t  port,
bool  waitReady = false 
)

Constructs a TCP memory bridge client.

Creator.

The address is the remote TcpServer host (IP or hostname). The bridge uses two consecutive TCP ports starting at port; for example, port=8000 uses ports 8000 and 8001.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required. waitReady does not block in the constructor itself; it configures whether _start() should perform readiness probing later.

Parameters
addrRemote server address.
portBase TCP port number.
waitReadyIf true, record that _start() should block until the bridge request/response path responds to a readiness probe.

Definition at line 55 of file TcpClient.cpp.

◆ ~TcpClient()

rogue::interfaces::memory::TcpClient::~TcpClient ( )

Destroys the TCP client and releases transport resources.

Destructor.

Definition at line 127 of file TcpClient.cpp.

Member Function Documentation

◆ close()

void rogue::interfaces::memory::TcpClient::close ( )

Closes bridge connections.

Deprecated; use stop().

Definition at line 132 of file TcpClient.cpp.

◆ create()

rogue::interfaces::memory::TcpClientPtr rogue::interfaces::memory::TcpClient::create ( std::string  addr,
uint16_t  port,
bool  waitReady = false 
)
static

Creates a TCP memory bridge client.

Class creation.

Parameter semantics are identical to the constructor; see TcpClient() for address and port behavior details. Exposed as rogue.interfaces.memory.TcpClient() in Python. This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

Parameters
addrRemote server address.
portBase TCP port number.
waitReadyIf true, configure the instance so _start() waits for bridge readiness before returning.
Returns
Shared pointer to the created client.

Definition at line 49 of file TcpClient.cpp.

◆ doTransaction()

void rogue::interfaces::memory::TcpClient::doTransaction ( std::shared_ptr< rogue::interfaces::memory::Transaction tran)
virtual

Processes a transaction received from the upstream master.

Post a transaction.

Parameters
tranTransaction to forward to the remote server.

Reimplemented from rogue::interfaces::memory::Slave.

Definition at line 222 of file TcpClient.cpp.

◆ setup_python()

void rogue::interfaces::memory::TcpClient::setup_python ( )
static

Registers this type with Python bindings.

Definition at line 410 of file TcpClient.cpp.

◆ start()

void rogue::interfaces::memory::TcpClient::start ( )

Managed-lifecycle startup hook.

If this instance was constructed with waitReady=true, _start() blocks until the bridge request/response path responds to a readiness probe. Otherwise it is a no-op.

Definition at line 211 of file TcpClient.cpp.

◆ stop()

void rogue::interfaces::memory::TcpClient::stop ( )
virtual

Stops the bridge interface and worker thread.

Reimplemented from rogue::interfaces::memory::Slave.

Definition at line 136 of file TcpClient.cpp.

◆ waitReady()

bool rogue::interfaces::memory::TcpClient::waitReady ( double  timeout,
double  period 
)

Wait for the remote TcpServer path to respond to a bridge probe.

This sends a lightweight internal control transaction through the bridge and waits for the remote TcpServer to acknowledge it. It verifies that the request/response path is usable, which is stronger than a local socket-connect state.

Parameters
timeoutMaximum wait time in seconds.
periodRetry period in seconds.
Returns
true if the probe succeeds before timeout, otherwise false.

Definition at line 147 of file TcpClient.cpp.


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