Просмотр исходного кода

Doxygen commented the Server class.

cib 13 лет назад
Родитель
Сommit
2621847e44
1 измененных файлов с 37 добавлено и 4 удалено
  1. 37 4
      Core/Contents/Include/PolyServer.h

+ 37 - 4
Core/Contents/Include/PolyServer.h

@@ -67,20 +67,53 @@ namespace Polycode {
 		static const int EVENT_CLIENT_DISCONNECTED = 2;		
 	};
 
+	/** 
+	* A network server, accepting incoming connections and keeping track of connected clients.
+	*
+	* As the Peer class already provides all connectivity functionality required, the Server class
+	* merely provides another abstraction layer to treat game clients separately from mere connections.
+	*
+	* The Server will process incoming packets N times per second, where N is an argument to the constructor.
+	* This means you can coordinate the server's reaction time to your game's internal timer.
+	*/
 	class _PolyExport Server : public Peer {
 		public:
+			/**
+			* Constructor.
+			* @param port The port to listen for client connections on.
+			* @param rate How many times per second this instance should check for new incoming packets.
+			* @param world A singleton which manages the "world" of the gameserver this network server is
+			*        attached to.
+			*/
 			Server(unsigned int port, unsigned int rate, ServerWorld *world = NULL);
 			~Server();
 		
-			void DisconnectClient(ServerClient *client);
-			void handleEvent(Event *event);		
+			void handlePacket(Packet *packet, PeerConnection *connection);
+			void handleEvent(Event *event);	
 			void handlePeerConnection(PeerConnection *connection);
+
+			/**
+			* Callback handler invoked when a client disconnects.
+			* @param client The client that disconnected.
+			*/
+			void DisconnectClient(ServerClient *client);
+
+			/**
+			* Get a connected client from its associated peer connection, if any.
+			* @param connection The PeerConnection through which we're communicating 
+			*                   with the client to obtain.
+			*/
 			ServerClient *getConnectedClient(PeerConnection *connection);
 		
+			/**
+			* @see Peer::sendReliableData
+			*/
 			void sendReliableDataToClient(ServerClient *client, char *data, unsigned int size, unsigned short type);
+
+			/**
+			* @see Peer::sendReliableDataToAll
+			*/
 			void sendReliableDataToAllClients(char *data, unsigned int size, unsigned short type);
-					
-			void handlePacket(Packet *packet, PeerConnection *connection);
 		
 	protected: