FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
FIFE::Model Class Reference

#include <model.h>

Inheritance diagram for FIFE::Model:
Inheritance graph
Collaboration diagram for FIFE::Model:
Collaboration graph

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
- Public Member Functions inherited from FIFE::FifeClass
fifeid_t getFifeId ()
virtual void addRef ()
virtual void decRef ()
virtual unsigned int getRefCount ()
- Public Member Functions inherited from FIFE::IReferenceCounted
virtual void addRef ()=0
virtual void decRef ()=0
virtual unsigned int getRefCount ()=0

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 47 of file model.cpp.

FIFE::Model::~Model ( )

Destructor

Definition at line 58 of file model.cpp.


Member Function Documentation

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

Adds cellgrid to model. Moves ownership to model

Definition at line 94 of file model.cpp.

Referenced by FIFE::Engine::init().

Here is the caller graph for this function:

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

Adds pather to model. Moves ownership to model

Definition at line 80 of file model.cpp.

Referenced by FIFE::Engine::init().

Here is the caller graph for this function:

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 67 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:
identifierA string for identifying this object; must be unique for its namespace.
parentObjects 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 150 of file model.cpp.

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

Remove a map from this model

Definition at line 121 of file model.cpp.

void FIFE::Model::deleteMaps ( )

Removes all maps from this model

Definition at line 136 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 170 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 202 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 98 of file model.cpp.

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

Get a map.

Parameters:
identifierthe id of the map to be found.

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

uint32_t FIFE::Model::getNumMaps ( ) const

Return the number of maps in this model

Definition at line 132 of file model.cpp.

Referenced by FIFE::Engine::pump().

Here is the caller graph for this function:

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 225 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 235 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 84 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 271 of file model.cpp.

Referenced by FIFE::Engine::pump().

Here is the caller graph for this function:


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