# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::IObs Class Reference

A base observer. More...

#include <mot.h>

Inheritance diagram for NL3D::IObs:

NLMISC::CRefCount NL3D::IBaseAnimDetailObs NL3D::IBaseClipObs NL3D::IBaseHrcObs NL3D::IBaseLightObs NL3D::IBaseLoadBalancingObs NL3D::IBaseRenderObs NL3D::CDefaultAnimDetailObs NL3D::CRootModelAnimDetailObs NL3D::CSkipModelAnimDetailObs NL3D::CTransformAnimDetailObs NL3D::CClusterClipObs NL3D::CDefaultClipObs NL3D::CQuadGridClipClusterClipObs NL3D::CRootModelClipObs NL3D::CSkipModelClipObs NL3D::CTransformClipObs NL3D::CDefaultHrcObs NL3D::CRootModelHrcObs NL3D::CSkipModelHrcObs NL3D::CTransformHrcObs NL3D::CDefaultLightObs NL3D::CRootModelLightObs NL3D::CSkipModelLightObs NL3D::CTransformLightObs NL3D::CDefaultLoadBalancingObs NL3D::CRootModelLoadBalancingObs NL3D::CSkipModelLoadBalancingObs NL3D::CTransformShapeLoadBalancingObs NL3D::CDefaultRenderObs NL3D::CRootModelRenderObs NL3D::CSkipModelRenderObs NL3D::CTransformRenderObs List of all members.

Public Methods

 IObs ()
virtual ~IObs ()
 ~IObs() must destroy correclty the father/son links (with call to virtual delChild() delParent()). More...

virtual void init ()
 This is called at the end of createModel(). More...

Graph methods. USED ONLY BY ITrav*.
BASIC EXTENSION: Although All those methods may be extended, it may be a hard work.

So if an observer just want to choose beetween being a tree Node (which has only one parent) or being a Graph node, it may just implement the isTreeNode() method which return true by default.

ADVANCED EXTENSION: the deriver may implement the way this observer is linked to the traversal graph.
The deriver must use list<> IObs::SonList and IObs::FatherList and set<> IObs::SonMap and IObs::FatherMap in the same way the default implementation use them.
We cut the behavior into two ways: addParent and addChild() (and their respective del*() function). We must do this since some observers may link to sons in a particualr way (Z-list ...), and some others may link to parents in a particular way (such as tree node which want to delete their old parent).

ITrav::link() and ITrav::unlink() will call the correct functions:
o1->addChild(o2); o2->addParent(o1);

If the deriver store the links to sons / fathers in a particular way, it must destroy them in his destructor. NB: in all case, get*() are NOT virtual because of speed consideration.

virtual bool isTreeNode ()
 For standard behavior, just modify this method, to have a TreeNode behavior or a graphNode behavior. Default: true. More...

virtual void addChild (IObs *son)
 This function SHOULD JUST add son to the son list. If son was already a son, no-op. More...

virtual void delChild (IObs *son)
 This function SHOULD JUST delete son from the son list. If son is not a son, no-op. More...

virtual void addParent (IObs *father)
 This function SHOULD JUST add father to the parent list. More...

virtual void delParent (IObs *father)
 This function SHOULD JUST delete father from the parent list. If father is not a parent, no-op. More...

sint getNumChildren () const
 Get the number of children. More...

IObs * getFirstChild () const
 Return the first child of the observer. NULL returned if not found. More...

IObs * getNextChild () const
 Return the next child of the observer. NULL returned if not found. Unpredictible results if insertions/deletions are made between a getFirstChild() / getNextChild(). More...

sint getNumParents () const
 Get the number of parent. More...

IObs * getFirstParent () const
 Return the first parent of the observer. NULL returned if not found. More...

IObs * getNextParent () const
 Return the next parent of the observer. NULL returned if not found. Unpredictible results if insertions/deletions are made between a getFirstParent() / getNextParent(). More...

