1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2003 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGMAPCACHEHANDLERMIXIN_H_
40 #define _OSGMAPCACHEHANDLERMIXIN_H_
45 #include "OSGBaseTypes.h"
47 #include <boost/bind.hpp>
53 /*! \brief Mixin for handling map caches.
54 \ingroup GrpSystemFieldContainerMixins
55 \ingroup GrpLibOSGBase
59 class MapCacheHandlerMixin
: public Desc::ParentT
61 /*========================== PRIVATE ================================*/
65 typedef typename
Desc::ParentT Inherited
;
67 /*========================== 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 /*---------------------------------------------------------------------*/
94 OSG_RC_FIRST_FIELD_DECL(MapCache
);
95 OSG_RC_LAST_FIELD_DECL (MapCache
);
98 /*---------------------------------------------------------------------*/
99 /*! \name General Fieldcontainer Declaration */
103 /*---------------------------------------------------------------------*/
104 /*! \name Constructors */
108 /*---------------------------------------------------------------------*/
109 /*! \name Destructor */
113 /*---------------------------------------------------------------------*/
117 void changed(ConstFieldMaskArg whichField
,
122 /*---------------------------------------------------------------------*/
128 /*---------------------------------------------------------------------*/
132 virtual FinalizedElement
*finalize(MapCacheKey oKey
);
135 /*---------------------------------------------------------------------*/
136 /*! \name your_category */
139 const MapCacheField
*getMapCacheField(void) const;
142 /*---------------------------------------------------------------------*/
143 /*! \name Container Access */
146 void addElement (MapCacheElement
const pElement
,
147 MapCacheKey key
= 0);
149 void subElement (MapCacheKey key
= 0);
151 void clearElements(void );
154 /*---------------------------------------------------------------------*/
155 /*! \name your_category */
158 MapCacheElement
findElement(MapCacheKey key
) const;
162 /*---------------------------------------------------------------------*/
163 /*! \name Binary Access */
166 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
167 virtual void copyToBin (BinaryDataHandler
&pMem
,
168 ConstFieldMaskArg whichField
);
169 virtual void copyFromBin(BinaryDataHandler
&pMem
,
170 ConstFieldMaskArg whichField
);
173 /*---------------------------------------------------------------------*/
174 /*! \name your_operators */
179 /*---------------------------------------------------------------------*/
180 /*! \name Assignment */
184 /*---------------------------------------------------------------------*/
185 /*! \name Comparison */
189 /*---------------------------------------------------------------------*/
193 virtual void dump( UInt32 uiIndent
= 0,
194 const BitVector bvFlags
= 0) const;
197 /*========================= PROTECTED ===============================*/
201 /*---------------------------------------------------------------------*/
202 /*! \name Type information */
206 /*---------------------------------------------------------------------*/
210 MapCacheField _fMapCache
;
213 /*---------------------------------------------------------------------*/
217 MapCacheHandlerMixin(void);
218 MapCacheHandlerMixin(const MapCacheHandlerMixin
&source
);
220 virtual ~MapCacheHandlerMixin(void);
223 /*---------------------------------------------------------------------*/
227 static void classDescInserter(TypeObject
&oType
);
230 /*---------------------------------------------------------------------*/
231 /*! \name MT Destruction */
234 #ifdef OSG_MT_CPTR_ASPECT
235 void execSync ( Self
*pFrom
,
236 ConstFieldMaskArg whichField
,
237 AspectOffsetStore
&oOffsets
,
238 ConstFieldMaskArg syncMode
,
239 const UInt32 uiSyncInfo
);
244 /*---------------------------------------------------------------------*/
249 /*---------------------------------------------------------------------*/
253 EditFieldHandlePtr
editHandleMapCache(void);
254 GetFieldHandlePtr
getHandleMapCache (void) const;
257 /*---------------------------------------------------------------------*/
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
,
271 virtual void resolveLinks ( void );
274 /*========================== PRIVATE ================================*/
278 /*!\brief prohibit default function (move to 'public' if needed) */
279 void operator =(const MapCacheHandlerMixin
&source
);
284 #include "OSGMapCacheHandlerMixin.inl"
286 #endif /* _OSGMAPCACHEHANDLERMIXIN_H_ */