orxonox::Host Class Reference

Base class of Server and Client This is the Base class of the Server and Client classes More...

#include <src/network/Host.h>

Inheritance diagram for orxonox::Host:

orxonox::Client orxonox::Server

List of all members.

Static Public Member Functions

static bool addPacket (ENetPacket *packet, int clientID=0)
static bool Broadcast (const std::string &message)
static bool Chat (const std::string &message)
static unsigned int getPlayerID ()
static unsigned int getShipID ()
static bool incomingChat (const std::string &message, unsigned int playerID)
static bool isServer ()
static bool running ()
static void setClientID (unsigned int id)
static void setShipID (unsigned int id)

Protected Member Functions

 Host ()
 Constructor: assures that only one reference will be created and sets the pointer.
virtual ~Host ()
 Destructor: resets the instance pointer to 0.

Protected Attributes

unsigned int clientID_
unsigned int shipID_

Static Protected Attributes

static Hostinstance_ = 0

Private Member Functions

virtual bool broadcast (const std::string &message)=0
virtual bool chat (const std::string &message)=0
virtual bool isServer_ ()=0
virtual bool processChat (const std::string &message, unsigned int playerID)=0
virtual bool queuePacket (ENetPacket *packet, int clientID)=0


Detailed Description

Base class of Server and Client This is the Base class of the Server and Client classes

Author:
Oliver Scheuss

Constructor & Destructor Documentation

orxonox::Host::Host (  )  [protected]

Constructor: assures that only one reference will be created and sets the pointer.

References clientID_, and instance_.

orxonox::Host::~Host (  )  [protected, virtual]

Destructor: resets the instance pointer to 0.

References instance_.


Member Function Documentation

bool orxonox::Host::addPacket ( ENetPacket packet,
int  clientID = 0 
) [static]

This function is used to add an enetpacket to be sent to another peer

Parameters:
packet Packet to be added
clientID ID of the client the packet should be sent to
Returns:
success?

References instance_, and queuePacket().

Referenced by orxonox::packet::Packet::send().

bool orxonox::Host::Broadcast ( const std::string message  )  [static]

virtual bool orxonox::Host::broadcast ( const std::string message  )  [private, pure virtual]

Implemented in orxonox::Client, and orxonox::Server.

Referenced by Broadcast().

bool orxonox::Host::Chat ( const std::string message  )  [static]

References chat(), and instance_.

virtual bool orxonox::Host::chat ( const std::string message  )  [private, pure virtual]

Implemented in orxonox::Client, and orxonox::Server.

Referenced by Chat().

unsigned int orxonox::Host::getPlayerID (  )  [static]

This function returns the ID of the player

Returns:
playerID

References clientID_, and instance_.

Referenced by orxonox::Server::chat(), orxonox::Client::chat(), and orxonox::HumanPlayer::networkcallback_clientIDchanged().

static unsigned int orxonox::Host::getShipID (  )  [inline, static]

bool orxonox::Host::incomingChat ( const std::string message,
unsigned int  playerID 
) [static]

References instance_, and processChat().

Referenced by orxonox::packet::Chat::process().

static bool orxonox::Host::isServer (  )  [inline, static]

virtual bool orxonox::Host::isServer_ (  )  [private, pure virtual]

Implemented in orxonox::Client, and orxonox::Server.

virtual bool orxonox::Host::processChat ( const std::string message,
unsigned int  playerID 
) [private, pure virtual]

Implemented in orxonox::Client, and orxonox::Server.

Referenced by incomingChat().

virtual bool orxonox::Host::queuePacket ( ENetPacket packet,
int  clientID 
) [private, pure virtual]

Implemented in orxonox::Client, and orxonox::Server.

Referenced by addPacket().

static bool orxonox::Host::running (  )  [inline, static]

static void orxonox::Host::setClientID ( unsigned int  id  )  [inline, static]

static void orxonox::Host::setShipID ( unsigned int  id  )  [inline, static]


Member Data Documentation

unsigned int orxonox::Host::clientID_ [protected]

Referenced by getPlayerID(), and Host().

Host * orxonox::Host::instance_ = 0 [static, protected]

unsigned int orxonox::Host::shipID_ [protected]


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

Generated on Tue Jul 28 16:22:35 2009 for Orxonox by  doxygen 1.5.6