DoIt method. USED ONLY BY ITrav*.
virtual void traverse (IObs *caller)=0
 Traverse this observer. More...

Notification system.
virtual void update ()
 This function must update the observer, according to his model's Touch information and the Model data. More...

Utility methods.
void traverseSons ()
 Do traverse() for all sons of this observer. More...

IObs * getObs (const NLMISC::CClassId &idTrav) const
 Get the observer for an other view, via IModel. More...


Public Attributes

IModelModel
ITravTrav

Protected Types

typedef std::list< IObs * > TObsList
typedef TObsList::iterator ItObsList
typedef TObsList::const_iterator ConstItObsList
typedef std::map< IObs *,
ItObsList
TObsMap
typedef TObsMap::iterator ItObsMap

Protected Attributes

TObsList SonList
TObsList FatherList
TObsMap SonMap
TObsMap FatherMap
sint NumFathers
sint NumSons
ConstItObsList CurSonIt
ConstItObsList CurFatherIt

Detailed Description

A base observer.

An observer is a link beetween a Model and a Traversal. It may implement the behavior of the model for this particular traversal. Only deriver have access to /implement observers. Users don't manipulate observers.

IObs define:

  • graph methods to link/unlink to observers. Read carefully this section.
  • a notification system (see IModel for an explanation)
  • an interface for traversal to traverse() this observer.
DERIVERS RULES:
  • Implement the notification system: Just extend update().
  • Implement the traverse() method
  • Possibly Extend/Modify the graph methods (see isTreeNode(), addParent() ...).
  • Possibly Extend/Modify the init() method.
Since Models are created with CMOT::createModel(), an observer is never alone, he always has a Model and a ITrav.
See also:
CMOT IModel ITrav
Author:
Lionel Berenguier , Nevrax France
Date:
2000

Definition at line 411 of file mot.h.


Member Typedef Documentation

typedef TObsList::const_iterator NL3D::IObs::ConstItObsList [protected]
 

Definition at line 555 of file mot.h.

typedef TObsList::iterator NL3D::IObs::ItObsList [protected]
 

Definition at line 554 of file mot.h.

Referenced by addParent, and ~IObs.

typedef TObsMap::iterator NL3D::IObs::ItObsMap [protected]
 

Definition at line 557 of file mot.h.

Referenced by addChild, addParent, delChild, and delParent.

typedef std::list<IObs*> NL3D::IObs::TObsList [protected]
 

Definition at line 553 of file mot.h.

typedef std::map<IObs *, ItObsList> NL3D::IObs::TObsMap [protected]
 

Definition at line 556 of file mot.h.


Constructor & Destructor Documentation

NL3D::IObs::IObs  
 

Definition at line 584 of file mot.cpp.

References CurFatherIt, CurSonIt, FatherList, Model, NumFathers, NumSons, SonList, and Trav.

