Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::ActorBase Class Reference

Actor base class. See PageExperimentalNewActionActorBase for a description. More...

#include <OSGActorBase.h>

Inheritance diagram for osg::ActorBase:

osg::BasicActorBase osg::ExtendActorBase List of all members.

Types

typedef NewActionTypes::PriorityType PriorityType
typedef NewActionTypes::PriorityTypeTraits PriorityTypeTraits
typedef NewActionTypes::Functor Functor
typedef NewActionTypes::FunctorArgumentType FunctorArgumentType
*typedef NewActionTypes::ResultE ResultE

Public Member Functions

Destructor
*virtual ~ActorBase (void)=0
Start/Stop
*virtual ResultE start (void)=0
virtual ResultE stop (void)=0
Enter/Leave Callback
*virtual ResultE enterNode (FunctorArgumentType &funcArg)=0
virtual ResultE leaveNode (FunctorArgumentType &funcArg)=0
Config
*bool getEnterNodeFlag (void) const
bool getLeaveNodeFlag (void) const
void setEnterNodeFlag (bool enter)
void setLeaveNodeFlag (bool leave)
Action Access
*const NewActionBasegetAction (void) const
NewActionBasegetAction (void)
UInt32 getActorId (void) const
Children Management
*bool getChildrenListEnabled (void) const
void setChildrenListEnabled (bool enabled)
NodePtr getNode (void) const
UInt32 getNumChildren (void) const
NodePtr getChild (UInt32 childIndex) const
bool getChildActive (UInt32 childIndex) const
void setChildActive (UInt32 childIndex, bool active)
PriorityType getChildPriority (UInt32 childIndex) const
void setChildPriority (UInt32 childIndex, PriorityType prio)
Extra Children Management
*UInt32 getNumExtraChildren (void) const
NodePtr getExtraChild (UInt32 childIndex) const
bool getExtraChildActive (UInt32 childIndex) const
void setExtraChildActive (UInt32 childIndex, bool active)
PriorityType getExtraChildPriority (UInt32 childIndex) const
void setExtraChildPriority (UInt32 childIndex, PriorityType prio)
Multi Pass Management
*UInt32 getNumPasses (void) const
State Management
*virtual ActorBaseStatecreateStateClone (void)=0
virtual void destroyStateClone (ActorBaseState *pStateClone)=0
virtual void createInitialState (void)=0
virtual void deleteInitialState (void)=0
void beginEditState (void)
void endEditState (void)
const ActorBaseStategetState (void) const
ActorBaseStategetState (void)
void setState (ActorBaseState *pState)

Protected Member Functions

Constructor
ActorBase (void)
Add, Sub and Find Helper
*virtual UInt32 addHelper (NewActionBase *pAction)=0
virtual void subHelper (NewActionBase *pAction)=0
virtual UInt32 findHelper (const NewActionBase *pAction)=0
Event Notification
*virtual void addEvent (NewActionBase *pAction, UInt32 actorId)
virtual void subEvent (NewActionBase *pAction, UInt32 actorId)

Protected Attributes

Types
*typedef ActorBaseState StateType

Private Attributes

NewActionBase_pAction
UInt32 _actorId
bool _enterNodeFlag
bool _leaveNodeFlag
ActorBaseState_pState

Classes

class  ActorBaseState

Detailed Description

ActorBase is the base class for all Actors. See PageExperimentalNewActionActorBase for a description.

Ext:

To create a new actor you should use the actorEdit utility that can be found in /OpenSG/Tools/actorEdit. It will generate a base class for your own actor that takes care of the management of functors and state.

Definition at line 58 of file OSGActorBase.h.


Member Typedef Documentation

typedef NewActionTypes::PriorityType osg::ActorBase::PriorityType
 

Definition at line 67 of file OSGActorBase.h.

typedef NewActionTypes::PriorityTypeTraits osg::ActorBase::PriorityTypeTraits
 

Definition at line 68 of file OSGActorBase.h.

typedef NewActionTypes::Functor osg::ActorBase::Functor
 

Definition at line 69 of file OSGActorBase.h.

typedef NewActionTypes::FunctorArgumentType osg::ActorBase::FunctorArgumentType
 

Definition at line 70 of file OSGActorBase.h.


Constructor & Destructor Documentation

ActorBase::~ActorBase void   )  [pure virtual]
 

Destructor

Definition at line 95 of file OSGActorBase.cpp.

00096 {
00097 }

ActorBase::ActorBase void   )  [protected]
 

