1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2008 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 _OSGPOINTERMFIELDCOMMON_H_
40 #define _OSGPOINTERMFIELDCOMMON_H_
46 #include "OSGConfig.h"
47 #include "OSGPointerMFieldBase.h"
48 #include "OSGBinaryDataHandler.h"
52 // forward declarations
53 template <Int32 NamespaceI
>
54 class PointerFieldTraitsBase
;
56 /*! \ingroup GrpBaseFieldContainerFields
57 \ingroup GrpLibOSGBase
60 template <class AccessHandlerT
,
62 class PointerMFieldCommon
: public PointerMFieldBase
64 /*========================== PUBLIC =================================*/
68 /*---------------------------------------------------------------------*/
69 /*! \name Public Types */
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
;
89 typedef PointerMFieldCommon Self
;
91 typedef FieldTraitsFCPtrBase
<
93 NamespaceI
> PtrBaseTraitsType
;
96 /*---------------------------------------------------------------------*/
97 /*! \name Constants */
100 static Int32
const Namespace
= NamespaceI
;
103 /*========================= PROTECTED ===============================*/
107 /*---------------------------------------------------------------------*/
108 /*! \name Constructors */
111 PointerMFieldCommon(void );
112 PointerMFieldCommon(const Self
&source
);
113 explicit PointerMFieldCommon(const UInt32 initSize
);
116 /*---------------------------------------------------------------------*/
117 /*! \name Destructor */
120 ~PointerMFieldCommon(void);
123 /*---------------------------------------------------------------------*/
124 /*! \name Store Interface */
128 value_type
ptrStoreGet(const size_type index
) const;
129 value_type
ptrStoreGet( PtrStoreItType pos
) const;
130 value_type
ptrStoreGet( PtrStoreConstItType pos
) const;
132 /*---------------------------------------------------------------------*/
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
,
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 /*---------------------------------------------------------------------*/
158 void ptrStoreReplace(const size_type index
,
159 const_value pNewObj
);
160 void ptrStoreReplace( PtrStoreItType pos
,
161 const_value pNewObj
);
163 /*---------------------------------------------------------------------*/
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 /*---------------------------------------------------------------------*/
179 void ptrStoreResize(const size_type newSize
,
180 const_value pNewObj
);
182 /*---------------------------------------------------------------------*/
185 PtrStoreItType
ptrStoreFind(const_value pObj
);
186 PtrStoreConstItType
ptrStoreFind(const_value pObj
) const;
189 /*---------------------------------------------------------------------*/
190 /*! \name Std library interface */
195 /*---------------------------------------------------------------------*/
196 /*! \name FieldDesc creation */
199 static FieldDescriptionBase
*
200 createFieldDescription (const Char8
*szFieldname
,
202 FieldEditMethod fEditMethod
,
203 FieldGetMethod fGetMethod
);
205 static FieldDescriptionBase
*
206 createIdxFieldDescription(const Char8
*szFieldname
,
208 FieldIndexEditMethod fEditMethod
,
209 FieldIndexGetMethod fGetMethod
);
212 /*---------------------------------------------------------------------*/
213 /*! \name Binary IO */
216 void copyFromBin(BinaryDataHandler
&pMem
);
219 /*---------------------------------------------------------------------*/
223 void syncWith(Self
&source
,
224 ConstFieldMaskArg syncMode
,
226 AspectOffsetStore
&oOffsets
);
229 /*========================== PRIVATE ================================*/
233 void operator =(const Self
&other
);
238 #include "OSGPointerMFieldCommon.inl"
240 #endif // _OSGPOINTERMFIELDCOMMON_H_