Referenced by NL3D::IBaseHrcObs::addParent, NL3D::CWaveMakerDetailObs::creator, NL3D::CWaterRenderObs::creator, NL3D::CVegetableBlendLayerRenderObs::creator, NL3D::CVegetableBlendLayerClipObs::creator, NL3D::CTransformShapeLoadBalancingObs::creator, NL3D::CTransformShapeRenderObs::creator, NL3D::CTransformShapeClipObs::creator, NL3D::CTransformLightObs::creator, NL3D::CTransformRenderObs::creator, NL3D::CTransformAnimDetailObs::creator, NL3D::CTransformClipObs::creator, NL3D::CTransformHrcObs::creator, NL3D::CSkipModelRenderObs::creator, NL3D::CSkipModelLightObs::creator, NL3D::CSkipModelLoadBalancingObs::creator, NL3D::CSkipModelAnimDetailObs::creator, NL3D::CSkipModelClipObs::creator, NL3D::CSkipModelHrcObs::creator, NL3D::CSkeletonModelRenderObs::creator, NL3D::CSkeletonModelAnimDetailObs::creator, NL3D::CSegRemanenceAnimDetailObs::creator, NL3D::CRootModelRenderObs::creator, NL3D::CRootModelLightObs::creator, NL3D::CRootModelLoadBalancingObs::creator, NL3D::CRootModelAnimDetailObs::creator, NL3D::CRootModelClipObs::creator, NL3D::CRootModelHrcObs::creator, NL3D::CQuadGridClipClusterClipObs::creator, NL3D::CPointLightModelLightObs::creator, NL3D::CParticleSystemRenderObs::creator, NL3D::CParticleSystemClipObs::creator, NL3D::CParticleSystemDetailObs::creator, NL3D::CMeshMultiLodBalancingObs::creator, NL3D::CMeshMultiLodClipObs::creator, NL3D::CMeshBaseInstanceAnimDetailObs::creator, NL3D::CFlareRenderObs::creator, NL3D::CCoarseMeshClipObs::creator, NL3D::CClusterClipObs::creator, NL3D::CClusterHrcObs::creator, NL3D::IBaseClipObs::forceClip, getFirstChild, getFirstParent, getNextChild, getNextParent, NL3D::CTransformRenderObs::traverse, NL3D::CDefaultLoadBalancingObs::traverse, NL3D::CDefaultHrcObs::traverse, NL3D::CDefaultRenderObs::traverse, NL3D::CDefaultLightObs::traverse, NL3D::CDefaultClipObs::traverse, NL3D::CDefaultAnimDetailObs::traverse, traverseSons, and ~IObs.

NL3D::IObs::~IObs   [virtual]
 

~IObs() must destroy correclty the father/son links (with call to virtual delChild() delParent()).

Definition at line 595 of file mot.cpp.

References FatherList, FatherMap, IObs, ItObsList, NumFathers, NumSons, SonList, and SonMap.


Member Function Documentation

void NL3D::IObs::addChild IObs *    son [virtual]
 

This function SHOULD JUST add son to the son list. If son was already a son, no-op.

Definition at line 633 of file mot.cpp.

References ItObsMap, nlassert, NumSons, SonList, and SonMap.

void NL3D::IObs::addParent IObs *    father [virtual]
 

This function SHOULD JUST add father to the parent list.

If father was already a parent, no-op. The default behavior is to call isTreeNode(). If true, unlink from his current father, and call precFather->delChild(this). Hence this observer has a behavior of a Tree node (can have only one parent).

Reimplemented in NL3D::IBaseHrcObs.

Definition at line 662 of file mot.cpp.

References FatherList, FatherMap, isTreeNode, ItObsList, ItObsMap, nlassert, and NumFathers.

void NL3D::IObs::delChild IObs *    son [virtual]
 

This function SHOULD JUST delete son from the son list. If son is not a son, no-op.

Definition at line 647 of file mot.cpp.

References ItObsMap, nlassert, NumSons, SonList, and SonMap.

void NL3D::IObs::delParent IObs *    father [virtual]
 

This function SHOULD JUST delete father from the parent list. If father is not a parent, no-op.

Definition at line 694 of file mot.cpp.

References FatherList, FatherMap, ItObsMap, nlassert, and NumFathers.

IObs* NL3D::IObs::getFirstChild   const [inline]
 

Return the first child of the observer. NULL returned if not found.

Definition at line 465 of file mot.h.

References CurSonIt, IObs, nlassert, NumSons, and SonList.

Referenced by NL3D::IBaseClipObs::forceClip, and traverseSons.

IObs* NL3D::IObs::getFirstParent   const [inline]
 

Return the first parent of the observer. NULL returned if not found.

Definition at line 487 of file mot.h.

References CurFatherIt, FatherList, IObs, nlassert, and NumFathers.

Referenced by NL3D::IBaseHrcObs::addParent.

IObs* NL3D::IObs::getNextChild   const [inline]
 

Return the next child of the observer. NULL returned if not found. Unpredictible results if insertions/deletions are made between a getFirstChild() / getNextChild().