Constructor

Definition at line 139 of file OSGActorBase.cpp.

00140     : _pAction      (NULL                        ),
00141       _actorId      (TypeTraits<UInt32>::getMax()),
00142       _enterNodeFlag(false                       ),
00143       _leaveNodeFlag(false                       ),
00144 #ifdef OSG_NEWACTION_STATESLOTINTERFACE
00145       _stateSlotMap (                            ),
00146 #endif
00147       _pState       (NULL                        )
00148 {
00149 }


Member Function Documentation

ActorBase::ResultE ActorBase::start void   )  [pure virtual]
 

Called by an action before a traversal.

Warning:
When overriding this method, you must call the inherited version.

Implemented in osg::BasicActorBase, and osg::ExtendActorBase.

Definition at line 109 of file OSGActorBase.cpp.

References osg::NewActionTypes::Continue.

00110 {
00111 #ifdef OSG_NEWACTION_STATESLOTINTERFACE
00112     _stateSlotMap.clear();
00113 #endif
00114 
00115     return NewActionTypes::Continue;
00116 }

ActorBase::ResultE ActorBase::stop void   )  [pure virtual]
 

Called by an action after a traversal.

Warning:
When overriding this method, you must call the inherited version.

Implemented in osg::BasicActorBase, and osg::ExtendActorBase.

Definition at line 123 of file OSGActorBase.cpp.

References osg::NewActionTypes::Continue.

00124 {
00125 #ifdef OSG_NEWACTION_STATESLOTINTERFACE
00126     _stateSlotMap.clear();
00127 #endif
00128 
00129     return NewActionTypes::Continue;
00130 }

* virtual ResultE osg::ActorBase::enterNode FunctorArgumentType funcArg  )  [pure virtual]
 

virtual ResultE osg::ActorBase::leaveNode FunctorArgumentType funcArg  )  [pure virtual]
 

bool osg::ActorBase::getEnterNodeFlag void   )  const [inline]
 

Return if operations upon "entering" a node are enabled.

Definition at line 75 of file OSGActorBase.inl.

References _enterNodeFlag.

Referenced by osg::PriorityAction::addBasicEvent(), osg::DepthFirstStateAction::addBasicEvent(), osg::DepthFirstAction::addBasicEvent(), osg::PriorityAction::addExtendEvent(), osg::DepthFirstStateAction::addExtendEvent(), and osg::DepthFirstAction::addExtendEvent().

00076 {
00077     return _enterNodeFlag;
00078 }

bool osg::ActorBase::getLeaveNodeFlag void   )  const [inline]
 

Return if operations upon "leaving" a node are enabled.

Definition at line 84 of file OSGActorBase.inl.

References _leaveNodeFlag.

Referenced by osg::DepthFirstStateAction::addBasicEvent(), osg::DepthFirstAction::addBasicEvent(), osg::DepthFirstStateAction::addExtendEvent(), and osg::DepthFirstAction::addExtendEvent().

00085 {
00086     return _leaveNodeFlag;
00087 }

void osg::ActorBase::setEnterNodeFlag bool  enter  )  [inline]
 

Set if operations upon "entering a node are desired.

Warning:
You must not call this while the actor is attached to an action, it will cause possibly fatal inconsistency.

Definition at line 95 of file OSGActorBase.inl.

References _enterNodeFlag.

00096 {
00097     _enterNodeFlag = enter;
00098 }

void osg::ActorBase::setLeaveNodeFlag bool  leave  )  [inline]
 

Set if operations upon "leaving a node are desired.

Warning:
You must not call this while the actor is attached to an action, it will cause possibly fatal inconsistency.

Definition at line 106 of file OSGActorBase.inl.

References _leaveNodeFlag.

00107 {
00108     _leaveNodeFlag = leave;
00109 }

const NewActionBase * osg::ActorBase::getAction void   )  const [inline]
 

Definition at line 116 of file OSGActorBase.inl.

References _pAction.

Referenced by osg::ExtendActorBase::addExtraChild(), and osg::ExtendActorBase::setNumPasses().

00117 {
00118     return _pAction;
00119 }

NewActionBase * osg::ActorBase::getAction void   )  [inline]
 

Definition at line 122 of file OSGActorBase.inl.

References _pAction.

00123 {
00124     return _pAction;
00125 }

UInt32 osg::ActorBase::getActorId void   )  const [inline]
 

Definition at line 128 of file OSGActorBase.inl.

References _actorId.

