Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

anoid::base::Object Class Reference

#include <object.hh>

Inheritance diagram for anoid::base::Object:

Inheritance graph
[legend]
Collaboration diagram for anoid::base::Object:

Collaboration graph
[legend]
List of all members.

Public Methods

Object * getParent ()
AbstractWorldgetWorld ()
virtual Object * add (Object *o)
 Object (int i=0)
virtual void init (config::Configuration &c)
virtual void update ()
virtual void redraw ()
virtual void receive (Message *m)
void listen (const std::string &m)

Protected Attributes

int ID
Object * parent
AbstractWorldworld
std::vector< Object * > children

Detailed Description

Base object. It takes care of anything concerning configuration and the simple composite and observer structure.

Definition at line 28 of file object.hh.


Constructor & Destructor Documentation

anoid::base::Object::Object int    i = 0
 

Construct a new Object

Parameters:
i  give the object a fixed ID

Definition at line 22 of file object.cc.

References anoid::simple::i(), and NULL.

Referenced by anoid::plugin::Force::Force().


Member Function Documentation

Object * anoid::base::Object::add Object *    o [virtual]
 

Add an object to this object (+ set up parent and world)

Parameters:
o  the object to be added

Reimplemented in anoid::base::Element.

Definition at line 11 of file object.cc.

References children, anoid::base::AbstractWorld::getFreshID(), ID, NULL, parent, and world.

Referenced by init().

Object* anoid::base::Object::getParent   [inline]
 

getParent

Returns:
the parent of the current object, or NULL if this is the root element

Definition at line 38 of file object.hh.

Referenced by anoid::plugin::Force::Force(), and anoid::base::Ability::init().

AbstractWorld* anoid::base::Object::getWorld   [inline]
 

getWorld

Returns:
the world (root element) of the current object

Definition at line 42 of file object.hh.

Referenced by anoid::plugin::Force::Force(), anoid::plugin::Gravitation::getApplicationPoint(), anoid::plugin::Rotation::init(), anoid::plugin::Move::init(), anoid::plugin::Box::init(), anoid::base::Ability::init(), listen(), anoid::plugin::Scale::redraw(), anoid::plugin::Position::redraw(), anoid::base::Element::redraw(), anoid::plugin::Box::redraw(), anoid::plugin::Velocity::update(), anoid::plugin::SpinVelocity::update(), anoid::plugin::Dynamics::update(), and anoid::plugin::Acceleration::update().

void anoid::base::Object::init config::Configuration   c [virtual]
 

This is the real initialiser. It should take it's parameters from the provided configuration

Parameters:
c  the configuration describing this object and it's children

Reimplemented in anoid::base::Ability, anoid::plugin::Acceleration, anoid::plugin::Alpha, anoid::plugin::AscShape, anoid::plugin::Box, anoid::plugin::Color, anoid::plugin::Dynamics, anoid::plugin::Mass, anoid::plugin::Move, anoid::plugin::anoid::Pad, anoid::plugin::Position, anoid::plugin::Rotation, anoid::plugin::Scale, anoid::plugin::Sphere, anoid::plugin::Spin, anoid::plugin::SpinVelocity, anoid::plugin::Velocity, and anoid::main::World.

Definition at line 25 of file object.cc.

References add(), children, anoid::base::AbstractWorld::loadObject(), and world.

void anoid::base::Object::listen const std::string &    m
 

Definition at line 58 of file object.cc.

References getWorld(), and anoid::base::AbstractWorld::listen().

Referenced by anoid::plugin::anoid::Pad::init().

void anoid::base::Object::receive Message   m [virtual]
 

Called when a message has been sent, and this object has subscribed to it

Parameters:
m  the message sent

Definition at line 52 of file object.cc.

References children, and anoid::simple::i().

void anoid::base::Object::redraw   [virtual]
 

Called just after update has been called on the entire world. This should draw the objects (using OpenGL).

Reimplemented in anoid::plugin::Alpha, anoid::plugin::AscShape, anoid::plugin::Box, anoid::plugin::Color, anoid::plugin::Dynamics, anoid::base::Element, anoid::plugin::Position, anoid::plugin::Rotation, anoid::plugin::Scale, anoid::base::Shape, anoid::plugin::Sphere, anoid::plugin::SpinVelocity, and anoid::main::World.

Definition at line 46 of file object.cc.

References children, and anoid::simple::i().

Referenced by anoid::main::Anoid::runLevel().

void anoid::base::Object::update   [virtual]
 

Called when the main loop is ready for another step. Should be used to perform any calculations prior to movement.

Reimplemented in anoid::plugin::Acceleration, anoid::plugin::Dynamics, anoid::plugin::Move, anoid::plugin::Spin, anoid::plugin::SpinVelocity, anoid::plugin::Velocity, and anoid::main::World.

Definition at line 40 of file object.cc.

References children, and anoid::simple::i().

Referenced by anoid::main::Anoid::runLevel().


Member Data Documentation

std::vector<Object*> anoid::base::Object::children [protected]
 

Definition at line 33 of file object.hh.

Referenced by add(), anoid::main::World::begin(), anoid::main::World::end(), init(), receive(), redraw(), and update().

int anoid::base::Object::ID [protected]
 

Definition at line 30 of file object.hh.

Referenced by add().

Object* anoid::base::Object::parent [protected]
 

Definition at line 31 of file object.hh.

Referenced by add(), anoid::plugin::Sphere::init(), anoid::plugin::Box::init(), and anoid::plugin::AscShape::init().

AbstractWorld* anoid::base::Object::world [protected]
 

Definition at line 32 of file object.hh.

Referenced by add(), init(), and anoid::main::World::World().


The documentation for this class was generated from the following files:
Anoid NG © Michael Westergaard, Martin Stig Stissing, Ronni Michael Laursen, and Kristian Bisgaard Lassen