Definition at line 474 of file mot.h.

References CurSonIt, IObs, nlassert, and SonList.

Referenced by NL3D::IBaseClipObs::forceClip, and traverseSons.

IObs* NL3D::IObs::getNextParent   const [inline]
 

Return the next parent of the observer. NULL returned if not found. Unpredictible results if insertions/deletions are made between a getFirstParent() / getNextParent().

Definition at line 496 of file mot.h.

References CurFatherIt, FatherList, IObs, and nlassert.

sint NL3D::IObs::getNumChildren   const [inline]
 

Get the number of children.

Definition at line 463 of file mot.h.

References NumSons.

sint NL3D::IObs::getNumParents   const [inline]
 

Get the number of parent.

Definition at line 485 of file mot.h.

References NumFathers.

IObs * NL3D::IObs::getObs const NLMISC::CClassId   idTrav const
 

Get the observer for an other view, via IModel.

Definition at line 626 of file mot.cpp.

References Model.

Referenced by NL3D::IBaseLoadBalancingObs::init, NL3D::IBaseHrcObs::init, NL3D::IBaseRenderObs::init, NL3D::IBaseLightObs::init, NL3D::IBaseClipObs::init, and NL3D::IBaseAnimDetailObs::init.

virtual void NL3D::IObs::init void    [inline, virtual]
 

This is called at the end of createModel().

So the model is correctly constructed and linked to his observers. The default behavior is to do nothing. Warning! all IObs::init() are called BEFORE IModel::initModel().

Reimplemented in NL3D::IBaseAnimDetailObs.

Definition at line 424 of file mot.h.

virtual bool NL3D::IObs::isTreeNode   [inline, virtual]
 

For standard behavior, just modify this method, to have a TreeNode behavior or a graphNode behavior. Default: true.

Reimplemented in NL3D::IBaseClipObs.

Definition at line 449 of file mot.h.

Referenced by addParent.

virtual void NL3D::IObs::traverse IObs *    caller [pure virtual]
 

Traverse this observer.

This function "justdoit" must do all the traversal thing:

  • Get info from caller, and DoIt the observer (completly observer depedent).
  • should traverse() his sons (or simply call traverseSons()).
Parameters:
caller  the father of the observer which have called traverse(). WARNING: this is NULL, for the ROOT.

Implemented in NL3D::IBaseAnimDetailObs.

void NL3D::IObs::traverseSons   [inline]
 

Do traverse() for all sons of this observer.

Definition at line 540 of file mot.h.

References getFirstChild, getNextChild, and IObs.

Referenced by NL3D::CWaveMakerDetailObs::traverse, NL3D::CWaterRenderObs::traverse, NL3D::CTransformClipObs::traverse, NL3D::CTransformHrcObs::traverse, NL3D::CRootModelRenderObs::traverse, NL3D::CRootModelLightObs::traverse, NL3D::CRootModelLoadBalancingObs::traverse, NL3D::CRootModelAnimDetailObs::traverse, NL3D::CRootModelClipObs::traverse, NL3D::CRootModelHrcObs::traverse, NL3D::CQuadGridClipClusterClipObs::traverse, NL3D::CParticleSystemClipObs::traverse, NL3D::CDefaultHrcObs::traverse, NL3D::CFlareRenderObs::traverse, NL3D::CClusterClipObs::traverse, NL3D::CDefaultLightObs::traverse, and NL3D::CDefaultClipObs::traverse.

virtual void NL3D::IObs::update   [inline, virtual]
 

This function must update the observer, according to his model's Touch information and the Model data.

NB: do not modify here Touch information of the model (because they may be used by other Observers).

The default behavior is to do nothing.

Reimplemented in NL3D::CTransformHrcObs.

Definition at line 531 of file mot.h.


Member Data Documentation

ConstItObsList NL3D::IObs::CurFatherIt [protected]
 

Definition at line 568 of file mot.h.

