Public Member Functions

FIFE::Model Class Reference

#include <model.h>

Inheritance diagram for FIFE::Model:
Inheritance graph
[legend]
Collaboration diagram for FIFE::Model:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Model (RenderBackend *renderbackend, const std::vector< RendererBase * > &renderers)
 ~Model ()
MapcreateMap (const std::string &identifier)
void deleteMap (Map *)
const std::list< Map * > & getMaps () const
MapgetMap (const std::string &identifier) const
uint32_t getMapCount () const
void deleteMaps ()
std::list< std::string > getNamespaces () const
ObjectcreateObject (const std::string &identifier, const std::string &name_space, Object *parent=0)
bool deleteObject (Object *)
bool deleteObjects ()
ObjectgetObject (const std::string &id, const std::string &name_space)
std::list< Object * > getObjects (const std::string &name_space) const
void adoptPather (IPather *pather)
IPather * getPather (const std::string &pathername)
void adoptCellGrid (CellGrid *grid)
CellGrid * getCellGrid (const std::string &gridtype)
void update ()
void setTimeMultiplier (float multip)
double getTimeMultiplier () const

Detailed Description

A model is a facade for everything in the model.

Definition at line 53 of file model.h.


Constructor & Destructor Documentation

FIFE::Model::Model ( RenderBackend renderbackend,
const std::vector< RendererBase * > &  renderers 
)

Constructor

Definition at line 46 of file model.cpp.

FIFE::Model::~Model (  ) 

Destructor

Definition at line 54 of file model.cpp.


Member Function Documentation

void FIFE::Model::adoptCellGrid ( CellGrid *  grid  ) 

Adds cellgrid to model. Moves ownership to model

Definition at line 91 of file model.cpp.

void FIFE::Model::adoptPather ( IPather *  pather  ) 

Adds pather to model. Moves ownership to model

Definition at line 76 of file model.cpp.

Map * FIFE::Model::createMap ( const std::string &  identifier  ) 

Add a map this model, and get a pointer to it. The returned pointer is owned by the Model, so don't delete it!

Definition at line 63 of file model.cpp.

Object * FIFE::Model::createObject ( const std::string &  identifier,
const std::string &  name_space,
Object parent = 0 
)

Add an object to the metamodel.

Parameters:
identifier A string for identifying this object; must be unique for its namespace.
parent Objects may optionally inherit values from a parent object.
Note:
This object belongs to the model, so don't delete the returned pointer

Definition at line 148 of file model.cpp.

void FIFE::Model::deleteMap ( Map map  ) 

Remove a map from this model

Definition at line 119 of file model.cpp.

void FIFE::Model::deleteMaps (  ) 

Removes all maps from this model

Definition at line 134 of file model.cpp.

bool FIFE::Model::deleteObject ( Object object  ) 

Attempt to remove an object from the model Fails and returns false if the object is referenced by an instance.

Definition at line 168 of file model.cpp.

bool FIFE::Model::deleteObjects (  ) 

Attempt to remove all objects from the model Fails and returns false if any maps with instances are present.

Definition at line 200 of file model.cpp.

CellGrid * FIFE::Model::getCellGrid ( const std::string &  gridtype  ) 

Returns new copy of cellgrid corresponding given name. If none found, returns NULL

Definition at line 95 of file model.cpp.

Map * FIFE::Model::getMap ( const std::string &  identifier  )  const

Get a map.

Parameters:
identifier the id of the map to be found.

Definition at line 109 of file model.cpp.

uint32_t FIFE::Model::getMapCount (  )  const

Return the number of maps in this model

Definition at line 130 of file model.cpp.

const std::list<Map*>& FIFE::Model::getMaps (  )  const [inline]

Get all the maps in the model.

Definition at line 77 of file model.h.

std::list< std::string > FIFE::Model::getNamespaces (  )  const

Get a list of namespaces currently referenced by objects in the metamodel.

Definition at line 139 of file model.cpp.

Object * FIFE::Model::getObject ( const std::string &  id,
const std::string &  name_space 
)

Get an object by its id. Returns 0 if object is not found.

Definition at line 223 of file model.cpp.

std::list< Object * > FIFE::Model::getObjects ( const std::string &  name_space  )  const

Get all the objects in the given namespace.

Definition at line 233 of file model.cpp.

IPather * FIFE::Model::getPather ( const std::string &  pathername  ) 

Returns pather corresponding given name. If none found, returns NULL

Definition at line 80 of file model.cpp.

double FIFE::Model::getTimeMultiplier (  )  const [inline]

Gets model speed.

See also:
setTimeMultiplier.

Definition at line 151 of file model.h.

References FIFE::TimeProvider::getMultiplier().

void FIFE::Model::setTimeMultiplier ( float  multip  )  [inline]

Sets speed for the model. With speed 1.0, everything runs with normal speed. With speed 2.0, clock is ticking twice as fast. With 0, everything gets paused. Negavtive values are not supported (throws NotSupported exception).

Definition at line 147 of file model.h.

References FIFE::TimeProvider::setMultiplier().

void FIFE::Model::update (  ) 

Called periodically to update events on model

Definition at line 270 of file model.cpp.


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