Referenced by osg::NewActionBase::subBasicActor(), and osg::NewActionBase::subExtendActor().

00129 {
00130     return _actorId;
00131 }

bool osg::ActorBase::getChildrenListEnabled void   )  const [inline]
 

Return if the children list is enabled.

Definition at line 141 of file OSGActorBase.inl.

References _pAction, and osg::NewActionBase::getChildrenListEnabled().

00142 {
00143     return _pAction->getChildrenListEnabled();
00144 }

void osg::ActorBase::setChildrenListEnabled bool  enabled  )  [inline]
 

Enable or disable the children list.

Definition at line 150 of file OSGActorBase.inl.

References _pAction, and osg::NewActionBase::setChildrenListEnabled().

00151 {
00152     _pAction->setChildrenListEnabled(enabled);
00153 }

NodePtr osg::ActorBase::getNode void   )  const [inline]
 

Return the traversed node.

Definition at line 159 of file OSGActorBase.inl.

References _pAction, osg::NewActionBase::getChildrenList(), and osg::ChildrenList::getParentNode().

00160 {
00161     return _pAction->getChildrenList().getParentNode();
00162 }

UInt32 osg::ActorBase::getNumChildren void   )  const [inline]
 

Return the number of children of the traversed node.

Definition at line 168 of file OSGActorBase.inl.

References _pAction, osg::NewActionBase::getChildrenList(), and osg::ChildrenList::getSize().

00169 {
00170     return _pAction->getChildrenList().getSize();
00171 }

NodePtr osg::ActorBase::getChild UInt32  childIndex  )  const [inline]
 

Return the childIndex'th child of the traversed node.

Warning:
childIndex is not range checked.

Definition at line 178 of file OSGActorBase.inl.

References _pAction, osg::ChildrenList::getChild(), and osg::NewActionBase::getChildrenList().

00179 {
00180     return _pAction->getChildrenList().getChild(childIndex);
00181 }

bool osg::ActorBase::getChildActive UInt32  childIndex  )  const [inline]
 

Return if the childIndex'th child is active, i.e. whether it will be traversed.

Warning:
childIndex is not range checked.

The children list must have been enabled with setChildrenListEnabled(true);

Definition at line 191 of file OSGActorBase.inl.

References _pAction, osg::ChildrenList::getActive(), and osg::NewActionBase::getChildrenList().

00192 {
00193     return _pAction->getChildrenList().getActive(childIndex);
00194 }

void osg::ActorBase::setChildActive UInt32  childIndex,
bool  active
[inline]
 

Set if the childIndex'th child will be included in the traversal.

Warning:
childIndex is not range checked.

The children list must have been enabled with setChildrenListEnabled(true);

Definition at line 203 of file OSGActorBase.inl.

References _pAction, osg::NewActionBase::getChildrenList(), and osg::ChildrenList::setActive().

00204 {
00205     _pAction->getChildrenList().setActive(childIndex, active);
00206 }

ActorBase::PriorityType osg::ActorBase::getChildPriority UInt32  childIndex  )  const [inline]
 

Return the priority assigned to the childIndex'th child.

Warning:
childIndex is not range checked.

The children list must have been enabled with setChildrenListEnabled(true);

Definition at line 215 of file OSGActorBase.inl.

References _pAction, osg::NewActionBase::getChildrenList(), and osg::ChildrenList::getPriority().

00216 {
00217     return _pAction->getChildrenList().getPriority(childIndex);
00218 }

void osg::ActorBase::setChildPriority UInt32  childIndex,
PriorityType  prio
[inline]
 

Set the priority of the childIndex'th child.

Warning:
childIndex is not range checked.

The children list must have been enabled with setChildrenListEnabled(true);

Definition at line 227 of file OSGActorBase.inl.

References _pAction, osg::NewActionBase::getChildrenList(), and osg::ChildrenList::setPriority().

00228 {
00229     _pAction->getChildrenList().setPriority(childIndex, prio);
00230 }

UInt32 osg::ActorBase::getNumExtraChildren void   )  const [inline]
 

Return the number of extra children already added.

Definition at line 240 of file OSGActorBase.inl.

References _pAction, osg::NewActionBase::getExtraChildrenList(), and osg::ExtraChildrenList::getSize().

00241 {
00242     return _pAction->getExtraChildrenList().getSize();
00243 }

NodePtr osg::ActorBase::getExtraChild UInt32  childIndex  )  const [inline]
 

