changed: gcc8 base update
[opensg.git] / Source / Base / FieldContainer / Fields / PointerFields / OSGPointerMFieldBase.h
blobf78e3ecafaee2d9a763ea5ea5997fb0a37fe6fef
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2008 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 _OSGPOINTERMFIELDBASE_H_
40 #define _OSGPOINTERMFIELDBASE_H_
42 #ifdef __sgi
43 #pragma once
44 #endif
46 #include "OSGBaseDef.h"
47 #include "OSGMField.h"
48 #include "OSGFieldContainerFieldTraits.h"
50 OSG_BEGIN_NAMESPACE
52 class PointerMFieldBaseConstIterator;
54 /*! \ingroup GrpBaseFieldContainerFields
55 \ingroup GrpLibOSGBase
58 class OSG_BASE_DLLMAPPING PointerMFieldBase : public Field
60 /*========================== PUBLIC =================================*/
62 public:
64 /*---------------------------------------------------------------------*/
65 /*! \name Public Types */
66 /*! \{ */
68 typedef Field Inherited;
69 typedef PointerMFieldBase Self;
71 // storage types
72 typedef FieldContainer * StoredType;
73 typedef MFieldVector<StoredType> StorageType;
74 typedef StorageType::const_iterator StorageConstIt;
76 // std library types
77 typedef PointerMFieldBaseConstIterator const_iterator;
78 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
80 typedef FieldContainer * const const_value;
81 typedef FieldContainer * value_type;
83 typedef StorageType::size_type size_type;
84 typedef StorageType::difference_type difference_type;
87 typedef FieldTraits<FieldContainer *, 0> MFieldTraits;
89 // handles
90 typedef EditMFieldHandle <Self > EditHandle;
91 typedef boost::shared_ptr<EditHandle> EditHandlePtr;
93 typedef GetMFieldHandle <Self > GetHandle;
94 typedef boost::shared_ptr<GetHandle> GetHandlePtr;
96 /*---------------------------------------------------------------------*/
98 static const bool isSField = false;
99 static const bool isMField = true;
101 static const bool isPointerField = true;
103 /*---------------------------------------------------------------------*/
104 /*! \name Class Get */
105 /*! \{ */
107 static const FieldType &getClassType(void);
109 /*! \} */
110 /*---------------------------------------------------------------------*/
111 /*! \name Binary Interface */
112 /*! \{ */
114 SizeT getBinSize(void ) const;
116 void copyToBin (BinaryDataHandler &pMem) const;
118 /*! \} */
119 /*---------------------------------------------------------------------*/
120 /*! \name Std Library Const Interface */
121 /*! \{ */
123 const_iterator begin (void ) const;
124 const_iterator end (void ) const;
126 const_reverse_iterator rbegin (void ) const;
127 const_reverse_iterator rend (void ) const;
129 value_type front (void ) const;
130 value_type back (void ) const;
132 bool empty (void ) const;
133 size_type size (void ) const;
134 UInt32 size32 (void ) const;
135 size_type max_size (void ) const;
136 size_type capacity (void ) const;
138 difference_type findIndex(const_value value) const;
140 /*! \} */
141 /*---------------------------------------------------------------------*/
142 /*! \name Index Operator */
143 /*! \{ */
145 value_type operator[](const size_type index) const;
146 value_type at (const size_type index) const;
148 /*! \} */
149 /*---------------------------------------------------------------------*/
150 /*! \name Raw Store Access */
151 /*! \{ */
153 bool operator ==(const Self &source) const;
155 /*! \} */
156 /*---------------------------------------------------------------------*/
157 /*! \name MT Sync */
158 /*! \{ */
160 void dump( UInt32 uiIndent = 0,
161 const BitVector bvFlags = 0) const;
163 /*! \} */
164 /*---------------------------------------------------------------------*/
165 /*! \name MT Sync */
166 /*! \{ */
168 #ifdef OSG_MT_CPTR_ASPECT
169 void beginEdit (UInt32 uiAspect,
170 AspectOffsetStore &oOffsets );
172 Self *resolveShare (UInt32 uiAspect,
173 AspectOffsetStore &oOffsets );
175 void terminateShare(UInt32 uiAspect,
176 AspectOffsetStore &oOffsets );
178 bool isShared (void );
179 #endif
181 /*! \} */
182 /*========================= PROTECTED ===============================*/
184 protected:
186 typedef StorageType::iterator iterator;
187 typedef StorageType::iterator StorageIt;
189 /*---------------------------------------------------------------------*/
190 /*! \name Members */
191 /*! \{ */
193 static FieldType _fieldType;
194 StorageType _ptrStore;
196 /*! \} */
197 /*---------------------------------------------------------------------*/
198 /*! \name Constructors */
199 /*! \{ */
201 PointerMFieldBase(void);
203 /*! \} */
204 /*---------------------------------------------------------------------*/
205 /*! \name Destructor */
206 /*! \{ */
208 ~PointerMFieldBase(void);
210 /*! \} */
211 /*---------------------------------------------------------------------*/
212 /*! \name Assignment */
213 /*! \{ */
215 void reserve(size_type newSize);
217 /*! \} */
218 /*---------------------------------------------------------------------*/
219 /*! \name Assignment */
220 /*! \{ */
222 void operator =(const Self &source);
224 /*! \} */
225 /*---------------------------------------------------------------------*/
226 /*! \name Cast Store Access */
227 /*! \{ */
229 /*! \nohierarchy */
230 template <class TargetStoredTypeT>
231 struct rebindStore
233 typedef MFieldVector<TargetStoredTypeT> type;
236 template <class TargetStoredTypeT>
237 typename rebindStore<TargetStoredTypeT>::type &editStore(void);
239 template <class TargetStoredTypeT>
240 typename rebindStore<TargetStoredTypeT>::type const &getStore (void) const;
242 StorageType &editRawStore(void);
243 StorageType const &getRawStore (void) const;
245 /*! \} */
246 /*========================== PRIVATE ================================*/
248 private:
250 PointerMFieldBase(const Self &obj);
253 typedef PointerMFieldBase FieldContainerPtrMFieldBase;
256 /*---------------------------------------------------------------------------*/
257 /* PointerMFieldBaseConstIterator */
258 /*---------------------------------------------------------------------------*/
260 /*! \ingroup GrpBaseFieldContainerFields
261 \ingroup GrpLibOSGBase
262 \nohierarchy
265 class OSG_BASE_DLLMAPPING PointerMFieldBaseConstIterator :
266 protected PointerMFieldBase::StorageConstIt
268 /*========================== PUBLIC =================================*/
269 public:
270 /*---------------------------------------------------------------------*/
271 /*! \name Public Types */
272 /*! \{ */
274 typedef PointerMFieldBaseConstIterator Self;
275 typedef PointerMFieldBase::StorageConstIt Inherited;
277 typedef PointerMFieldBase MFieldType;
279 // store types
280 typedef MFieldType::StoredType StoredType;
281 typedef MFieldType::StorageType StorageType;
282 typedef MFieldType::StorageConstIt StorageConstIt;
284 typedef MFieldType::const_value const_value;
286 // std library types
287 typedef Inherited::iterator_category iterator_category;
288 typedef Inherited::difference_type difference_type;
289 typedef Inherited::value_type value_type;
290 typedef Inherited::pointer pointer;
291 typedef Inherited::reference reference;
293 #if defined(WIN32) && _SECURE_SCL == 1 && _MSC_VER < 1600
294 typedef Inherited::_Checked_iterator_base_type
295 _Checked_iterator_base_type;
296 typedef Inherited::_Checked_iterator_category
297 _Checked_iterator_category;
298 #endif
300 /*! \} */
301 /*---------------------------------------------------------------------*/
302 /*! \name Constructors */
303 /*! \{ */
305 PointerMFieldBaseConstIterator( void );
306 PointerMFieldBaseConstIterator(const Self &source );
307 explicit PointerMFieldBaseConstIterator(const StorageConstIt &storeIt);
309 /*! \} */
310 /*---------------------------------------------------------------------*/
311 /*! \name Destructor */
312 /*! \{ */
314 ~PointerMFieldBaseConstIterator(void);
316 /*! \} */
317 /*---------------------------------------------------------------------*/
318 /*! \name Access Operators */
319 /*! \{ */
321 value_type operator * ( void ) const;
322 value_type operator [](const difference_type offset) const;
324 /*! \} */
325 /*---------------------------------------------------------------------*/
326 /*! \name Operators */
327 /*! \{ */
329 Self& operator ++( void );
330 Self operator ++( int );
332 Self& operator --( void );
333 Self operator --( int );
335 Self& operator +=(const difference_type offset);
336 Self operator + (const difference_type offset) const;
338 Self& operator -=(const difference_type offset);
339 Self operator - (const difference_type offset) const;
341 bool operator == (const Self& rhs ) const;
342 bool operator != (const Self& rhs ) const;
344 /*! \} */
345 /*========================= PROTECTED ===============================*/
346 protected:
350 OSG_END_NAMESPACE
352 #include "OSGPointerMFieldBase.inl"
354 #endif // _OSGPOINTERMFIELDBASE_H_