mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +02:00
added more doxygen comments
This commit is contained in:
parent
beec5f60d8
commit
ced61e94d8
5 changed files with 28 additions and 10 deletions
|
@ -16,6 +16,7 @@
|
|||
|
||||
class Application;
|
||||
|
||||
/// Used for construction of edit voxel packets
|
||||
class EditPacketBuffer {
|
||||
public:
|
||||
EditPacketBuffer() { _currentSize = 0; _currentType = PACKET_TYPE_UNKNOWN; _nodeID = UNKNOWN_NODE_ID; }
|
||||
|
@ -25,14 +26,20 @@ public:
|
|||
ssize_t _currentSize;
|
||||
};
|
||||
|
||||
/// Threaded processor for queueing and sending of outbound edit voxel packets.
|
||||
class VoxelEditPacketSender : public PacketSender {
|
||||
public:
|
||||
VoxelEditPacketSender(Application* app);
|
||||
|
||||
// Some ways you can send voxel edit messages...
|
||||
void sendVoxelEditMessage(PACKET_TYPE type, VoxelDetail& detail); // sends it right away
|
||||
void queueVoxelEditMessage(PACKET_TYPE type, unsigned char* codeColorBuffer, ssize_t length); // queues it into a multi-command packet
|
||||
void flushQueue(); // flushes all queued packets
|
||||
/// Send voxel edit message immediately
|
||||
void sendVoxelEditMessage(PACKET_TYPE type, VoxelDetail& detail);
|
||||
|
||||
/// Queues a voxel edit message. Will potentially sends a pending multi-command packet. Determines which voxel-server
|
||||
/// node or nodes the packet should be sent to.
|
||||
void queueVoxelEditMessage(PACKET_TYPE type, unsigned char* codeColorBuffer, ssize_t length);
|
||||
|
||||
/// flushes all queued packets for all nodes
|
||||
void flushQueue();
|
||||
|
||||
private:
|
||||
void actuallySendMessage(uint16_t nodeID, unsigned char* bufferOut, ssize_t sizeOut);
|
||||
|
|
|
@ -15,11 +15,14 @@
|
|||
|
||||
class Application;
|
||||
|
||||
/// Handles processing of incoming voxel packets for the interface application.
|
||||
class VoxelPacketProcessor : public ReceivedPacketProcessor {
|
||||
public:
|
||||
VoxelPacketProcessor(Application* app);
|
||||
virtual void processPacket(sockaddr& senderAddress, unsigned char* packetData, ssize_t packetLength);
|
||||
|
||||
protected:
|
||||
virtual void processPacket(sockaddr& senderAddress, unsigned char* packetData, ssize_t packetLength);
|
||||
|
||||
private:
|
||||
Application* _app;
|
||||
};
|
||||
|
|
|
@ -36,6 +36,8 @@ protected:
|
|||
|
||||
/// Locks all the resources of the thread.
|
||||
void lock() { pthread_mutex_lock(&_mutex); }
|
||||
|
||||
/// Unlocks all the resources of the thread.
|
||||
void unlock() { pthread_mutex_unlock(&_mutex); }
|
||||
|
||||
private:
|
||||
|
|
|
@ -14,16 +14,22 @@
|
|||
#include "GenericThread.h"
|
||||
#include "NetworkPacket.h"
|
||||
|
||||
/// Generalized threaded processor for queueing and sending of outbound packets.
|
||||
class PacketSender : public GenericThread {
|
||||
public:
|
||||
|
||||
PacketSender();
|
||||
// Call this when you have a packet you'd like sent...
|
||||
|
||||
/// Add packet to outbound queue.
|
||||
/// \param sockaddr& address the destination address
|
||||
/// \param packetData pointer to data
|
||||
/// \param ssize_t packetLength size of data
|
||||
/// \thread any thread, typically the application thread
|
||||
void queuePacket(sockaddr& address, unsigned char* packetData, ssize_t packetLength);
|
||||
|
||||
virtual bool process();
|
||||
|
||||
private:
|
||||
virtual bool process();
|
||||
|
||||
std::vector<NetworkPacket> _packets;
|
||||
uint64_t _lastSendTime;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "GenericThread.h"
|
||||
#include "NetworkPacket.h"
|
||||
|
||||
/// Generalized threaded processor for handler received inbound packets.
|
||||
/// Generalized threaded processor for handling received inbound packets.
|
||||
class ReceivedPacketProcessor : public GenericThread {
|
||||
public:
|
||||
|
||||
|
@ -25,6 +25,7 @@ public:
|
|||
/// \thread network receive thread
|
||||
void queuePacket(sockaddr& senderAddress, unsigned char* packetData, ssize_t packetLength);
|
||||
|
||||
protected:
|
||||
/// Callback for processing of recieved packets. Implement this to process the incoming packets.
|
||||
/// \param sockaddr& senderAddress the address of the sender
|
||||
/// \param packetData pointer to received data
|
||||
|
@ -32,7 +33,6 @@ public:
|
|||
/// \thread "this" individual processing thread
|
||||
virtual void processPacket(sockaddr& senderAddress, unsigned char* packetData, ssize_t packetLength) = 0;
|
||||
|
||||
protected:
|
||||
/// Implements generic processing behavior for this thread.
|
||||
virtual bool process();
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue