SubSpace Class Reference

#include <SubSpace.h>

List of all members.

Public Member Functions

 SubSpace ()
 SubSpace (int id)
 SubSpace (int id, IPAddress resp_id)
 SubSpace (int id, IPAddress resp_id, IPAddress backup_ip)
int getId () const
void setId (int id)
IPAddress getRespIp () const
void setRespIp (IPAddress resp_ip)
IPAddress getBackupIp () const
void setBackupIp (IPAddress backup_ip)
GameState getGameState () const
void setGameState (GameState gamestate)
IPAddress getNeighbor (int direction) const
void setNeighbor (int direction, IPAddress resp_ip)
int getTimeSlot ()
void setTimeSlot (int timeSlot)

Private Attributes

int id
int timeSlot
IPAddress resp_ip
IPAddress backup_ip
GameState gamestate
IPAddress neighbors [8]

Friends

std::ostream & operator<< (std::ostream &Stream, const SubSpace S)


Constructor & Destructor Documentation

SubSpace::SubSpace (  ) 

00021                    {
00022 }

SubSpace::SubSpace ( int  id  ) 

00024                          {
00025         this->id = id;
00026         this->resp_ip = (IPAddress) "127.0.0.1";
00027         this->backup_ip = (IPAddress) "127.0.0.1";
00028         for ( int i=0 ; i <= 7 ; i++ ) {
00029                 neighbors[i] = (IPAddress) "127.0.0.1";
00030         }
00031         this->timeSlot = -1;
00032 }

SubSpace::SubSpace ( int  id,
IPAddress  resp_id 
)

00034                                             {
00035         this->id = id;
00036         this->resp_ip = resp_ip;
00037         this->backup_ip = (IPAddress) "127.0.0.1";
00038         for ( int i=0 ; i <= 7 ; i++ ) {
00039                 neighbors[i] = (IPAddress) "127.0.0.1";
00040         }
00041         this->timeSlot = -1 ;
00042 }

SubSpace::SubSpace ( int  id,
IPAddress  resp_id,
IPAddress  backup_ip 
)

00044                                                                  {
00045         this->id = id;
00046         this->resp_ip = resp_ip;
00047         this->backup_ip = backup_ip;
00048         for ( int i=0 ; i <= 7 ; i++ ) {
00049                 neighbors[i] = (IPAddress) "127.0.0.1";
00050         }
00051         this->timeSlot = -1;
00052 }


Member Function Documentation

int SubSpace::getId (  )  const

00060                           {
00061         return id;
00062 }

void SubSpace::setId ( int  id  ) 

00063                            {
00064         this->id = id;
00065 }

IPAddress SubSpace::getRespIp (  )  const

00066                                     {
00067         return resp_ip;
00068 }

void SubSpace::setRespIp ( IPAddress  resp_ip  ) 

00069                                           {
00070         this->resp_ip = resp_ip;
00071 }

IPAddress SubSpace::getBackupIp (  )  const

00072                                       {
00073         return backup_ip;
00074 }

void SubSpace::setBackupIp ( IPAddress  backup_ip  ) 

00075                                               {
00076         this->backup_ip = backup_ip;
00077 }

GameState SubSpace::getGameState (  )  const

00078                                        {
00079         return gamestate;
00080 }

void SubSpace::setGameState ( GameState  gamestate  ) 

00081                                                {
00082         this->gamestate = gamestate;
00083 }

IPAddress SubSpace::getNeighbor ( int  direction  )  const

00094                                                    {
00095         if( direction <= 8 ) {
00096                 return this->neighbors[direction];
00097         }
00098         return (IPAddress) "127.0.0.1";
00099 }

void SubSpace::setNeighbor ( int  direction,
IPAddress  resp_ip 
)

00085                                                            {
00086         if ( direction == -1 ) {
00087                 this->backup_ip = resp_ip;
00088         } 
00089         else if( direction <= 8 ) {
00090                 this->neighbors[direction] = resp_ip;
00091         }
00092 }

int SubSpace::getTimeSlot (  ) 

00054                           {
00055         return timeSlot;
00056 }

void SubSpace::setTimeSlot ( int  timeSlot  ) 

00057                                        {
00058         this->timeSlot = timeSlot;
00059 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  Stream,
const SubSpace  S 
) [friend]

00102 {
00103     return Stream << "SubSpaceId: " << s.getId() << " : " << s.getRespIp() << " : " << s.getBackupIp() << "\n NW" << s.getNeighbor(NW) << " N " << s.getNeighbor(N) << " NE " << s.getNeighbor(NE) << "\n W " << s.getNeighbor(W) << "      E " << s.getNeighbor(E) << "\n SW:" << s.getNeighbor(SW) << " S " << s.getNeighbor(S) << " SE " << s.getNeighbor(SE) << "\n======================================\n";
00104 }


Member Data Documentation

int SubSpace::id [private]

int SubSpace::timeSlot [private]

IPAddress SubSpace::resp_ip [private]

IPAddress SubSpace::backup_ip [private]

GameState SubSpace::gamestate [private]

IPAddress SubSpace::neighbors[8] [private]


The documentation for this class was generated from the following files:
Generated on Thu Apr 17 13:19:30 2008 for ITM OverSim by  doxygen 1.5.3