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, ImagePool *imagepool, AnimationPool *animpool)
 ~Model ()
MapcreateMap (const std::string &identifier)
void deleteMap (Map *)
const std::list< Map * > & getMaps () const
MapgetMap (const std::string &identifier) const
uint32_t getNumMaps () 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 (AbstractPather *pather)
AbstractPather * 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 55 of file model.h.


Constructor & Destructor Documentation

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

Constructor

Definition at line 46 of file model.cpp.

FIFE::Model::~Model (  ) 

Destructor

Definition at line 57 of file model.cpp.


Member Function Documentation

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

Adds cellgrid to model. Moves ownership to model

Definition at line 93 of file model.cpp.

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

Adds pather to model. Moves ownership to model

Definition at line 79 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 66 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 149 of file model.cpp.

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

Remove a map from this model

Definition at line 120 of file model.cpp.

void FIFE::Model::deleteMaps (  ) 

Removes all maps from this model

Definition at line 135 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 169 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 201 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 97 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 110 of file model.cpp.

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

Get all the maps in the model.

Definition at line 80 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 140 of file model.cpp.

uint32_t FIFE::Model::getNumMaps (  )  const

Return the number of maps in this model

Definition at line 131 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 224 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 234 of file model.cpp.

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

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

Definition at line 83 of file model.cpp.

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

Gets model speed.

See also:
setTimeMultiplier.

Definition at line 154 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 150 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:
Generated on Wed Nov 23 13:04:58 2011 for FIFE by  doxygen 1.6.3