Referenced by getFirstParent, getNextParent, and IObs.

ConstItObsList NL3D::IObs::CurSonIt [protected]
 

Definition at line 567 of file mot.h.

Referenced by getFirstChild, getNextChild, and IObs.

TObsList NL3D::IObs::FatherList [protected]
 

Definition at line 561 of file mot.h.

Referenced by addParent, delParent, getFirstParent, getNextParent, IObs, and ~IObs.

TObsMap NL3D::IObs::FatherMap [protected]
 

Definition at line 563 of file mot.h.

Referenced by addParent, delParent, and ~IObs.

IModel* NL3D::IObs::Model
 

Definition at line 414 of file mot.h.

Referenced by NL3D::CTransformShapeClipObs::clip, NL3D::CMeshMultiLodClipObs::clip, NL3D::CLandscapeClipObs::clip, NL3D::CMeshMultiLodClipObs::forceClip, getObs, NL3D::CLandscapeClipObs::init, NL3D::CParticleSystemClipObs::insertInVisibleList, IObs, NL3D::CSkeletonModelRenderObs::renderCLod, NL3D::CSkeletonModelRenderObs::renderSkins, NL3D::CTransformShapeRenderObs::traverse, NL3D::CTransformLightObs::traverse, NL3D::CTransformClipObs::traverse, NL3D::CSkeletonModelRenderObs::traverse, NL3D::CSkeletonModelAnimDetailObs::traverse, NL3D::CQuadGridClipClusterClipObs::traverse, NL3D::CPointLightModelLightObs::traverse, NL3D::CParticleSystemClipObs::traverse, NL3D::CMeshBaseInstanceAnimDetailObs::traverse, NL3D::CLandscapeRenderObs::traverse, NL3D::CClusterClipObs::traverse, NL3D::CClusterHrcObs::traverse, NL3D::CTransformHrcObs::update, NL3D::CTransformHrcObs::updateClipTravForAncestorSkeleton, and NL3D::CTransformHrcObs::updateWorld.

sint NL3D::IObs::NumFathers [protected]
 

Definition at line 564 of file mot.h.

Referenced by addParent, delParent, getFirstParent, getNumParents, IObs, and ~IObs.

sint NL3D::IObs::NumSons [protected]
 

Definition at line 565 of file mot.h.

Referenced by addChild, delChild, getFirstChild, getNumChildren, IObs, and ~IObs.

TObsList NL3D::IObs::SonList [protected]
 

Definition at line 560 of file mot.h.

Referenced by addChild, delChild, getFirstChild, getNextChild, IObs, and ~IObs.

TObsMap NL3D::IObs::SonMap [protected]
 

Definition at line 562 of file mot.h.

Referenced by addChild, delChild, and ~IObs.

ITrav* NL3D::IObs::Trav
 

Definition at line 415 of file mot.h.

Referenced by NL3D::CTransformShapeClipObs::clip, NL3D::CLandscapeClipObs::clip, NL3D::IBaseLoadBalancingObs::init, NL3D::CLandscapeClipObs::init, NL3D::CParticleSystemClipObs::insertInVisibleList, IObs, NL3D::CSkeletonModelRenderObs::renderCLod, NL3D::CSkeletonModelRenderObs::renderSkinList, NL3D::CSkeletonModelRenderObs::renderSkins, NL3D::CTransformShapeLoadBalancingObs::traverse, NL3D::CTransformShapeRenderObs::traverse, NL3D::CTransformLightObs::traverse, NL3D::CQuadGridClipClusterClipObs::traverse, NL3D::CPointLightModelLightObs::traverse, NL3D::CParticleSystemClipObs::traverse, NL3D::CMeshMultiLodBalancingObs::traverse, NL3D::CLandscapeRenderObs::traverse, NL3D::CClusterClipObs::traverse, NL3D::CTransformShapeLoadBalancingObs::traversePass0, and NL3D::IBaseClipObs::~IBaseClipObs.


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