Class hierarchy   Compound list   File list   Compound Members  

Object Class Reference

Generic object class. More...

Inherited by World_Object.

List of all members.

Public Members

Static Public Members


Detailed Description

Generic object class.

Can represent any entity in the program, and is not tied to any environment. An Object is "tree-like" in that it may contain subobjects (children). All world objects should be subclasses of this one.


Member Function Documentation

Object::Object()

Construct an object.

virtual Object::~Object() [virtual]

Destroys an object.

virtual int Object::getID() [virtual]

Returns the object's ID.

virtual Object* Object::getParent() [virtual]

Get the object's parent.

virtual long Object::setParent(Object* newParent) [virtual]

Set a new parent.

If current parent is not NULL, the object is also removed from it.

virtual long Object::add(Object* O) [virtual]

Add a child object to this parent.

Object must be dynamically allocated method returns the object's ID.

Reimplemented in World_Object and World.

virtual long Object::remove(Object* O) [virtual]

Remove a child from this object.

2nd version removes the Nth child. Note that removal does NOT delete the child. Use scheduleDelete for this task. Returns 0 if successful (O is a a son of this, or index is valid).

virtual long Object::hasSons() [virtual]

Returns non zero if object has son objects.

virtual Object* Object::getSon(int index) [virtual]

return the Nth son of this object.

virtual Enumeration Object::objects() [virtual]

Returns a current enumeration of all son objects.

void Object::scheduleDelete(int doRemove=1)

Delete this object.

Deletions are postponed until doDeletions() is called. doDeletions does the actual work of deleting the Object. Note: that deletion is NOT recursive. Child Objects must be explicitly deleted if desired.

Object* Object::get(int ID) [static]

This method gets an object anywhere in the system by its ID number (Use O->getID() to retrieve number).

This is useful, instead of keeping pointers to objects, since objects may be deleted and then pointers are invalid. Return NULL if no Object with the given ID exists.

void Object::doDeletions() [static]

doDeletions() does the actual work of deleting objects.

It should be called once per frame at the end of the processiong for that frame to carry out any postponed deletions.


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