Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SoElement.h

00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) 1998-2002 by Systems in Motion. All rights reserved.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public License
00008  *  version 2.1 as published by the Free Software Foundation. See the
00009  *  file LICENSE.LGPL at the root directory of the distribution for
00010  *  more details.
00011  *
00012  *  If you want to use Coin for applications not compatible with the
00013  *  LGPL, please contact SIM to acquire a Professional Edition license.
00014  *
00015  *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
00016  *  http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097
00017  *
00018 \**************************************************************************/
00019 
00020 #ifndef COIN_SOELEMENT_H
00021 #define COIN_SOELEMENT_H
00022 
00023 #include <Inventor/SbBasic.h>
00024 #include <Inventor/SoType.h>
00025 #include <Inventor/misc/SoState.h>
00026 #include <stdio.h>
00027 
00028 class SoNode;
00029 
00030 class COIN_DLL_API SoElement {
00031 public:
00032   static void initClass(void);
00033 
00034   static SoType getClassTypeId(void);
00035   static int getClassStackIndex(void);
00036   const SoType getTypeId(void) const;
00037   int getStackIndex(void) const;
00038 
00039   virtual void init(SoState * state);
00040 
00041   virtual void push(SoState * state);
00042   virtual void pop(SoState * state, const SoElement * prevTopElement);
00043 
00044   virtual SbBool isLazy(void) const;
00045   virtual void lazyEvaluate(void) const;
00046 
00047   virtual SbBool matches(const SoElement * element) const = 0;
00048   virtual SoElement * copyMatchInfo(void) const = 0;
00049 
00050   static void initElements(void); // only for base class (SoElement)
00051 
00052   static int getNumStackIndices(void);
00053   static SoType getIdFromStackIndex(const int stackIndex);
00054 
00055   void setDepth(const int depth);
00056 
00057   int getDepth(void) const;
00058 
00059   virtual void print(FILE * file = stdout) const;
00060   virtual ~SoElement();
00061 
00062 protected:
00063   SoElement(void);
00064   static int classStackIndex;
00065 
00066   static SoElement * getElement(SoState * const state, const int stackIndex);
00067   static const SoElement * getConstElement(SoState * const state,
00068                                            const int stackIndex);
00069 
00070   void capture(SoState * const state) const;
00071   virtual void captureThis(SoState * state) const;
00072 
00073   void setTypeId(const SoType typeId);
00074   void setStackIndex(const int index);
00075 
00076   SoType typeId;
00077   int stackIndex;
00078 
00079   static int createStackIndex(const SoType id);
00080   static SoTypeList * stackToType;
00081 
00082   int depth;
00083 
00084   SoElement * getNextInStack(void) const;
00085   SoElement * getNextFree(void) const;
00086 
00087 private:
00088 
00089   static SoType classTypeId;
00090 
00091   friend class SoState; // FIXME: bad design. 19990629 mortene.
00092   static void cleanup(void);
00093   SoElement * nextup;
00094   SoElement * nextdown;
00095 };
00096 
00097 // inlined methods
00098 
00099 inline SoElement *
00100 SoElement::getElement(SoState * const state,
00101                       const int stackIndex)
00102 {
00103   return state->getElement(stackIndex);
00104 }
00105 
00106 #endif // !COIN_SOELEMENT_H

Generated at Tue Mar 5 03:31:13 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001