Return the childIndex'th extra child.

Warning:
childIndex is not range checked.

Definition at line 250 of file OSGActorBase.inl.

References _pAction, osg::ExtraChildrenList::getChild(), and osg::NewActionBase::getExtraChildrenList().

00251 {
00252     return _pAction->getExtraChildrenList().getChild(childIndex);
00253 }

bool osg::ActorBase::getExtraChildActive UInt32  childIndex  )  const [inline]
 

Return if the childIndex'th extra child is active, i.e. whether it will be traversed.

Warning:
childIndex is not range checked.

Definition at line 261 of file OSGActorBase.inl.

References _pAction, osg::ExtraChildrenList::getActive(), and osg::NewActionBase::getExtraChildrenList().

00262 {
00263     return _pAction->getExtraChildrenList().getActive(childIndex);
00264 }

void osg::ActorBase::setExtraChildActive UInt32  childIndex,
bool  active
[inline]
 

Set if the childIndex'th extra child will be included in the traversal.

Warning:
childIndex is not range checked.

Definition at line 271 of file OSGActorBase.inl.

References _pAction, osg::NewActionBase::getExtraChildrenList(), and osg::ExtraChildrenList::setActive().

00272 {
00273     _pAction->getExtraChildrenList().setActive(childIndex, active);
00274 }

ActorBase::PriorityType osg::ActorBase::getExtraChildPriority UInt32  childIndex  )  const [inline]
 

Return the priority assigned to the childIndex'th extra child.

Warning:
childIndex is not range checked.

Definition at line 281 of file OSGActorBase.inl.

References _pAction, osg::NewActionBase::getExtraChildrenList(), and osg::ExtraChildrenList::getPriority().

00282 {
00283     return _pAction->getExtraChildrenList().getPriority(childIndex);
00284 }

void osg::ActorBase::setExtraChildPriority UInt32  childIndex,
PriorityType  prio
[inline]
 

Set the priority of the childIndex'th extra child.

Warning:
childIndex is not range checked.

Definition at line 291 of file OSGActorBase.inl.

References _pAction, osg::NewActionBase::getExtraChildrenList(), and osg::ExtraChildrenList::setPriority().

00292 {
00293     _pAction->getExtraChildrenList().setPriority(childIndex, prio);
00294 }

UInt32 osg::ActorBase::getNumPasses void   )  const [inline]
 

Return the number of passes requested for the current node. The default number of passes is 1.

Definition at line 305 of file OSGActorBase.inl.

References _pAction, and osg::NewActionBase::getNumPasses().

00306 {
00307     return _pAction->getNumPasses();
00308 }

* virtual ActorBaseState* osg::ActorBase::createStateClone void   )  [pure virtual]
 

virtual void osg::ActorBase::destroyStateClone ActorBaseState pStateClone  )  [pure virtual]
 

virtual void osg::ActorBase::createInitialState void   )  [pure virtual]
 

Referenced by addEvent().

virtual void osg::ActorBase::deleteInitialState void   )  [pure virtual]
 

Referenced by subEvent().

void osg::ActorBase::beginEditState void   )  [inline]
 

Notify the action, that state is about to be edited.

Ext: Call this method inside a functor or the enterNode method of an actor before accessing any state variables. If you are worried about top performance you may omit the call as long as you only read state values, but as this is error prone it is not recommended.

Definition at line 326 of file OSGActorBase.inl.

References _actorId, _pAction, and osg::NewActionBase::beginEditStateEvent().

00327 {
00328     _pAction->beginEditStateEvent(this, _actorId);
00329 }

void osg::ActorBase::endEditState void   )  [inline]
 

Notify the action, that state access is complete.

Ext: Call this method after you are done with modifying state. None of the implemented actions perform anything upon this call, hence it is not as critical as the beginEditState call.

Definition at line 341 of file OSGActorBase.inl.

References _actorId, _pAction, and osg::NewActionBase::endEditStateEvent().

00342 {
00343     _pAction->endEditStateEvent(this, _actorId);
00344 }

const ActorBase::ActorBaseState * osg::ActorBase::getState void   )  const [inline]
 

Get a const pointer to the currently used state.

Definition at line 350 of file OSGActorBase.inl.

References _pState.

00351 {
00352     return _pState;
00353 }

ActorBase::ActorBaseState * osg::ActorBase::getState void   )  [inline]
 

Get a pointer to the currently used state.

Definition at line 359 of file OSGActorBase.inl.

References _pState.

