Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

Infrastructure Class Reference

Infrastructure resource class. More...

#include <TraplasObject.h>

Inheritance diagram for Infrastructure:

Inheritance graph
[legend]
Collaboration diagram for Infrastructure:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Infrastructure (int infrastructure_id, int type_infrastructure, double spd, int tile_type, unsigned int cap, double dist, osg::Node *infra_model)
bool addCarg (int a_carg)
int removeCarg (int r_carg)
int getTileType ()
double getSpeed ()
bool setSpeed (double s_spd)
unsigned int getCapacity ()
double getDistance ()
bool addArc (int to)
bool isArc (int end)
virtual string toString ()

Protected Attributes

int tileType
unsigned int capacity
double distance
double speed
int width
int height
set< int > cargoSet
map< int, int * > arcs

Detailed Description

Infrastructure resource class.

Infrastructure contains all information about one infrastructure resource such as speed, objects at the location of the infrastructure resource, tile type.

Definition at line 232 of file TraplasObject.h.


Constructor & Destructor Documentation

Infrastructure::Infrastructure int  infrastructure_id,
int  type_infrastructure,
double  spd,
int  tile_type,
unsigned int  cap,
double  dist,
osg::Node *  infra_model
 

Constructor.

Parameters:
infrastructure_id The identifier of this infrastructure resource.
type_infrastructure The type of this object.
spd The speed of this object.
tile_type The type of tile used in this object. See the appendix of the traplas-dbus interface specification.
cap The capacity of this infrastructure resource.
dist 
infra_model An osg-model of this infrastructure resource.

Definition at line 229 of file TraplasObject.cpp.

References capacity, distance, TraplasObject::id, TraplasObject::model, TraplasObject::selected, TraplasObject::setDescription(), speed, and TraplasObject::type.

Here is the call graph for this function:


Member Function Documentation

bool Infrastructure::addArc int  to  ) 
 

Sets the arc from this Infrastructure resource to the next.

Parameters:
to The identifier of the other side of the arc.
Returns:
true if succesfull, false if there has been an error.

Definition at line 260 of file TraplasObject.cpp.

References arcs.

Referenced by StateControl::arc().

bool Infrastructure::addCarg int  a_carg  ) 
 

Adds cargo to this infrastructure resouce.

Parameters:
a_carg The identifi of the cargo object.
Returns:
true if sucessfull, false if there has been an error.

Definition at line 255 of file TraplasObject.cpp.

References cargoSet.

Referenced by StateControl::newcarg(), and StateControl::unload().

unsigned int Infrastructure::getCapacity  )  [inline]
 

Returns:
The capacity or amount of transport resources that can be contained in this infrastructure resource at one time.

Definition at line 275 of file TraplasObject.h.

References capacity.

double Infrastructure::getDistance  )  [inline]
 

Returns:
The distance.

Definition at line 279 of file TraplasObject.h.

References distance.

double Infrastructure::getSpeed  )  [inline]
 

Returns:
The maximum speed in this infrastructure resource.

Definition at line 265 of file TraplasObject.h.

References speed.

int Infrastructure::getTileType  )  [inline]
 

Returns:
The type of tile that is used for representing this infrastructure resource.

Definition at line 261 of file TraplasObject.h.

References tileType.

bool Infrastructure::isArc int  end  ) 
 

Parameters:
end End point of arc to check.
Returns:
true if sucessfull, false if there has been an error.

Definition at line 268 of file TraplasObject.cpp.

References arcs.

int Infrastructure::removeCarg int  r_carg  ) 
 

Removes cargo from this infrastructure resource.

Parameters:
r_carg The identifier of the cargo to remove.
Returns:
The id of the cargo that has just been removed, or -1 if there was an error.

Definition at line 247 of file TraplasObject.cpp.

References cargoSet.

Referenced by StateControl::load().

bool Infrastructure::setSpeed double  s_spd  ) 
 

Sets the maximum speed in this infrastructure resource.

Parameters:
s_spd The new maximum speed.
Returns:
true if sucessfull, false if there has been an error.

Definition at line 242 of file TraplasObject.cpp.

References speed.

string Infrastructure::toString  )  [virtual]
 

Returns:
A string with information about this TraplasObject.

Reimplemented from TraplasObject.

Definition at line 273 of file TraplasObject.cpp.

References capacity, TraplasObject::description, and speed.


Member Data Documentation

map<int, int*> Infrastructure::arcs [protected]
 

Definition at line 303 of file TraplasObject.h.

Referenced by addArc(), and isArc().

unsigned int Infrastructure::capacity [protected]
 

Definition at line 297 of file TraplasObject.h.

Referenced by getCapacity(), Infrastructure(), and toString().

set<int> Infrastructure::cargoSet [protected]
 

Definition at line 302 of file TraplasObject.h.

Referenced by addCarg(), and removeCarg().

double Infrastructure::distance [protected]
 

Definition at line 298 of file TraplasObject.h.

Referenced by getDistance(), and Infrastructure().

int Infrastructure::height [protected]
 

Definition at line 301 of file TraplasObject.h.

double Infrastructure::speed [protected]
 

Definition at line 299 of file TraplasObject.h.

Referenced by getSpeed(), Infrastructure(), setSpeed(), and toString().

int Infrastructure::tileType [protected]
 

Definition at line 296 of file TraplasObject.h.

Referenced by getTileType().

int Infrastructure::width [protected]
 

Definition at line 300 of file TraplasObject.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 19 10:22:18 2006 for TraplasVisualisation by  doxygen 1.4.4