IRSOL
C++ code implementing socket server for interacting with Baumer camera.
irsol::server::handlers::Context Struct Reference

Context object passed to all handler classes. More...

#include <context.hpp>

Public Member Functions

 Context (App &app)
 
virtual std::shared_ptr< irsol::server::ClientSessiongetSession (const irsol::types::client_id_t &clientId)
 Retrieves the client's session associated with the given clientId.
 
void broadcastMessage (protocol::OutMessage &&message, const std::optional< irsol::types::client_id_t > &excludeClient=std::nullopt)
 Broadcasts a message to all clients.
 

Public Attributes

Appapp
 Reference to application instance.
 

Detailed Description

Context object passed to all handler classes.

Provides access to the application instance and utility methods for retrieving client sessions and broadcasting messages.

Definition at line 34 of file context.hpp.

Constructor & Destructor Documentation

◆ Context()

irsol::server::handlers::Context::Context ( App app)
inline

Definition at line 36 of file context.hpp.

36: app(app) {}
App & app
Reference to application instance.
Definition context.hpp:38

Member Function Documentation

◆ broadcastMessage()

void irsol::server::handlers::Context::broadcastMessage ( protocol::OutMessage &&  message,
const std::optional< irsol::types::client_id_t > &  excludeClient = std::nullopt 
)

Broadcasts a message to all clients.

Parameters
messageThe outbound message to broadcast.
excludeClientOptional client to exclude from the broadcast.

Definition at line 15 of file base.cpp.

18{
19 return app.broadcastMessage(std::move(message), excludeClient);
20}
void broadcastMessage(protocol::OutMessage &&message, const std::optional< irsol::types::client_id_t > &excludeClient=std::nullopt)
Broadcasts a message to all connected clients.
Definition app.cpp:61
constexpr auto makeHandler(std::shared_ptr< Context > ctx, Args &&... args)
Constructs a handler instance of the given type.
Definition factory.hpp:28

◆ getSession()

std::shared_ptr< irsol::server::ClientSession > irsol::server::handlers::Context::getSession ( const irsol::types::client_id_t clientId)
virtual

Retrieves the client's session associated with the given clientId.

Parameters
clientIdThe client identifier.
Returns
Shared pointer to the client session, or nullptr if not found.

Definition at line 9 of file base.cpp.

10{
12}
std::shared_ptr< ClientSession > getClientSession(const irsol::types::client_id_t &clientId)
Retrieves an active client session.
Definition app.cpp:53

Member Data Documentation

◆ app

App& irsol::server::handlers::Context::app

Reference to application instance.

Definition at line 38 of file context.hpp.


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