Public Member Functions | Protected Attributes

GlobalCoordinator Class Reference

#include <GlobalCoordinator.h>

List of all members.

Public Member Functions

virtual void initialize ()
virtual void handleMessage (cMessage *msg)
virtual ~GlobalCoordinator ()
void increasePositionSize ()
void increasePeerCount ()
int getPeerCount ()
Vector2DgetPosition (int k)
void setPosition (int k, const Vector2D &Position)
unsigned int getSeed ()

Protected Attributes

Vector2DPosition
int PositionSize
int PeerCount
unsigned int Seed

Detailed Description

Definition at line 32 of file GlobalCoordinator.h.


Constructor & Destructor Documentation

GlobalCoordinator::~GlobalCoordinator (  )  [virtual]

Definition at line 38 of file GlobalCoordinator.cc.

{
    delete[] this->Position;
}


Member Function Documentation

int GlobalCoordinator::getPeerCount (  ) 

Definition at line 66 of file GlobalCoordinator.cc.

Referenced by greatGathering::greatGathering(), and groupRoaming::groupRoaming().

{
    Enter_Method_Silent();
    return PeerCount;
}

Vector2D & GlobalCoordinator::getPosition ( int  k  ) 

Definition at line 72 of file GlobalCoordinator.cc.

Referenced by greatGathering::greatGathering(), groupRoaming::groupRoaming(), and groupRoaming::move().

{
    Enter_Method_Silent();
    if(k >= PositionSize || k < 0) {
        throw cRuntimeError("Array out of bounds exception! getPosition(%d)", k);
    }
    return Position[k];
}

unsigned int GlobalCoordinator::getSeed (  ) 
void GlobalCoordinator::handleMessage ( cMessage *  msg  )  [virtual]

Definition at line 43 of file GlobalCoordinator.cc.

{
    error("this module doesn't handle messages, it runs only in initialize()");
}

void GlobalCoordinator::increasePeerCount (  ) 

Definition at line 60 of file GlobalCoordinator.cc.

Referenced by greatGathering::greatGathering(), and groupRoaming::groupRoaming().

{
    Enter_Method_Silent();
    PeerCount++;
}

void GlobalCoordinator::increasePositionSize (  ) 

Definition at line 48 of file GlobalCoordinator.cc.

Referenced by greatGathering::greatGathering(), and groupRoaming::groupRoaming().

{
    Enter_Method_Silent();
    PositionSize++;
    Vector2D *Temp = new Vector2D[PositionSize];
    for(int i=0; i<PositionSize-1; i++)
        Temp[i] = this->Position[i];

    delete[] this->Position;
    this->Position = Temp;
}

void GlobalCoordinator::initialize (  )  [virtual]

Definition at line 28 of file GlobalCoordinator.cc.

{
    PositionSize = 0;
    PeerCount = 0;
    Position = NULL;
    Seed = par("seed");

    WATCH(PositionSize);
}

void GlobalCoordinator::setPosition ( int  k,
const Vector2D Position 
)

Definition at line 81 of file GlobalCoordinator.cc.

Referenced by greatGathering::greatGathering(), groupRoaming::groupRoaming(), and groupRoaming::move().

{
    Enter_Method_Silent();
    if(k >= PositionSize || k < 0) {
        throw cRuntimeError("Array out of bounds exception! setPosition(%d, ...)", k);
    }
    this->Position[k] = Position;
}


Member Data Documentation

Definition at line 49 of file GlobalCoordinator.h.

Referenced by getPeerCount(), increasePeerCount(), and initialize().

Definition at line 49 of file GlobalCoordinator.h.

Referenced by getPosition(), increasePositionSize(), initialize(), and setPosition().

unsigned int GlobalCoordinator::Seed [protected]

Definition at line 50 of file GlobalCoordinator.h.

Referenced by getSeed(), and initialize().


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