X-Plane Remote Access Plugin and Client Library
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
xplra::ServerThread Class Reference

#include <ServerThread.h>

Inheritance diagram for xplra::ServerThread:

Public Member Functions

 ServerThread (ListenThread &listenThread, RequestQueue &requestQueue, hu::varadiistvan::scpl::io::BufferedStreamAcceptor &acceptor)
 
virtual ~ServerThread ()
 
void quit ()
 
virtual void run ()
 

Static Public Member Functions

static void quitAll ()
 

Private Types

typedef std::set< ServerThread * > instances_t
 
typedef std::map< size_t, GetMultiDataRefRequest * > getMultiRequests_t
 
typedef std::map< size_t, SetMultiDataRefRequest * > setMultiRequests_t
 

Private Member Functions

bool handleGetSingle ()
 
bool handleSetSingle ()
 
bool handleGetMulti ()
 
bool handleSetMulti ()
 
bool handleRegisterGetMulti ()
 
bool handleUnregisterGetMulti ()
 
bool handleExecuteGetMulti ()
 
bool handleRegisterSetMulti ()
 
bool handleUnregisterSetMulti ()
 
bool handleExecuteSetMulti ()
 
bool handleGetVersions ()
 
bool handleReloadPlugins ()
 
bool handleShowMessage ()
 
bool handleRegisterHotkeys ()
 
bool handleQueryHotkeys ()
 
bool handleUnregisterHotkeys ()
 
bool destroyHotkeys ()
 

Private Attributes

ListenThreadlistenThread
 
RequestQueuerequestQueue
 
hu::varadiistvan::scpl::io::Waiter waiter
 
hu::varadiistvan::scpl::io::BufferedStream * bufferedStream
 
hu::varadiistvan::scpl::io::DataStream stream
 
size_t nextGetMultiRequestID
 
getMultiRequests_t getMultiRequests
 
size_t nextSetMultiRequestID
 
setMultiRequests_t setMultiRequests
 
HotkeyHandler::Hotkeyshotkeys
 

Static Private Attributes

static hu::varadiistvan::scpl::Mutex instancesMutex
 
static instances_t instances
 

Detailed Description

A thread serving a client.

Definition at line 65 of file ServerThread.h.

Member Typedef Documentation

◆ getMultiRequests_t

Type for the registered multiple-data query requests.

Definition at line 76 of file ServerThread.h.

◆ instances_t

typedef std::set<ServerThread*> xplra::ServerThread::instances_t
private

Type for the set of server thread instances.

Definition at line 71 of file ServerThread.h.

◆ setMultiRequests_t

Type for the registered multiple-data update requests.

Definition at line 81 of file ServerThread.h.

Constructor & Destructor Documentation

◆ ServerThread()

ServerThread::ServerThread ( ListenThread listenThread,
RequestQueue requestQueue,
hu::varadiistvan::scpl::io::BufferedStreamAcceptor &  acceptor 
)

Construct the thread by using a LocalSocket returned by the given acceptor.

Definition at line 98 of file ServerThread.cc.

◆ ~ServerThread()

ServerThread::~ServerThread ( )
virtual

Destroy the thread.

Definition at line 116 of file ServerThread.cc.

Member Function Documentation

◆ destroyHotkeys()

bool ServerThread::destroyHotkeys ( )
inlineprivate

Destroy the current set of hotkeys, if any.

Returns
whether there were any hotkeys or not.

Definition at line 85 of file ServerThread.cc.

◆ handleExecuteGetMulti()

bool ServerThread::handleExecuteGetMulti ( )
private

Handle the COMMAND_EXECUTE_GET_MULTI command

Returns
true, if we can continue, false if the thread should quit

Definition at line 346 of file ServerThread.cc.

◆ handleExecuteSetMulti()

bool ServerThread::handleExecuteSetMulti ( )
private

Handle the COMMAND_EXECUTE_SET_MULTI command

Returns
true, if we can continue, false if the thread should quit

Definition at line 407 of file ServerThread.cc.

◆ handleGetMulti()

bool ServerThread::handleGetMulti ( )
private

Handle the COMMAND_GET_MULTI command

Returns
true, if we can continue, false if the thread should quit

Definition at line 256 of file ServerThread.cc.

◆ handleGetSingle()

bool ServerThread::handleGetSingle ( )
private

Handle the COMMAND_GET_SINGLE command

Returns
true, if we can continue, false if the thread should quit

Definition at line 201 of file ServerThread.cc.

◆ handleGetVersions()

bool ServerThread::handleGetVersions ( )
private

Handle the COMMAND_GET_VERSIONS command

Returns
true, if we can continue, false if the thread should quit

Definition at line 427 of file ServerThread.cc.

◆ handleQueryHotkeys()

bool ServerThread::handleQueryHotkeys ( )
private

Handle the COMMAND_QUERY_HOTKEYS command.

Returns
true if we can continue, false if the thread should quit.

Definition at line 521 of file ServerThread.cc.

◆ handleRegisterGetMulti()

bool ServerThread::handleRegisterGetMulti ( )
private