00360 {
00361     return _pState;
00362 }

void osg::ActorBase::setState ActorBaseState pState  )  [inline]
 

Set the currently used state.

Definition at line 368 of file OSGActorBase.inl.

References _pState.

00369 {
00370     _pState = pState;
00371 }

* virtual UInt32 osg::ActorBase::addHelper NewActionBase pAction  )  [protected, pure virtual]
 

Implemented in osg::BasicActorBase, and osg::ExtendActorBase.

Referenced by osg::NewActionBase::addActor().

virtual void osg::ActorBase::subHelper NewActionBase pAction  )  [protected, pure virtual]
 

Implemented in osg::BasicActorBase, and osg::ExtendActorBase.

Referenced by osg::NewActionBase::subActor().

virtual UInt32 osg::ActorBase::findHelper const NewActionBase pAction  )  [protected, pure virtual]
 

Implemented in osg::BasicActorBase, and osg::ExtendActorBase.

Referenced by osg::NewActionBase::findActor().

void ActorBase::addEvent NewActionBase pAction,
UInt32  actorId
[protected, virtual]
 

Notifies the actor, that it was added to an action.

Warning:
When overriding this method, you must call the inherited version.

Definition at line 160 of file OSGActorBase.cpp.

References _actorId, _pAction, createInitialState(), osg::endLog(), and SWARNING.

Referenced by osg::NewActionBase::addBasicActor(), and osg::NewActionBase::addExtendActor().

00161 {
00162     if((_pAction != NULL) || (_actorId != TypeTraits<UInt32>::getMax()))
00163     {
00164         SWARNING << "ActorBase::attachEvent: Actor already attached."
00165                  << endLog;
00166     }
00167 
00168     createInitialState();
00169 
00170     _pAction = pAction;
00171     _actorId = actorId;
00172 }

void ActorBase::subEvent NewActionBase pAction,
UInt32  actorId
[protected, virtual]
 

Notifies the actor, that it was removed from an action.

Warning:
When overriding this method, you must call the inherited version.

Definition at line 179 of file OSGActorBase.cpp.

References _actorId, _pAction, deleteInitialState(), osg::endLog(), and SWARNING.

Referenced by osg::NewActionBase::subBasicActor(), and osg::NewActionBase::subExtendActor().

00180 {
00181     if((_pAction != pAction) || (_actorId != actorId))
00182     {
00183         SWARNING << "ActorBase::detachEvent: Inconsistency detected."
00184                  << endLog;
00185     }
00186 
00187     deleteInitialState();
00188 
00189     _pAction = NULL;
00190     _actorId = TypeTraits<UInt32>::getMax();
00191 }


Member Data Documentation

* typedef NewActionTypes::ResultE osg::ActorBase::ResultE
 

Definition at line 66 of file OSGActorBase.h.

* typedef ActorBaseState osg::ActorBase::StateType [protected]
 

Reimplemented in osg::BasicActorBase, and osg::ExtendActorBase.

Definition at line 200 of file OSGActorBase.h.

NewActionBase* osg::ActorBase::_pAction [private]
 

Definition at line 243 of file OSGActorBase.h.

Referenced by addEvent(), beginEditState(), endEditState(), getAction(), getChild(), getChildActive(), getChildPriority(), getChildrenListEnabled(), getExtraChild(), getExtraChildActive(), getExtraChildPriority(), getNode(), getNumChildren(), getNumExtraChildren(), getNumPasses(), setChildActive(), setChildPriority(), setChildrenListEnabled(), setExtraChildActive(), setExtraChildPriority(), and subEvent().

UInt32 osg::ActorBase::_actorId [private]
 

Definition at line 244 of file OSGActorBase.h.

Referenced by addEvent(), beginEditState(), endEditState(), getActorId(), and subEvent().

bool osg::ActorBase::_enterNodeFlag [private]
 

Definition at line 246 of file OSGActorBase.h.

Referenced by getEnterNodeFlag(), and setEnterNodeFlag().

bool osg::ActorBase::_leaveNodeFlag [private]
 

Definition at line 247 of file OSGActorBase.h.

Referenced by getLeaveNodeFlag(), and setLeaveNodeFlag().

ActorBaseState* osg::ActorBase::_pState [private]
 

Definition at line 253 of file OSGActorBase.h.

Referenced by getState(), and setState().


The documentation for this class was generated from the following files:
Generated on Thu Aug 25 04:28:00 2005 for OpenSG by  doxygen 1.4.3