GridComputing
Job Management in Grid Computing
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Grid Class Reference

#include <grid.h>

Inheritance diagram for Grid:
ISave IUpdate IPrint

Public Member Functions

 Grid (const std::string &name, const std::string &topic)
 Constructor of Grid, takes a name and subject as arguments.
 
 ~Grid ()
 Destructor, free allocated GridManager.
 
GridManagerGetGridManager ()
 Returns the underlying GridManager (allows modification)
 
const std::string & GetName () const
 Returns the name of the Grid.
 
void ChangeName (const std::string &name)
 Modifies the name of the Grid with a new name.
 
const std::string & GetTopic () const
 Returns the subject of the Grid.
 
void ChangeTopic (const std::string &topic)
 Modifies the subject of the Grid with a new subject.
 
uint GetAvailableMachineCount () const
 Returns the total amount of machines in the underlying GridManager.
 
double HighestMachineRAM () const
 Returns the RAM (in GB) of the machine with the highest amount of RAM. 0 if there are no machines.
 
double TotalDiskSpace () const
 Returns the total amount of disk space (in GB) available in the machines.
 
bool Save (ByteBuffer &bb) const override
 Saves the information of the instance of the class to the given ByteBuffer.
 
void Update (uint32 diff) override
 Updates the underlying GridManager.
 
void Print (std::ostream &os=std::cout) const override
 Prints current Grid information.
 

Static Public Member Functions

static GridLoad (ByteBuffer &bb)
 Returns a pointer to a Grid loaded from the given ByteBuffer.
 
static void PrintHeader (std::ostream &os=std::cout)
 Prints table header for Grids.
 

Private Member Functions

 Grid (const std::string &name, const std::string &topic, GridManager *gm)
 Constructor of Grid, takes a name, subject and existing GridManager as arguments.
 
 Grid (const Grid &)
 Copy constructor. Private to avoid copies of a Grid instance.
 
Gridoperator= (Grid const &)
 Assignment operator. Private to avoid copies of a Grid instance.
 

Private Attributes

GridManager_gm
 Underlying GridManager.
 
std::string _name
 Name.
 
std::string _topic
 Subject.
 

Static Private Attributes

static uint _maxNameLength = 4
 The length of the biggest name, used in Print methods.
 
static uint _maxTopicLength = 5
 The length of the biggest topic, used in Print methods.
 

Constructor & Destructor Documentation

Grid::Grid ( const std::string &  name,
const std::string &  topic,
GridManager gm 
)
private

Constructor of Grid, takes a name, subject and existing GridManager as arguments.

Grid::Grid ( const std::string &  name,
const std::string &  topic 
)

Constructor of Grid, takes a name and subject as arguments.

Grid::~Grid ( )

Destructor, free allocated GridManager.

Grid::Grid ( const Grid )
private

Copy constructor. Private to avoid copies of a Grid instance.

Member Function Documentation

void Grid::ChangeName ( const std::string &  name)

Modifies the name of the Grid with a new name.

void Grid::ChangeTopic ( const std::string &  topic)

Modifies the subject of the Grid with a new subject.

uint Grid::GetAvailableMachineCount ( ) const

Returns the total amount of machines in the underlying GridManager.

GridManager* Grid::GetGridManager ( )

Returns the underlying GridManager (allows modification)

const std::string& Grid::GetName ( ) const

Returns the name of the Grid.

const std::string& Grid::GetTopic ( ) const

Returns the subject of the Grid.

double Grid::HighestMachineRAM ( ) const

Returns the RAM (in GB) of the machine with the highest amount of RAM. 0 if there are no machines.

Grid * Grid::Load ( ByteBuffer bb)
static

Returns a pointer to a Grid loaded from the given ByteBuffer.

Parameters
bbsource of the data.
Returns
A pointer to the loaded Grid.
Grid& Grid::operator= ( Grid const &  )
private

Assignment operator. Private to avoid copies of a Grid instance.

void Grid::Print ( std::ostream &  os = std::cout) const
overridevirtual

Prints current Grid information.

Implements IPrint.

void Grid::PrintHeader ( std::ostream &  os = std::cout)
static

Prints table header for Grids.

bool Grid::Save ( ByteBuffer bb) const
overridevirtual

Saves the information of the instance of the class to the given ByteBuffer.

Parameters
bbdestination of the data.
Returns
A boolean value that indicates whether the save was successful or not.

Implements ISave.

double Grid::TotalDiskSpace ( ) const

Returns the total amount of disk space (in GB) available in the machines.

void Grid::Update ( uint32  diff)
overridevirtual

Updates the underlying GridManager.

Implements IUpdate.

Member Data Documentation

GridManager* Grid::_gm
private

Underlying GridManager.

uint Grid::_maxNameLength = 4
staticprivate

The length of the biggest name, used in Print methods.

uint Grid::_maxTopicLength = 5
staticprivate

The length of the biggest topic, used in Print methods.

std::string Grid::_name
private

Name.

std::string Grid::_topic
private

Subject.


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