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

OSGActorBase.cpp

Go to the documentation of this file.
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 //----------------------------------------------------------------------------
00040 //    Includes
00041 //----------------------------------------------------------------------------
00042 
00043 #include "OSGActorBase.h"
00044 
00045 OSG_USING_NAMESPACE
00046 
00047 //----------------------------------------------------------------------------
00048 //    Description
00049 //----------------------------------------------------------------------------
00050 
00067 // Abstract function doc
00068 
00080 //----------------------------------------------------------------------------
00081 //    Types
00082 //----------------------------------------------------------------------------
00083 
00084 ActorBase::ActorBaseState::~ActorBaseState(void)
00085 {
00086 }
00087 
00088 //----------------------------------------------------------------------------
00089 //    Destructor
00090 //----------------------------------------------------------------------------
00091 
00095 ActorBase::~ActorBase(void)
00096 {
00097 }
00098 
00099 
00100 //----------------------------------------------------------------------------
00101 //    Start/Stop
00102 //----------------------------------------------------------------------------
00103 
00108 ActorBase::ResultE
00109 ActorBase::start(void)
00110 {
00111 #ifdef OSG_NEWACTION_STATESLOTINTERFACE
00112     _stateSlotMap.clear();
00113 #endif
00114 
00115     return NewActionTypes::Continue;
00116 }
00117 
00122 ActorBase::ResultE
00123 ActorBase::stop(void)
00124 {
00125 #ifdef OSG_NEWACTION_STATESLOTINTERFACE
00126     _stateSlotMap.clear();
00127 #endif
00128 
00129     return NewActionTypes::Continue;
00130 }
00131 
00132 //----------------------------------------------------------------------------
00133 //    Constructor
00134 //----------------------------------------------------------------------------
00135 
00139 ActorBase::ActorBase(void)
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 }
00150 
00151 //----------------------------------------------------------------------------
00152 //    Event Notification
00153 //----------------------------------------------------------------------------
00154 
00159 void
00160 ActorBase::addEvent(NewActionBase *pAction, UInt32 actorId)
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 }
00173 
00178 void
00179 ActorBase::subEvent(NewActionBase *pAction, UInt32 actorId)
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 }
00192 
00193 /*------------------------------------------------------------------------*/
00194 /*                              cvs id's                                  */
00195 
00196 #ifdef OSG_SGI_CC
00197 #pragma set woff 1174
00198 #endif
00199 
00200 #ifdef OSG_LINUX_ICC
00201 #pragma warning(disable : 177)
00202 #endif
00203 
00204 namespace
00205 {
00206     static Char8 cvsid_cpp       [] = "@(#)$Id: $";
00207     static Char8 cvsid_hpp       [] = OSGACTORBASE_HEADER_CVSID;
00208     static Char8 cvsid_inl       [] = OSGACTORBASE_INLINE_CVSID;
00209 }
00210 
00211 #ifdef OSG_LINUX_ICC
00212 #pragma warning(enable : 177)
00213 #endif
00214 
00215 #ifdef OSG_SGI_CC
00216 #pragma reset woff 1174
00217 #endif

Generated on Thu Aug 25 04:00:59 2005 for OpenSG by  doxygen 1.4.3