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 _OSGNEWACTIONBASE_H_ 00040 #define _OSGNEWACTIONBASE_H_ 00041 #ifdef __sgi 00042 #pragma once 00043 #endif 00044 00045 //---------------------------------------------------------------------------- 00046 // Includes 00047 //---------------------------------------------------------------------------- 00048 00049 #include <OSGConfig.h> 00050 #include <OSGSystemDef.h> 00051 #include <OSGStatCollector.h> 00052 #include <OSGStatElemTypes.h> 00053 00054 #include "OSGChildrenList.h" 00055 #include "OSGExtraChildrenList.h" 00056 00057 OSG_BEGIN_NAMESPACE 00058 00059 class ActorBase; 00060 class ExtendActorBase; 00061 class BasicActorBase; 00062 00063 class OSG_SYSTEMLIB_DLLMAPPING NewActionBase 00064 { 00065 /*==== PUBLIC ===========================================================*/ 00066 public: 00067 /*-----------------------------------------------------------------------*/ 00071 typedef NewActionTypes::ResultE ResultE; 00072 typedef NewActionTypes::PriorityType PriorityType; 00073 typedef NewActionTypes::PriorityTypeTraits PriorityTypeTraits; 00074 typedef NewActionTypes::Functor Functor; 00075 typedef NewActionTypes::FunctorArgumentType FunctorArgumentType; 00076 00077 #ifdef OSG_NEWACTION_STATISTICS 00078 00079 /*-----------------------------------------------------------------------*/ 00083 static StatElemDesc<StatIntElem> statNodesEnter; 00084 static StatElemDesc<StatIntElem> statNodesLeave; 00085 00086 inline const StatCollector *getStatistics(void ) const; 00087 inline StatCollector *getStatistics(void ); 00088 inline void setStatistics(StatCollector *pStatistics); 00089 00090 #endif /* OSG_NEWACTION_STATISTICS */ 00091 00093 /*-----------------------------------------------------------------------*/ 00097 virtual ~NewActionBase(void); 00098 00100 /*-----------------------------------------------------------------------*/ 00104 virtual ResultE apply(NodePtr pRoot) = 0; 00105 00107 /*-----------------------------------------------------------------------*/ 00111 UInt32 addActor (ActorBase *pActor ); 00112 void subActor (ActorBase *pActor ); 00113 UInt32 findActor (ActorBase *pActor ) const; 00114 UInt32 getNumActors (void ) const; 00115 00117 /*-----------------------------------------------------------------------*/ 00121 UInt32 addExtendActor (ExtendActorBase *pActor ); 00122 UInt32 addExtendActor (ExtendActorBase *pActor, 00123 UInt32 pos ); 00124 void subExtendActor (UInt32 pos ); 00125 UInt32 findExtendActor (ExtendActorBase *pActor ) const; 00126 UInt32 getNumExtendActors(void ) const; 00127 00129 /*-----------------------------------------------------------------------*/ 00133 UInt32 addBasicActor (BasicActorBase *pActor ); 00134 UInt32 addBasicActor (BasicActorBase *pActor, 00135 UInt32 pos ); 00136 void subBasicActor (UInt32 pos ); 00137 UInt32 findBasicActor (BasicActorBase *pActor ) const; 00138 UInt32 getNumBasicActors (void ) const; 00139 00141 /*-----------------------------------------------------------------------*/ 00145 inline UInt32 getTravMask (void ) const; 00146 inline void setTravMask (UInt32 travMask); 00147 00149 /*==== PROTECTED ========================================================*/ 00150 protected: 00151 /*-----------------------------------------------------------------------*/ 00155 typedef std::vector<ExtendActorBase *> ExtendActorStore; 00156 typedef ExtendActorStore::iterator ExtendActorStoreIt; 00157 typedef ExtendActorStore::const_iterator ExtendActorStoreConstIt; 00158 00159 typedef std::vector<BasicActorBase *> BasicActorStore; 00160 typedef BasicActorStore::iterator BasicActorStoreIt; 00161 typedef BasicActorStore::const_iterator BasicActorStoreConstIt; 00162 00164 /*-----------------------------------------------------------------------*/ 00168 friend class OSG::ActorBase; 00169 friend class OSG::ExtendActorBase; 00170 friend class OSG::BasicActorBase; 00171 00173 /*-----------------------------------------------------------------------*/ 00177 NewActionBase(void); 00178 00180 /*-----------------------------------------------------------------------*/ 00184 virtual void addExtendEvent (ExtendActorBase *pActor, 00185 UInt32 actorIndex) = 0; 00186 virtual void subExtendEvent (ExtendActorBase *pActor, 00187 UInt32 actorIndex) = 0; 00188 00189 virtual void addBasicEvent (BasicActorBase *pActor, 00190 UInt32 actorIndex) = 0; 00191 virtual void subBasicEvent (BasicActorBase *pActor, 00192 UInt32 actorIndex) = 0; 00193 00194 virtual void startEvent (void ); 00195 virtual void stopEvent (void ); 00196 00197 virtual void beginEditStateEvent(ActorBase *pActor, 00198 UInt32 actorId ) = 0; 00199 virtual void endEditStateEvent (ActorBase *pActor, 00200 UInt32 actorId ) = 0; 00201 00203 /*-----------------------------------------------------------------------*/ 00207 inline bool getChildrenListEnabled(void ) const; 00208 inline void setChildrenListEnabled(bool enabled); 00209 00210 inline const ChildrenList &getChildrenList (void ) const; 00211 inline ChildrenList &getChildrenList (void ); 00212 00213 inline const ExtraChildrenList &getExtraChildrenList (void ) const; 00214 inline ExtraChildrenList &getExtraChildrenList (void ); 00215 00217 /*-----------------------------------------------------------------------*/ 00221 inline UInt32 getNumPasses(void ) const; 00222 inline void setNumPasses(UInt32 numPasses); 00223 00225 /*-----------------------------------------------------------------------*/ 00229 inline ExtendActorStoreConstIt beginExtend(void) const; 00230 inline ExtendActorStoreIt beginExtend(void); 00231 inline ExtendActorStoreConstIt endExtend (void) const; 00232 inline ExtendActorStoreIt endExtend (void); 00233 00234 inline BasicActorStoreConstIt beginBasic (void) const; 00235 inline BasicActorStoreIt beginBasic (void); 00236 inline BasicActorStoreConstIt endBasic (void) const; 00237 inline BasicActorStoreIt endBasic (void); 00238 00239 ResultE startActors(void); 00240 ResultE stopActors (void); 00241 00243 /*==== PRIVATE ==========================================================*/ 00244 private: 00245 ExtendActorStore _extendActors; 00246 BasicActorStore _basicActors; 00247 00248 #ifdef OSG_NEWACTION_STATISTICS 00249 StatCollector *_pStatistics; 00250 bool _ownStatistics; 00251 #endif /* OSG_NEWACTION_STATISTICS */ 00252 00253 UInt32 _travMask; 00254 UInt32 _numPasses; 00255 00256 bool _childrenListEnabled; 00257 ChildrenList _childrenList; 00258 00259 ExtraChildrenList _extraChildrenList; 00260 }; 00261 00262 OSG_END_NAMESPACE 00263 00264 #include "OSGNewActionBase.inl" 00265 00266 #define OSGNEWACTIONBASE_HEADER_CVSID "@(#)$Id: OSGNewActionBase.h,v 1.5 2004/09/17 14:09:43 neumannc Exp $" 00267 00268 #endif /* _OSGNEWACTIONBASE_H_ */
1.5.5