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 #ifndef _OSGSTATE_H_ 00041 #define _OSGSTATE_H_ 00042 #ifdef __sgi 00043 #pragma once 00044 #endif 00045 00046 #include <OSGConfig.h> 00047 #include <OSGStateBase.h> 00048 #include <OSGStateChunk.h> 00049 00050 OSG_BEGIN_NAMESPACE 00051 00056 class OSG_SYSTEMLIB_DLLMAPPING State : public StateBase 00057 { 00058 /*========================== PUBLIC =================================*/ 00059 public: 00060 00061 /*---------------------------------------------------------------------*/ 00065 static const char *getClassname(void) { return "State"; }; 00066 00068 /*---------------------------------------------------------------------*/ 00072 virtual void changed(BitVector whichField, 00073 UInt32 origin ); 00074 00076 /*---------------------------------------------------------------------*/ 00080 virtual void dump( UInt32 uiIndent = 0, 00081 const BitVector bvFlags = 0) const; 00082 00084 /*---------------------------------------------------------------------*/ 00088 void activate (DrawActionBase *action); 00089 00090 void changeFrom (DrawActionBase *action, State *old); 00091 00092 void deactivate (DrawActionBase *action); 00093 00095 /*---------------------------------------------------------------------*/ 00099 enum { AutoSlot = -1, AutoSlotReplace = -2 }; 00100 00102 /*---------------------------------------------------------------------*/ 00106 StateChunkPtr getChunk (UInt32 id); 00107 00108 bool chunkPresent (UInt32 id); 00109 bool chunkPresent (StateChunkPtr chunk); 00110 00111 bool addChunk (StateChunkPtr chunk, 00112 Int32 index = AutoSlotReplace); 00113 00114 bool subChunk (StateChunkPtr chunk); 00115 00116 bool subChunk (UInt32 classid, Int32 index); 00117 00118 void clearChunks (void); 00119 00121 /*---------------------------------------------------------------------*/ 00125 virtual Real32 switchCost (State * state); 00126 00127 virtual bool operator < (const State &other) const; 00128 00129 virtual bool operator == (const State &other) const; 00130 virtual bool operator != (const State &other) const; 00131 00134 /*========================= PROTECTED ===============================*/ 00135 protected: 00136 00137 /*---------------------------------------------------------------------*/ 00141 State(void); 00142 State(const State &source); 00143 00145 /*---------------------------------------------------------------------*/ 00149 virtual ~State(void); 00150 00153 /*========================== PRIVATE ================================*/ 00154 private: 00155 00156 typedef StateBase Inherited; 00157 00158 friend class FieldContainer; 00159 friend class StateBase; 00160 00161 static char cvsid[]; 00162 00163 static void initMethod(void); 00164 00165 void operator =(const State &source); 00166 }; 00167 00168 typedef State *StateP; 00169 00170 OSG_END_NAMESPACE 00171 00172 #include <OSGStateBase.inl> 00173 #include <OSGState.inl> 00174 00175 #endif /* _OSGSTATE_H_ */
1.4.3