Documentation of the code done by Sam

This commit is contained in:
Sam Mario Svensson 2013-11-29 09:18:58 +01:00
parent 407f3c5c9a
commit 3c681352da
6 changed files with 30 additions and 5 deletions

View File

@ -13,6 +13,10 @@ namespace Oyster
class IQueue class IQueue
{ {
public: public:
//---------------------------------------------
//standard operations of the std::queue
//---------------------------------------------
virtual ~IQueue() {}; virtual ~IQueue() {};
virtual void Push( Type item ) = 0; virtual void Push( Type item ) = 0;
virtual Type Pop() = 0; virtual Type Pop() = 0;

View File

@ -3,7 +3,9 @@
//////////////////////////////////////////// ////////////////////////////////////////////
// Thread safe queue implemented // Thread safe queue implemented
// with single linked list. // with single linked list and template.
// uses mutex to lock the queue
// otherwise its a standard queue
// Created by Sam Svensson 2013 // Created by Sam Svensson 2013
///////////////////////////////////////////// /////////////////////////////////////////////

View File

@ -20,6 +20,7 @@ namespace Oyster
Connection( int socket ) { this->socket = socket; }; Connection( int socket ) { this->socket = socket; };
virtual ~Connection(); virtual ~Connection();
virtual int InitiateServer( unsigned short port ); virtual int InitiateServer( unsigned short port );
virtual int InitiateClient(); virtual int InitiateClient();
@ -28,6 +29,7 @@ namespace Oyster
virtual int Disconnect(); virtual int Disconnect();
virtual int Connect( unsigned short port , const char serverName[] ); virtual int Connect( unsigned short port , const char serverName[] );
virtual int Listen(); virtual int Listen();
private: private:

View File

@ -14,13 +14,25 @@ namespace Oyster
{ {
public: public:
virtual int Disconnect() = 0;
//sends and recieve functions with bytearrays,
//will send to the users connection via socket
virtual int Send( OysterByte& bytes ) = 0; virtual int Send( OysterByte& bytes ) = 0;
virtual int Recieve( OysterByte& bytes) = 0; virtual int Recieve( OysterByte& bytes) = 0;
//initiates sockets and address for server and client
virtual int InitiateServer( unsigned short port ) { return false; }; virtual int InitiateServer( unsigned short port ) { return false; };
virtual int InitiateClient() { return false; }; virtual int InitiateClient() { return false; };
//Listen function to let client connect, only used by the server
virtual int Listen() { return -1; }; virtual int Listen() { return -1; };
//enables the client to connect with a server with use of name and port
//(servers uses Listen instead of connect)
virtual int Connect( unsigned short port, const char serverName[] ) { return false; }; virtual int Connect( unsigned short port, const char serverName[] ) { return false; };
//Disconnects the client or server TODO: optimize!
virtual int Disconnect() = 0;
}; };
} }
} }

View File

@ -14,6 +14,7 @@ namespace Oyster
{ {
public: public:
//packs and unpacks packages for sending or recieving over the connection
virtual void Pack (Protocols::ProtocolHeader &header, OysterByte& bytes) = 0; virtual void Pack (Protocols::ProtocolHeader &header, OysterByte& bytes) = 0;
virtual void Unpack (Protocols::ProtocolSet* set, OysterByte& bytes ) = 0; virtual void Unpack (Protocols::ProtocolSet* set, OysterByte& bytes ) = 0;

View File

@ -1,9 +1,13 @@
#ifndef NETWORK_DEPENDENCIES_PROTOCOLS_H #ifndef NETWORK_DEPENDENCIES_PROTOCOLS_H
#define NETWORK_DEPENDENCIES_PROTOCOLS_H #define NETWORK_DEPENDENCIES_PROTOCOLS_H
////////////////////////////////// //////////////////////////////////////
// Created by Sam Svensson 2013 // // Created by Sam Svensson 2013
////////////////////////////////// // Holder structs for our protocols
// with the use of union.
// each packagetyp
// is linked to a protocol
//////////////////////////////////////
#include <string> #include <string>