fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Base / FieldContainer / Fields / PointerFields / OSGPointerMFieldCommon.h
bloba22adac1fae4d30034c973b318e75b10ab5e0604
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 _OSGPOINTERMFIELDCOMMON_H_
40 #define _OSGPOINTERMFIELDCOMMON_H_
42 #ifdef __sgi
43 #pragma once
44 #endif
46 #include "OSGConfig.h"
47 #include "OSGPointerMFieldBase.h"
48 #include "OSGBinaryDataHandler.h"
50 OSG_BEGIN_NAMESPACE
52 // forward declarations
53 template <Int32 NamespaceI>
54 class PointerFieldTraitsBase;
56 /*! \ingroup GrpBaseFieldContainerFields
57 \ingroup GrpLibOSGBase
60 template <class AccessHandlerT,
61 Int32 NamespaceI = 0>
62 class PointerMFieldCommon : public PointerMFieldBase
64 /*========================== PUBLIC =================================*/
66 public:
68 /*---------------------------------------------------------------------*/
69 /*! \name Public Types */
70 /*! \{ */
72 typedef AccessHandlerT AccessHandler;
73 typedef PointerMFieldBase Inherited;
75 typedef typename Inherited::StorageIt PtrStoreItType;
76 typedef typename Inherited::StorageConstIt PtrStoreConstItType;
78 typedef typename Inherited::StoredType StoredType;
79 typedef typename Inherited::StorageType PtrStoreType;
81 typedef typename Inherited::const_value const_value;
82 typedef typename Inherited::value_type value_type;
84 typedef typename Inherited::size_type size_type;
85 typedef typename Inherited::difference_type difference_type;
87 protected:
89 typedef PointerMFieldCommon Self;
91 typedef FieldTraitsFCPtrBase<
92 FieldContainer *,
93 NamespaceI > PtrBaseTraitsType;
95 /*! \} */
96 /*---------------------------------------------------------------------*/
97 /*! \name Constants */
98 /*! \{ */
100 static Int32 const Namespace = NamespaceI;
102 /*! \} */
103 /*========================= PROTECTED ===============================*/
105 protected:
107 /*---------------------------------------------------------------------*/
108 /*! \name Constructors */
109 /*! \{ */
111 PointerMFieldCommon(void );
112 PointerMFieldCommon(const Self &source );
113 explicit PointerMFieldCommon(const UInt32 initSize);
115 /*! \} */
116 /*---------------------------------------------------------------------*/
117 /*! \name Destructor */
118 /*! \{ */
120 ~PointerMFieldCommon(void);
122 /*! \} */
123 /*---------------------------------------------------------------------*/
124 /*! \name Store Interface */
125 /*! \{ */
127 // reading values
128 value_type ptrStoreGet(const size_type index) const;
129 value_type ptrStoreGet( PtrStoreItType pos ) const;
130 value_type ptrStoreGet( PtrStoreConstItType pos ) const;
132 /*---------------------------------------------------------------------*/
133 // adding values
135 void ptrStoreAppend ( const_value pNewObj);
137 template <class InputIteratorT>
138 void ptrStoreAssign ( InputIteratorT first,
139 InputIteratorT last );
141 void ptrStoreInsert (const size_type index,
142 const_value pNewObj);
143 void ptrStoreInsert ( PtrStoreItType pos,
144 size_type n,
145 const_value pNewObj);
146 PtrStoreItType ptrStoreInsert ( PtrStoreItType pos,
147 const_value pNewObj);
149 template <class InputIteratorT>
150 void ptrStoreInsert ( PtrStoreItType pos,
151 InputIteratorT first,
152 InputIteratorT last );
155 /*---------------------------------------------------------------------*/
156 // changing values
158 void ptrStoreReplace(const size_type index,
159 const_value pNewObj);
160 void ptrStoreReplace( PtrStoreItType pos,
161 const_value pNewObj);
163 /*---------------------------------------------------------------------*/
164 // removing values
166 void ptrStoreErase (const size_type index );
167 void ptrStoreErase (const size_type beginIndex,
168 const size_type endIndex );
170 PtrStoreItType ptrStoreErase ( PtrStoreItType pos );
171 PtrStoreItType ptrStoreErase ( PtrStoreItType beginIt,
172 PtrStoreItType endIt );
174 void ptrStoreClear ( void );
176 /*---------------------------------------------------------------------*/
177 // resizing
179 void ptrStoreResize(const size_type newSize,
180 const_value pNewObj);
182 /*---------------------------------------------------------------------*/
183 // finding values
185 PtrStoreItType ptrStoreFind(const_value pObj);
186 PtrStoreConstItType ptrStoreFind(const_value pObj) const;
188 /*! \} */
189 /*---------------------------------------------------------------------*/
190 /*! \name Std library interface */
191 /*! \{ */
194 /*! \} */
195 /*---------------------------------------------------------------------*/
196 /*! \name FieldDesc creation */
197 /*! \{ */
199 static FieldDescriptionBase *
200 createFieldDescription (const Char8 *szFieldname,
201 UInt32 uiFieldFlags,
202 FieldEditMethod fEditMethod,
203 FieldGetMethod fGetMethod );
205 static FieldDescriptionBase *
206 createIdxFieldDescription(const Char8 *szFieldname,
207 UInt32 uiFieldFlags,
208 FieldIndexEditMethod fEditMethod,
209 FieldIndexGetMethod fGetMethod );
211 /*! \} */
212 /*---------------------------------------------------------------------*/
213 /*! \name Binary IO */
214 /*! \{ */
216 void copyFromBin(BinaryDataHandler &pMem);
218 /*! \} */
219 /*---------------------------------------------------------------------*/
220 /*! \name MT Sync */
221 /*! \{ */
223 void syncWith(Self &source,
224 ConstFieldMaskArg syncMode,
225 UInt32 uiSyncInfo,
226 AspectOffsetStore &oOffsets );
228 /*! \} */
229 /*========================== PRIVATE ================================*/
231 private:
233 void operator =(const Self &other);
236 OSG_END_NAMESPACE
238 #include "OSGPointerMFieldCommon.inl"
240 #endif // _OSGPOINTERMFIELDCOMMON_H_