00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef _OSGACTORBASE_H_ 00040 #define _OSGACTORBASE_H_ 00041 #ifdef __sgi 00042 #pragma once 00043 #endif 00044 00045 #include <OSGConfig.h> 00046 #include <OSGSystemDef.h> 00047 00048 #include "OSGNewActionTypes.h" 00049 00050 OSG_BEGIN_NAMESPACE 00051 00052 class NewActionBase; 00053 00058 class OSG_SYSTEMLIB_DLLMAPPING ActorBase 00059 { 00060 /*==== PUBLIC ===========================================================*/ 00061 public: 00062 /*-----------------------------------------------------------------------*/ 00066 typedef NewActionTypes::ResultE ResultE; 00067 typedef NewActionTypes::PriorityType PriorityType; 00068 typedef NewActionTypes::PriorityTypeTraits PriorityTypeTraits; 00069 typedef NewActionTypes::Functor Functor; 00070 typedef NewActionTypes::FunctorArgumentType FunctorArgumentType; 00071 00072 class OSG_SYSTEMLIB_DLLMAPPING ActorBaseState 00073 { 00074 public: 00075 inline ActorBaseState(void ); 00076 inline ActorBaseState(const ActorBaseState &source); 00077 00078 virtual ~ActorBaseState(void) = 0; 00079 }; 00080 00082 /*-----------------------------------------------------------------------*/ 00086 virtual ~ActorBase(void) = 0; 00087 00089 /*-----------------------------------------------------------------------*/ 00093 virtual ResultE start(void) = 0; 00094 virtual ResultE stop (void) = 0; 00095 00097 /*-----------------------------------------------------------------------*/ 00101 virtual ResultE enterNode(FunctorArgumentType &funcArg) = 0; 00102 virtual ResultE leaveNode(FunctorArgumentType &funcArg) = 0; 00103 00105 /*-----------------------------------------------------------------------*/ 00109 inline bool getEnterNodeFlag(void) const; 00110 inline bool getLeaveNodeFlag(void) const; 00111 00112 inline void setEnterNodeFlag(bool enter); 00113 inline void setLeaveNodeFlag(bool leave); 00114 00116 /*-----------------------------------------------------------------------*/ 00120 inline const NewActionBase *getAction (void) const; 00121 inline NewActionBase *getAction (void); 00122 00123 inline UInt32 getActorId(void) const; 00124 00126 /*-----------------------------------------------------------------------*/ 00130 inline bool getChildrenListEnabled(void) const; 00131 inline void setChildrenListEnabled(bool enabled); 00132 00133 inline NodePtr getNode (void ) const; 00134 00135 inline UInt32 getNumChildren (void ) const; 00136 inline NodePtr getChild (UInt32 childIndex ) const; 00137 00138 inline bool getChildActive (UInt32 childIndex ) const; 00139 inline void setChildActive (UInt32 childIndex, 00140 bool active ); 00141 00142 inline PriorityType getChildPriority(UInt32 childIndex ) const; 00143 inline void setChildPriority(UInt32 childIndex, 00144 PriorityType prio ); 00145 00147 /*-----------------------------------------------------------------------*/ 00151 inline UInt32 getNumExtraChildren (void ) const; 00152 inline NodePtr getExtraChild (UInt32 childIndex ) const; 00153 00154 inline bool getExtraChildActive (UInt32 childIndex ) const; 00155 inline void setExtraChildActive (UInt32 childIndex, 00156 bool active ); 00157 00158 inline PriorityType getExtraChildPriority(UInt32 childIndex ) const; 00159 inline void setExtraChildPriority(UInt32 childIndex, 00160 PriorityType prio ); 00161 00163 /*-----------------------------------------------------------------------*/ 00167 inline UInt32 getNumPasses(void) const; 00168 00170 /*-----------------------------------------------------------------------*/ 00174 #ifdef OSG_NEWACTION_STATESLOTINTERFACE 00175 virtual UInt32 createStateClone (void ) = 0; 00176 virtual void destroyStateClone (UInt32 slotId ) = 0; 00177 #else 00178 virtual ActorBaseState *createStateClone (void ) = 0; 00179 virtual void destroyStateClone (ActorBaseState *pStateClone) = 0; 00180 #endif 00181 00182 virtual void createInitialState(void ) = 0; 00183 virtual void deleteInitialState(void ) = 0; 00184 00185 inline void beginEditState(void ); 00186 inline void endEditState (void ); 00187 00188 inline const ActorBaseState *getState (void ) const; 00189 inline ActorBaseState *getState (void ); 00190 00191 inline void setState (ActorBaseState *pState); 00192 00194 /*==== PROTECTED ========================================================*/ 00195 protected: 00196 /*-----------------------------------------------------------------------*/ 00200 typedef ActorBaseState StateType; 00201 00202 #ifdef OSG_NEWACTION_STATESLOTINTERFACE 00203 typedef std::vector<ActorBaseState *> StateSlotMap; 00204 00205 inline const StateSlotMap &getSlotMap(void) const; 00206 inline StateSlotMap &getSlotMap(void); 00207 #endif 00208 00210 /*-----------------------------------------------------------------------*/ 00214 friend class OSG::NewActionBase; 00215 00217 /*-----------------------------------------------------------------------*/ 00221 ActorBase(void); 00222 00224 /*-----------------------------------------------------------------------*/ 00228 virtual UInt32 addHelper ( NewActionBase *pAction) = 0; 00229 virtual void subHelper ( NewActionBase *pAction) = 0; 00230 virtual UInt32 findHelper(const NewActionBase *pAction) = 0; 00231 00233 /*-----------------------------------------------------------------------*/ 00237 virtual void addEvent(NewActionBase *pAction, UInt32 actorId); 00238 virtual void subEvent(NewActionBase *pAction, UInt32 actorId); 00239 00241 /*==== PRIVATE ==========================================================*/ 00242 private: 00243 NewActionBase *_pAction; 00244 UInt32 _actorId; 00245 00246 bool _enterNodeFlag; 00247 bool _leaveNodeFlag; 00248 00249 #ifdef OSG_NEWACTION_STATESLOTINTERFACE 00250 StateSlotMap _stateSlotMap; 00251 #endif 00252 00253 ActorBaseState *_pState; 00254 }; 00255 00256 OSG_END_NAMESPACE 00257 00258 #include "OSGActorBase.inl" 00259 00260 #define OSGACTORBASE_HEADER_CVSID "@(#)$Id: OSGActorBase.h,v 1.8 2005/03/31 19:50:56 dirk Exp $" 00261 00262 #endif /* _OSGACTORBASE_H_ */
1.6.1