XPMP2
X-Plane multiplayer library 2 - using instancing
Public Member Functions | Public Attributes | List of all members
XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer > Class Template Reference

Helper class to manage the temporary buffers in which the network message are put together. More...

#include <Remote.h>

Public Member Functions

 RmtMsgBufTy ()
 Constructor: everything stays zeroed. More...
 
 ~RmtMsgBufTy ()
 Destructor makes sure the buffer is freed up. More...
 
void free ()
 Free up the buffer, basically a reset. More...
 
void init ()
 If necessary allocate the required buffer, then initialize it to an empty message. More...
 
bool add (const ElemTy &_elem)
 Add another element to the buffer, returns if successful (otherwise full!) More...
 
bool empty () const
 is empty, contains no payload? More...
 
void send (UDPMulticast &_mc)
 send the message (if there is any), then reset the buffer More...
 
bool add_send (const ElemTy &_elem, UDPMulticast &_mc)
 Perform add(), then if necessary send(); returns if sent. More...
 

Public Attributes

void * pMsg = nullptr
 points to the actual message buffer of size glob.remoteBufSize More...
 
size_t elemCount = 0
 number of elements already added to the message More...
 
size_t size = 0
 current message size More...
 

Detailed Description

template<class ElemTy, RemoteMsgTy MsgTy, std::uint8_t msgVer>
class XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >

Helper class to manage the temporary buffers in which the network message are put together.

Constructor & Destructor Documentation

◆ RmtMsgBufTy()

template<class ElemTy , RemoteMsgTy MsgTy, std::uint8_t msgVer>
XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >::RmtMsgBufTy ( )
inline

Constructor: everything stays zeroed.

◆ ~RmtMsgBufTy()

template<class ElemTy , RemoteMsgTy MsgTy, std::uint8_t msgVer>
XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >::~RmtMsgBufTy ( )
inline

Destructor makes sure the buffer is freed up.

Member Function Documentation

◆ add()

template<class ElemTy , RemoteMsgTy MsgTy, std::uint8_t msgVer>
bool XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >::add ( const ElemTy &  _elem)

Add another element to the buffer, returns if successful (otherwise full!)

◆ add_send()

template<class ElemTy , RemoteMsgTy MsgTy, std::uint8_t msgVer>
bool XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >::add_send ( const ElemTy &  _elem,
UDPMulticast _mc 
)

Perform add(), then if necessary send(); returns if sent.

◆ empty()

template<class ElemTy , RemoteMsgTy MsgTy, std::uint8_t msgVer>
bool XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >::empty ( ) const
inline

is empty, contains no payload?

◆ free()

template<class ElemTy , RemoteMsgTy MsgTy, std::uint8_t msgVer>
void XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >::free

Free up the buffer, basically a reset.

◆ init()

template<class ElemTy , RemoteMsgTy MsgTy, std::uint8_t msgVer>
void XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >::init

If necessary allocate the required buffer, then initialize it to an empty message.

◆ send()

template<class ElemTy , RemoteMsgTy MsgTy, std::uint8_t msgVer>
void XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >::send ( UDPMulticast _mc)

send the message (if there is any), then reset the buffer

Member Data Documentation

◆ elemCount

template<class ElemTy , RemoteMsgTy MsgTy, std::uint8_t msgVer>
size_t XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >::elemCount = 0

number of elements already added to the message

◆ pMsg

template<class ElemTy , RemoteMsgTy MsgTy, std::uint8_t msgVer>
void* XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >::pMsg = nullptr

points to the actual message buffer of size glob.remoteBufSize

◆ size

template<class ElemTy , RemoteMsgTy MsgTy, std::uint8_t msgVer>
size_t XPMP2::RmtMsgBufTy< ElemTy, MsgTy, msgVer >::size = 0

current message size


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