74 typedef std::queue<ptrRmtDataBaseTy,std::list<ptrRmtDataBaseTy> >
queueRmtDataTy;
78 template <
class ElemTy, RemoteMsgTy MsgTy>
122 template <
class ElemTy, RemoteMsgTy MsgTy, std::u
int8_t msgVer>
138 bool add (
const ElemTy& _elem);
unsigned XPMPPlaneID
Unique ID for an aircraft created by a plugin.
Definition: XPMPMultiplayer.h:252
Actual representation of all aircraft in XPMP2.
Definition: XPMPAircraft.h:178
Represents a CSL model as it is saved on disk.
Definition: CSLModels.h:113
Animation dataRef requires a special queue data type as each msg element is already of variable lengt...
Definition: Remote.h:99
RmtDataAcAnimTy(XPMPPlaneID _id)
Default constructor only sets message type and id, makes sure data is initialized.
Definition: Remote.h:109
void add(DR_VALS idx, float f)
Add a pair of animation type and value to the structure.
Definition: Remote.cpp:495
Base structure for passing information from XP's main thread to the multicast thread.
Definition: Remote.h:61
RmtDataBaseTy(RemoteMsgTy _ty)
Constructor just set the message type.
Definition: Remote.h:66
RemoteMsgTy msgTy
which message to send?
Definition: Remote.h:63
virtual ~RmtDataBaseTy()
Virtual destructor makes sure correct deletion of derived class' objects even through (smart) pointer...
Definition: Remote.h:68
Passing information about any data type (like a/c full detail message); the data is contained as copy...
Definition: Remote.h:79
RmtDataEnqeueTy(const ElemTy &_elem)
Data copy constructor copies the passed-in data.
Definition: Remote.h:87
RmtDataEnqeueTy()
Default constructor only sets message type, leaves rest defaulted.
Definition: Remote.h:85
ElemTy data
the payload data
Definition: Remote.h:82
Helper class to manage the temporary buffers in which the network message are put together.
Definition: Remote.h:123
~RmtMsgBufTy()
Destructor makes sure the buffer is freed up.
Definition: Remote.h:132
size_t size
current message size
Definition: Remote.h:127
bool add_send(const ElemTy &_elem, UDPMulticast &_mc)
Perform add(), then if necessary send(); returns if sent.
Definition: Remote.cpp:480
void init()
If necessary allocate the required buffer, then initialize it to an empty message.
Definition: Remote.cpp:434
bool empty() const
is empty, contains no payload?
Definition: Remote.h:140
bool add(const ElemTy &_elem)
Add another element to the buffer, returns if successful (otherwise full!)
Definition: Remote.cpp:451
size_t elemCount
number of elements already added to the message
Definition: Remote.h:126
void free()
Free up the buffer, basically a reset.
Definition: Remote.cpp:424
RmtMsgBufTy()
Constructor: everything stays zeroed.
Definition: Remote.h:130
void send(UDPMulticast &_mc)
send the message (if there is any), then reset the buffer
Definition: Remote.cpp:470
void * pMsg
points to the actual message buffer of size glob.remoteBufSize
Definition: Remote.h:125
UDP Multicast, always binding to INADDR_ANY.
Definition: Network.h:211
Definition: XPMPAircraft.h:70
std::map< XPMPPlaneID, RmtAcCacheTy > mapRmtAcCacheTy
Defines a map with the plane id as key and the aboce cache structure as payload.
Definition: Remote.h:56
void RemoteAcClearAll()
Informs us that there are no more aircraft, clear our caches!
Definition: Remote.cpp:1378
void RemoteAcEnqueueDone()
Informs us that all a/c have been processed: All pending messages to be sent now.
Definition: Remote.cpp:1317
void RemoteAcRemove(const Aircraft &ac)
Informs us about an aircraft deletion.
Definition: Remote.cpp:1350
void RemoteAcEnqueueStarts(float now)
Definition: Remote.cpp:1192
RemoteMsgTy
Message type.
Definition: XPMPRemote.h:77
@ RMT_MSG_AC_ANIM
aircraft animation values (dataRef values) only
Definition: XPMPRemote.h:83
void RemoteSenderUpdateStatus()
Compares current vs. expected status and takes appropriate action.
Definition: Remote.cpp:1155
std::unique_ptr< RmtDataBaseTy > ptrRmtDataBaseTy
Smart pointer to XPMP2::RmtDataBaseTy by which we manage objects of this and derived types.
Definition: Remote.h:72
RmtDataEnqeueTy< RemoteAcRemoveTy, RMT_MSG_AC_REMOVE > RmtDataAcRemoveTy
A/C Removal queue type.
Definition: Remote.h:93
void RemoteCleanup()
Grace cleanup, stops all threads.
Definition: Remote.cpp:1132
void RemoteAcEnqueue(const Aircraft &ac)
Regularly called from the flight loop callback to send a/c date onto the network.
Definition: Remote.cpp:1223
std::queue< ptrRmtDataBaseTy, std::list< ptrRmtDataBaseTy > > queueRmtDataTy
A queue managing the information objects, used to transfer data between main thread and network threa...
Definition: Remote.h:74
std::unique_ptr< RmtDataAcAnimTy > ptrRmtDataAcAnimTy
Smart pointer to XPMP2::RmtDataAcAnimTy.
Definition: Remote.h:115
void RemoteInit()
Initialize the module.
Definition: Remote.cpp:1123
RmtDataEnqeueTy< RemoteAcPosUpdateTy, RMT_MSG_AC_POS_UPDATE > RmtDataAcPosUpdateTy
A/C Position Update queue type.
Definition: Remote.h:92
DR_VALS
The dataRefs provided by XPMP2 to the CSL models.
Definition: XPMPAircraft.h:87
@ V_COUNT
always last, number of dataRefs XPMP2 pre-defines
Definition: XPMPAircraft.h:137
RmtDataEnqeueTy< RemoteAcDetailTy, RMT_MSG_AC_DETAILED > RmtDataAcDetailTy
A/C Detail queue type.
Definition: Remote.h:91
A/C animation dataRef changes.
Definition: XPMPRemote.h:333
size_t msgSize() const
current message size
Definition: XPMPRemote.h:351
Holds a copy of some aircraft data as was sent out last.
Definition: Remote.h:36
float ts
timestamp this position was valid (XP network time)
Definition: Remote.h:38
const CSLModel * pCSLMdl
the CSL model in use
Definition: Remote.h:47
bool bRender
Shall the CSL model be drawn in 3D world?
Definition: Remote.h:46
std::vector< float > v
dataRef values
Definition: Remote.h:43
double lat
degree latitude
Definition: Remote.h:39
double alt_ft
feet altitude
Definition: Remote.h:41
XPLMDrawInfo_t drawInfo
position and orientation last sent
Definition: Remote.h:42
RmtAcCacheTy(const Aircraft &ac, double _lat, double _lon, double _alt_ft)
Constructor copies relevant values from the passed-in aircraft.
Definition: Remote.cpp:109
bool bValid
is this object valid? (Will be reset in case of exceptions)
Definition: Remote.h:44
bool bVisible
Shall this plane be drawn at the moment?
Definition: Remote.h:45
double lon
degree longitude
Definition: Remote.h:40
void UpdateFrom(const Aircraft &ac, double _lat, double _lon, double _alt_ft)
Updates current values from given aircraft.
Definition: Remote.cpp:123
const unsigned fullUpdGrp
full update group, with which planes are distributed to load balance sending XPMP2::RMT_MSG_AC_DETAIL...
Definition: Remote.h:37