fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / FieldContainer / Mixins / OSGMapCacheHandlerMixin.h
blob65e07d86123df9e6eee80e3246fb940e91dcda4e
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2003 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 _OSGMAPCACHEHANDLERMIXIN_H_
40 #define _OSGMAPCACHEHANDLERMIXIN_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGBaseTypes.h"
47 #include <boost/bind.hpp>
49 OSG_BEGIN_NAMESPACE
51 class PrimeMaterial;
53 /*! \brief Mixin for handling map caches.
54 \ingroup GrpSystemFieldContainerMixins
55 \ingroup GrpLibOSGBase
58 template <class Desc>
59 class MapCacheHandlerMixin : public Desc::ParentT
61 /*========================== PRIVATE ================================*/
63 private:
65 typedef typename Desc::ParentT Inherited;
67 /*========================== PUBLIC =================================*/
69 public:
71 typedef MapCacheHandlerMixin<Desc> Self;
73 typedef typename Inherited::TypeObject TypeObject;
75 typedef typename Desc::FinalContainer FinalContainer;
77 typedef typename Desc::MapCacheField MapCacheField;
78 typedef typename Desc::MapCache MapCache;
80 typedef typename Desc::MapCacheElement MapCacheElement;
81 typedef typename Desc::MapCacheKey MapCacheKey;
83 typedef typename Desc::MapKeyPool MapKeyPool;
85 typedef typename MapCache::iterator MapCacheFieldIt;
86 typedef typename MapCache::const_iterator MapCacheFieldConstIt;
88 typedef typename Desc::FinalizedElement FinalizedElement;
90 /*---------------------------------------------------------------------*/
91 /*! \name dcast */
92 /*! \{ */
94 OSG_RC_FIRST_FIELD_DECL(MapCache);
95 OSG_RC_LAST_FIELD_DECL (MapCache);
97 /*! \} */
98 /*---------------------------------------------------------------------*/
99 /*! \name General Fieldcontainer Declaration */
100 /*! \{ */
102 /*! \} */
103 /*---------------------------------------------------------------------*/
104 /*! \name Constructors */
105 /*! \{ */
107 /*! \} */
108 /*---------------------------------------------------------------------*/
109 /*! \name Destructor */
110 /*! \{ */
112 /*! \} */
113 /*---------------------------------------------------------------------*/
114 /*! \name Helper */
115 /*! \{ */
117 void changed(ConstFieldMaskArg whichField,
118 UInt32 origin,
119 BitVector details);
121 /*! \} */
122 /*---------------------------------------------------------------------*/
123 /*! \name Get */
124 /*! \{ */
127 /*! \} */
128 /*---------------------------------------------------------------------*/
129 /*! \name Set */
130 /*! \{ */
132 virtual FinalizedElement *finalize(MapCacheKey oKey);
134 /*! \} */
135 /*---------------------------------------------------------------------*/
136 /*! \name your_category */
137 /*! \{ */
139 const MapCacheField *getMapCacheField(void) const;
141 /*! \} */
142 /*---------------------------------------------------------------------*/
143 /*! \name Container Access */
144 /*! \{ */
146 void addElement (MapCacheElement const pElement,
147 MapCacheKey key = 0);
149 void subElement (MapCacheKey key = 0);
151 void clearElements(void );
153 /*! \} */
154 /*---------------------------------------------------------------------*/
155 /*! \name your_category */
156 /*! \{ */
158 MapCacheElement findElement(MapCacheKey key) const;
161 /*! \} */
162 /*---------------------------------------------------------------------*/
163 /*! \name Binary Access */
164 /*! \{ */
166 virtual SizeT getBinSize (ConstFieldMaskArg whichField);
167 virtual void copyToBin (BinaryDataHandler &pMem,
168 ConstFieldMaskArg whichField);
169 virtual void copyFromBin(BinaryDataHandler &pMem,
170 ConstFieldMaskArg whichField);
172 /*! \} */
173 /*---------------------------------------------------------------------*/
174 /*! \name your_operators */
175 /*! \{ */
178 /*! \} */
179 /*---------------------------------------------------------------------*/
180 /*! \name Assignment */
181 /*! \{ */
183 /*! \} */
184 /*---------------------------------------------------------------------*/
185 /*! \name Comparison */
186 /*! \{ */
188 /*! \} */
189 /*---------------------------------------------------------------------*/
190 /*! \name Dump */
191 /*! \{ */
193 virtual void dump( UInt32 uiIndent = 0,
194 const BitVector bvFlags = 0) const;
196 /*! \} */
197 /*========================= PROTECTED ===============================*/
199 protected:
201 /*---------------------------------------------------------------------*/
202 /*! \name Type information */
203 /*! \{ */
205 /*! \} */
206 /*---------------------------------------------------------------------*/
207 /*! \name Fields */
208 /*! \{ */
210 MapCacheField _fMapCache;
212 /*! \} */
213 /*---------------------------------------------------------------------*/
214 /*! \name Member */
215 /*! \{ */
217 MapCacheHandlerMixin(void);
218 MapCacheHandlerMixin(const MapCacheHandlerMixin &source);
220 virtual ~MapCacheHandlerMixin(void);
222 /*! \} */
223 /*---------------------------------------------------------------------*/
224 /*! \name Changed */
225 /*! \{ */
227 static void classDescInserter(TypeObject &oType);
229 /*! \} */
230 /*---------------------------------------------------------------------*/
231 /*! \name MT Destruction */
232 /*! \{ */
234 #ifdef OSG_MT_CPTR_ASPECT
235 void execSync ( Self *pFrom,
236 ConstFieldMaskArg whichField,
237 AspectOffsetStore &oOffsets,
238 ConstFieldMaskArg syncMode ,
239 const UInt32 uiSyncInfo);
240 #endif
243 /*! \} */
244 /*---------------------------------------------------------------------*/
245 /*! \name Edit */
246 /*! \{ */
248 /*! \} */
249 /*---------------------------------------------------------------------*/
250 /*! \name Edit */
251 /*! \{ */
253 EditFieldHandlePtr editHandleMapCache(void);
254 GetFieldHandlePtr getHandleMapCache (void) const;
256 /*! \} */
257 /*---------------------------------------------------------------------*/
258 /*! \name Sync */
259 /*! \{ */
261 void onCreateAspect (const FinalContainer *createAspect,
262 const FinalContainer *source = NULL);
264 void onCreate (const FinalContainer *source = NULL);
266 virtual void onDestroy ( UInt32 uiContainerId );
268 virtual void onDestroyAspect( UInt32 uiContainerId,
269 UInt32 uiAspect );
271 virtual void resolveLinks ( void );
273 /*! \} */
274 /*========================== PRIVATE ================================*/
276 private:
278 /*!\brief prohibit default function (move to 'public' if needed) */
279 void operator =(const MapCacheHandlerMixin &source);
282 OSG_END_NAMESPACE
284 #include "OSGMapCacheHandlerMixin.inl"
286 #endif /* _OSGMAPCACHEHANDLERMIXIN_H_ */