libpalliate v0.0.1
Palliate core library
transport::Server Class Reference

#include <server.h>

Inheritance diagram for transport::Server:

Public Member Functions

 ~Server () override=default
 
 Server (std::string const &_name, bool _packed=false)
 
virtual builder_t prepare ()
 
void broadcast (capnp::MessageBuilder *message)
 
void set_event (std::function< void(Client *, reader_t)> message_event)
 
void add (std::unique_ptr< Client > clientobj)
 
void remove (Client *obj)
 
- Public Member Functions inherited from runnable
 runnable (std::string const &_name)
 
virtual ~runnable ()
 
virtual void operator() (std::stop_token token={})
 
void run ()
 
void run (callback_f _callback)
 
void stop ()
 
auto operator<=> (runnable const &other) const
 

Protected Attributes

std::list< std::unique_ptr< Client > > clients
 
std::mutex clients_mutex
 
bool packed
 
std::function< void(Client *, reader_t)> message_event
 
- Protected Attributes inherited from runnable
std::jthread thread
 
std::unique_ptr< callback_tcallback
 

Additional Inherited Members

- Public Types inherited from runnable
using callback_f = std::function< void()>
 
using callback_t = std::stop_callback< callback_f >
 
- Protected Member Functions inherited from runnable
virtual bool setup ()
 
virtual bool loop ()=0
 

Constructor & Destructor Documentation

◆ ~Server()

transport::Server::~Server ( )
overridedefault

◆ Server()

transport::Server::Server ( std::string const &  _name,
bool  _packed = false 
)
inline

Member Function Documentation

◆ add()

void Server::add ( std::unique_ptr< Client clientobj)

◆ broadcast()

void Server::broadcast ( capnp::MessageBuilder *  message)

◆ prepare()

builder_t Server::prepare ( )
virtual

◆ remove()

void Server::remove ( Client obj)

◆ set_event()

void Server::set_event ( std::function< void(Client *, reader_t)>  message_event)

Member Data Documentation

◆ clients

std::list<std::unique_ptr<Client> > transport::Server::clients
protected

◆ clients_mutex

std::mutex transport::Server::clients_mutex
protected

◆ message_event

std::function<void(Client*, reader_t)> transport::Server::message_event
protected

◆ packed

bool transport::Server::packed
protected

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