fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / State / Shader / Base / OSGShaderCache.h
blob19ec6717b676b174c6541bc3d9b7c41435f7abac
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGSHADERCACHE_H_
40 #define _OSGSHADERCACHE_H_
42 #ifdef __sgi
43 #pragma once
44 #endif
46 //#define OSG_SHC_USE_REF 1
47 //#define OSG_SHC_REF_CLEANUP 1
48 //#define OSG_ASSERT_TREE 1
50 #include "OSGShaderCacheTree.h"
52 OSG_BEGIN_NAMESPACE
54 /*! \ingroup GrpSystemShaderBase
55 \ingroup GrpLibOSGSystem
56 \nohierarchy
59 class OSG_SYSTEM_DLLMAPPING ShaderCache
61 /*========================== PUBLIC =================================*/
63 public:
65 typedef ActiveShaderExeTree ShaderExeTree;
66 typedef ActiveShaderVarTree ShaderVarTree;
68 typedef ShaderExeTree::IdStore IdStore;
70 #ifdef OSG_SHC_USE_REF
71 typedef std::pair <IdStore,
72 ShaderExecutableChunkUnrecPtr > StoreElement;
73 typedef std::pair <IdStore,
74 ShaderExecutableVarChunkUnrecPtr > StoreVarElement;
76 typedef std::vector<StoreElement > ShaderStore;
77 typedef std::vector<StoreVarElement > ShaderVarStore;
78 #endif
80 /*---------------------------------------------------------------------*/
81 /*! \name Statistic */
82 /*! \{ */
84 /*! \} */
85 /*---------------------------------------------------------------------*/
86 /*! \name Access */
87 /*! \{ */
89 ShaderExecutableChunk *findShader (const IdStore &vIds);
90 ShaderExecutableVarChunk *findShaderVar(const IdStore &vIds);
92 /*! \} */
93 /*---------------------------------------------------------------------*/
94 /*! \name Access */
95 /*! \{ */
97 void addShader (const IdStore &vIds,
98 ShaderExecutableChunk *pShader);
100 void addShaderVar(const IdStore &vIds,
101 ShaderExecutableVarChunk *pVar );
103 void clear ( void );
105 /*! \} */
106 /*---------------------------------------------------------------------*/
107 /*! \name Access */
108 /*! \{ */
110 void dump(void);
112 /*! \} */
113 /*---------------------------------------------------------------------*/
114 /*! \name Access */
115 /*! \{ */
117 /*! \} */
118 /*---------------------------------------------------------------------*/
119 /*! \name Constructors */
120 /*! \{ */
122 /*! \} */
123 /*---------------------------------------------------------------------*/
124 /*! \name Constructors */
125 /*! \{ */
127 /*! \} */
128 /*---------------------------------------------------------------------*/
129 /*! \name Constructors */
130 /*! \{ */
132 /*! \} */
133 /*---------------------------------------------------------------------*/
134 /*! \name Constructors */
135 /*! \{ */
137 /*! \} */
138 /*---------------------------------------------------------------------*/
139 /*! \name Constructors */
140 /*! \{ */
142 ShaderCache(void);
144 /*! \} */
145 /*---------------------------------------------------------------------*/
146 /*! \name Destructor */
147 /*! \{ */
149 virtual ~ShaderCache(void);
151 /*! \} */
152 /*========================= PROTECTED ===============================*/
154 protected:
156 /*---------------------------------------------------------------------*/
157 /*! \name Member */
158 /*! \{ */
160 #ifdef OSG_SHC_USE_REF
161 ShaderStore _vShaderStore;
162 ShaderVarStore _vShaderVarStore;
163 #endif
165 ShaderExeTree _oExeTree;
166 ShaderVarTree _oVarTree;
168 /*! \} */
169 /*---------------------------------------------------------------------*/
170 /*! \name Destructor */
171 /*! \{ */
173 void updateRemoveCallback (ShaderExecutableChunk *pShader );
174 void clearShRemoveCallback (ShaderExecutableChunk *pShader );
176 void updateRemoveCallback (ShaderExecutableVarChunk *pVar );
177 void clearVaRemoveCallback (ShaderExecutableVarChunk *pVar );
179 void removeShaderProgram (FieldContainer *pContainer,
180 ConstFieldMaskArg whichField);
182 void removeShaderVar (FieldContainer *pContainer,
183 ConstFieldMaskArg whichField);
185 /*! \} */
186 /*========================== PRIVATE ================================*/
188 private:
190 /*! \brief prohibit default function (move to 'public' if needed) */
191 ShaderCache(const ShaderCache &source);
192 /*! \brief prohibit default function (move to 'public' if needed) */
193 void operator =(const ShaderCache &source);
196 OSG_END_NAMESPACE
198 #include "OSGShaderCache.inl"
200 #endif /* _OSGSHADERCACHE_H_ */