ObjectBox C and C++ API  4.0.3
obx::AbstractCustomMsgConnection Class Referenceabstract

Typically used together with CustomMsgServerDelegate e.g. to ensure a matching interface. Subclasses represent a connection of a custom server. More...

#include <objectbox-sync.hpp>

Inheritance diagram for obx::AbstractCustomMsgConnection:
Inheritance graph

Public Member Functions

 AbstractCustomMsgConnection (uint64_t serverId, uint64_t id=0)
 
virtual ~AbstractCustomMsgConnection ()=default
 
uint64_t serverId () const
 
uint64_t id () const
 
void setId (uint64_t id)
 
virtual void close ()=0
 The connection closing itself (to be implemented by concrete subclass). More...
 
virtual void shutdown ()=0
 The connection shall shutdown; e.g. it may delete itself. Note that there is no "automatic" deletion triggered from the custom msg system: often, connections are intertwined with the server and thus deletion must be managed at the implementing side. More...
 
virtual bool sendAsync (BytesLazy &&message)=0
 Offers bytes to be sent asynchronously to the client (to be implemented by concrete subclass). More...
 
virtual void clearOutgoingMessages ()=0
 Clear all outgoing messages (to be implemented by concrete subclass). More...
 

Detailed Description

Typically used together with CustomMsgServerDelegate e.g. to ensure a matching interface. Subclasses represent a connection of a custom server.

Constructor & Destructor Documentation

◆ AbstractCustomMsgConnection()

obx::AbstractCustomMsgConnection::AbstractCustomMsgConnection ( uint64_t  serverId,
uint64_t  id = 0 
)
inlineexplicit

◆ ~AbstractCustomMsgConnection()

virtual obx::AbstractCustomMsgConnection::~AbstractCustomMsgConnection ( )
virtualdefault

Member Function Documentation

◆ clearOutgoingMessages()

virtual void obx::AbstractCustomMsgConnection::clearOutgoingMessages ( )
pure virtual

Clear all outgoing messages (to be implemented by concrete subclass).

Implemented in obx::CustomMsgConnectionDelegate.

◆ close()

virtual void obx::AbstractCustomMsgConnection::close ( )
pure virtual

The connection closing itself (to be implemented by concrete subclass).

Implemented in obx::CustomMsgConnectionDelegate.

◆ id()

uint64_t obx::AbstractCustomMsgConnection::id ( ) const
inline

◆ sendAsync()

virtual bool obx::AbstractCustomMsgConnection::sendAsync ( BytesLazy &&  message)
pure virtual

Offers bytes to be sent asynchronously to the client (to be implemented by concrete subclass).

Parameters
messagethe message bytes.
Returns
true if the operation was successful.
false in case the operation encountered an issue.

Implemented in obx::CustomMsgConnectionDelegate.

◆ serverId()

uint64_t obx::AbstractCustomMsgConnection::serverId ( ) const
inline

◆ setId()

void obx::AbstractCustomMsgConnection::setId ( uint64_t  id)
inline

◆ shutdown()

virtual void obx::AbstractCustomMsgConnection::shutdown ( )
pure virtual

The connection shall shutdown; e.g. it may delete itself. Note that there is no "automatic" deletion triggered from the custom msg system: often, connections are intertwined with the server and thus deletion must be managed at the implementing side.

Implemented in obx::CustomMsgConnectionDelegate.