Handle the COMMAND_REGISTER_GET_MULTI command

Returns
true, if we can continue, false if the thread should quit

Definition at line 304 of file ServerThread.cc.

◆ handleRegisterHotkeys()

bool ServerThread::handleRegisterHotkeys ( )
private

Handle the COMMAND_REGISTER_HOTKEYS command.

Returns
true if we can continue, false if the thread should quit.

Definition at line 495 of file ServerThread.cc.

◆ handleRegisterSetMulti()

bool ServerThread::handleRegisterSetMulti ( )
private

Handle the COMMAND_REGISTER_SET_MULTI command

Returns
true, if we can continue, false if the thread should quit

Definition at line 365 of file ServerThread.cc.

◆ handleReloadPlugins()

bool ServerThread::handleReloadPlugins ( )
private

Handle the COMMAND_RELOAD_PLUGINS command.

Returns
true, if we can continue, false if the thread should quit

Definition at line 444 of file ServerThread.cc.

◆ handleSetMulti()

bool ServerThread::handleSetMulti ( )
private

Handle the COMMAND_SET_MULTI command

Returns
true, if we can continue, false if the thread should quit

Definition at line 280 of file ServerThread.cc.

◆ handleSetSingle()

bool ServerThread::handleSetSingle ( )
private

Handle the COMMAND_SET_SINGLE command

Returns
true, if we can continue, false if the thread should quit

Definition at line 228 of file ServerThread.cc.

◆ handleShowMessage()

bool ServerThread::handleShowMessage ( )
private

Handle the COMMAND_SHOW_MESSAGE command

Returns
true, if we can continue, false if the thread should quit

Definition at line 474 of file ServerThread.cc.

◆ handleUnregisterGetMulti()

bool ServerThread::handleUnregisterGetMulti ( )
private

Handle the COMMAND_UNREGISTER_GET_MULTI command

Returns
true, if we can continue, false if the thread should quit

Definition at line 326 of file ServerThread.cc.

◆ handleUnregisterHotkeys()

bool ServerThread::handleUnregisterHotkeys ( )
private

Handle the COMMAND_UNREGISTER_HOTKEYS command.

Returns
true if we can continue, false if the thread should quit.

Definition at line 534 of file ServerThread.cc.

◆ handleUnregisterSetMulti()

bool ServerThread::handleUnregisterSetMulti ( )
private

Handle the COMMAND_UNREGISTER_SET_MULTI command

Returns
true, if we can continue, false if the thread should quit

Definition at line 387 of file ServerThread.cc.

◆ quit()

void ServerThread::quit ( )

Quit the thread. It interrupts the blocking stream.

Definition at line 135 of file ServerThread.cc.

◆ quitAll()

void ServerThread::quitAll ( )
static

Call quit() an all threads.

Definition at line 70 of file ServerThread.cc.

◆ run()

void ServerThread::run ( )
virtual

Perform the thread's operation.

Definition at line 142 of file ServerThread.cc.

Member Data Documentation

◆ bufferedStream

hu::varadiistvan::scpl::io::BufferedStream* xplra::ServerThread::bufferedStream
private

The buffered stream to use for communication at the low-level.

Definition at line 118 of file ServerThread.h.

◆ getMultiRequests

getMultiRequests_t xplra::ServerThread::getMultiRequests
private

The registered multiple-data query requests.

Definition at line 133 of file ServerThread.h.

◆ hotkeys

HotkeyHandler::Hotkeys* xplra::ServerThread::hotkeys
private

The set of hotkeys currently being handled.

Definition at line 148 of file ServerThread.h.

◆ instances

ServerThread::instances_t ServerThread::instances
staticprivate

The instances of this class.

Definition at line 91 of file ServerThread.h.

◆ instancesMutex

Mutex ServerThread::instancesMutex
staticprivate

A mutex to protect the collection of server threads.

Definition at line 86 of file ServerThread.h.

◆ listenThread

ListenThread& xplra::ServerThread::listenThread
private

The listen thread this server was started by.

Definition at line 103 of file ServerThread.h.

◆ nextGetMultiRequestID

size_t xplra::ServerThread::nextGetMultiRequestID
private

The ID of the next multiple-data query request.

Definition at line 128 of file ServerThread.h.

◆ nextSetMultiRequestID

size_t xplra::ServerThread::nextSetMultiRequestID
private

The ID of the next multiple-data update request.

Definition at line 138 of file ServerThread.h.

◆ requestQueue

RequestQueue& xplra::ServerThread::requestQueue
private

The request queue to use.

Definition at line 108 of file ServerThread.h.

◆ setMultiRequests

setMultiRequests_t xplra::ServerThread::setMultiRequests
private

The registered multiple-data query requests.

Definition at line 143 of file ServerThread.h.

◆ stream

hu::varadiistvan::scpl::io::DataStream xplra::ServerThread::stream
private

The data stream being used for communication.

Definition at line 123 of file ServerThread.h.

◆ waiter

hu::varadiistvan::scpl::io::Waiter xplra::ServerThread::waiter
private

Our waiter.

Definition at line 113 of file ServerThread.h.


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