OpenGLPrakt --> cObject

class cObject

This object provides any means neccessary to build a scene graph.

It is intended to derive from it, overloading the DrawTheObject() and probably Init() methods.

Source:
../src/cObject.hh:42

Constructors Index

cObject
[public] constructor with initialization for name (default constructor)
cObject
[public] copy constructor
~cObject
[public] destructor


Typedefs Index

childs_t
[public] a type for the list of childs an object has


Variables Index

mChilds
[protected] singly linked list of all childs (uses STLs slist template)
mName
[protected] name of this object (defaults to class name)


Methods Index

Activate
[protected] actions to perform before drawing the object and it's siblings (might be overloaded)
AddChild
[public] add new child object (copy it!)
Deactivate
[protected] actions to perform after drawing the object and it's siblings (might be overloaded)
GetChildsBeginIterator
[public] provide access to childs
GetChildsEndIterator
[public] determine iterator for end of child list
GetDefaultName
[protected] return default name of object (the poor man's RTTI)
GetName
[public] query name of object
HasChilds
[public] determine whether the object has got any siblings
Init
[public] initialization function (candidate for overloading!) note: You *have to* call this function, even if overloaded! (best way is to call cObject::Init after having done your specific work) You may not display anything during Init().
SetName
[public] set name of object


Constructors

cObject

public cObject ( const char * name = NULL ) ;

constructor with initialization for name (default constructor)

Parameters:
name name to identify the object (optional)

cObject

public cObject ( const cObject & ) ;

copy constructor

cObject

public virtual ~ cObject ( ) ;

destructor


Typedefs

childs_t

public typedef slist < class cObject * > childs_t ;

a type for the list of childs an object has

The scene graph is an n-ary tree, cObjects are the nodes. We cannot store plain cObjects here since vector<> might invalidate iterators during realloc()'ing (thatswhy, we use slist<>)

We make it public to provide limited access to child tree.

See Also:
GetChildsBeginIterator, GetChildsEndIterator

Variables

mChilds

protected childs_t mChilds

singly linked list of all childs (uses STLs slist template)

mName

protected string * mName

name of this object (defaults to class name)

See Also:
GetDefaultName

Methods

Init

public virtual int Init ( ) ;

initialization function (candidate for overloading!) note: You *have to* call this function, even if overloaded! (best way is to call cObject::Init after having done your specific work) You may not display anything during Init().

Return:
-1 on error, 0 on success

AddChild

public cObject * AddChild ( cObject * child ) ;

add new child object (copy it!)

Parameters:
child reference to cObject object

Return:
pointer to copied cObject object, NULL on error

HasChilds

public bool HasChilds ( ) ;

determine whether the object has got any siblings

GetChildsBeginIterator

public childs_t :: const_iterator GetChildsBeginIterator ( ) ;

provide access to childs

Return:
const_iterator for childs

GetChildsEndIterator

public childs_t :: const_iterator GetChildsEndIterator ( ) ;

determine iterator for end of child list

Return:
const_iterator

GetName

public const char * GetName ( ) const ;

query name of object

Return:
name of object

SetName

public void SetName ( const char * n ) ;

set name of object

Parameters:
name name of object

Activate

protected virtual void Activate ( ) ;

actions to perform before drawing the object and it's siblings (might be overloaded)

Activate() works as follows: (see implementation for details) 1. call Activate() of all siblings 2. Deactivate () (may be overloaded)

Deactivate

protected virtual void Deactivate ( ) ;

actions to perform after drawing the object and it's siblings (might be overloaded)

GetDefaultName

protected virtual const char * GetDefaultName ( ) const ;

return default name of object (the poor man's RTTI)

Every object within the scene graph can be associated a name. By default, the class of the object is used.

See Also:
GetName

This documentation was generated automatically by the ccdoc tool (version 0.7a).
Click here to submit a bug report or feature request.

Click here to return to the top of the page.