changed: gcc8 base update
[opensg.git] / Source / Base / FieldContainer / Fields / MemObjPointerFields / OSGMemObjPointerMFieldBase.h
blob5fd0b4dee1e5c05b54d59edbf741eeab0e4cd27e
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 _OSGMEMOBJPOINTERMFIELDBASE_H_
40 #define _OSGMEMOBJPOINTERMFIELDBASE_H_
42 #ifdef __sgi
43 #pragma once
44 #endif
46 #include "OSGBaseDef.h"
47 #include "OSGMField.h"
48 #include "OSGMemoryObjectFieldTraits.h"
50 OSG_BEGIN_NAMESPACE
52 /*! \ingroup GrpBaseMemoryObjectsFields
53 \ingroup GrpLibOSGBase
56 class OSG_BASE_DLLMAPPING MemObjPointerMFieldBase : public Field
58 /*========================== PUBLIC =================================*/
60 public:
62 /*---------------------------------------------------------------------*/
63 /*! \name Public Types */
64 /*! \{ */
66 typedef Field Inherited;
67 typedef MemObjPointerMFieldBase Self;
69 // storage
70 typedef MemoryObject * StoredType;
71 typedef MFieldVector<StoredType> StorageType;
73 typedef StorageType::const_iterator const_iterator;
74 typedef StorageType::const_reverse_iterator const_reverse_iterator;
76 typedef StorageType::const_iterator StorageConstIt;
78 typedef MemoryObject * const const_value;
79 typedef MemoryObject * value_type;
81 typedef StorageType::size_type size_type;
82 typedef StorageType::difference_type difference_type;
85 typedef FieldTraits<MemoryObject *, 0> MFieldTraits;
88 // handles
89 typedef EditMFieldHandle <Self > EditHandle;
90 typedef boost::shared_ptr<EditHandle> EditHandlePtr;
92 typedef GetMFieldHandle <Self > GetHandle;
93 typedef boost::shared_ptr<GetHandle> GetHandlePtr;
95 /*---------------------------------------------------------------------*/
97 static const bool isSField = false;
98 static const bool isMField = true;
100 static const bool isPointerField = true;
102 /*---------------------------------------------------------------------*/
103 /*! \name Class Get */
104 /*! \{ */
106 static const FieldType &getClassType(void);
108 /*! \} */
109 /*---------------------------------------------------------------------*/
110 /*! \name Binary Interface */
111 /*! \{ */
113 SizeT getBinSize(void ) const;
115 void copyToBin (BinaryDataHandler &pMem) const;
117 /*! \} */
118 /*---------------------------------------------------------------------*/
119 /*! \name Std Library Const Interface */
120 /*! \{ */
122 const_iterator begin (void ) const;
123 const_iterator end (void ) const;
125 const_reverse_iterator rbegin (void ) const;
126 const_reverse_iterator rend (void ) const;
128 value_type front (void ) const;
129 value_type back (void ) const;
131 bool empty (void ) const;
132 size_type size (void ) const;
133 size_type max_size (void ) const;
134 size_type capacity (void ) const;
136 difference_type findIndex(const_value value) const;
138 /*! \} */
139 /*---------------------------------------------------------------------*/
140 /*! \name Index Operator */
141 /*! \{ */
143 value_type operator[](const size_type index) const;
144 value_type at (const size_type index) const;
146 /*! \} */
147 /*---------------------------------------------------------------------*/
148 /*! \name Raw Store Access */
149 /*! \{ */
151 bool operator ==(const Self &source) const;
153 /*! \} */
154 /*---------------------------------------------------------------------*/
155 /*! \name MT Sync */
156 /*! \{ */
158 void dump( UInt32 uiIndent = 0,
159 const BitVector bvFlags = 0) const;
161 /*! \} */
162 /*---------------------------------------------------------------------*/
163 /*! \name MT Sync */
164 /*! \{ */
166 #ifdef OSG_MT_CPTR_ASPECT
167 void beginEdit (UInt32 uiAspect,
168 AspectOffsetStore &oOffsets );
170 Self *resolveShare (UInt32 uiAspect,
171 AspectOffsetStore &oOffsets );
173 void terminateShare(UInt32 uiAspect,
174 AspectOffsetStore &oOffsets );
176 bool isShared (void );
177 #endif
179 /*! \} */
180 /*========================= PROTECTED ===============================*/
182 protected:
184 typedef StorageType::iterator iterator;
185 typedef StorageType::iterator StorageIt;
187 /*---------------------------------------------------------------------*/
188 /*! \name Members */
189 /*! \{ */
191 static FieldType _fieldType;
192 StorageType _ptrStore;
194 /*! \} */
195 /*---------------------------------------------------------------------*/
196 /*! \name Constructors */
197 /*! \{ */
199 MemObjPointerMFieldBase(void);
201 /*! \} */
202 /*---------------------------------------------------------------------*/
203 /*! \name Destructor */
204 /*! \{ */
206 ~MemObjPointerMFieldBase(void);
208 /*! \} */
209 /*---------------------------------------------------------------------*/
210 /*! \name Assignment */
211 /*! \{ */
213 void reserve(size_type newSize);
215 /*! \} */
216 /*---------------------------------------------------------------------*/
217 /*! \name Assignment */
218 /*! \{ */
220 void operator =(const Self &source);
222 /*! \} */
223 /*---------------------------------------------------------------------*/
224 /*! \name Cast Store Access */
225 /*! \{ */
227 /*! \nohierarchy */
228 template <class TargetStoredTypeT>
229 struct rebindStore
231 typedef MFieldVector<TargetStoredTypeT> type;
234 template <class TargetStoredTypeT>
235 typename rebindStore<TargetStoredTypeT>::type &editStore(void);
237 template <class TargetStoredTypeT>
238 typename rebindStore<TargetStoredTypeT>::type const &getStore (void) const;
240 StorageType &editRawStore(void);
241 StorageType const &getRawStore (void) const;
243 /*! \} */
244 /*========================== PRIVATE ================================*/
246 private:
248 MemObjPointerMFieldBase(const Self &obj);
251 typedef MemObjPointerMFieldBase MemoryObjectPtrMFieldBase;
253 OSG_END_NAMESPACE
255 #include "OSGMemObjPointerMFieldBase.inl"
257 #endif // _OSGMEMOBJPOINTERMFIELDBASE_H_