changed: gcc8 base update
[opensg.git] / Source / Base / FieldContainer / Fields / OSGAttachmentMapSFields.h
blobbcb73d2af68fb2d3884b10f48e62adf3ef2fa192
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2003 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 _OSGATTACHMENTMAPSFIELDS_H_
40 #define _OSGATTACHMENTMAPSFIELDS_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGSField.h"
46 #include "OSGAttachmentMapFieldTraits.h"
47 #include "OSGTypeBasePredicates.h"
48 #include "OSGReflexiveContainerTypePredicates.h"
50 OSG_BEGIN_NAMESPACE
52 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54 /*! \ingroup GrpBaseFieldContainerFieldSFields */
55 typedef SField<AttachmentMap> SFAttachmentPtrMap;
57 #else // these are the doxygen hacks
59 /*! \ingroup GrpBaseFieldContainerFieldSFields \ingroup GrpLibOSGBase */
60 struct SFAttachmentPtrMap : public SField<AttachmentMap> {};
62 #endif // these are the doxygen hacks
64 /*! \ingroup GrpBaseFieldContainerFields
65 \ingroup GrpLibOSGBase
68 template<>
69 class OSG_BASE_DLLMAPPING GetSFieldHandle<SFAttachmentPtrMap> :
70 public GetMapFieldHandle
72 /*========================= PROTECTED ===============================*/
74 protected:
76 typedef GetMapFieldHandle Inherited;
77 typedef GetFieldHandle Base;
79 /*========================== PUBLIC =================================*/
81 public:
83 typedef boost::shared_ptr<GetSFieldHandle> Ptr;
85 /*---------------------------------------------------------------------*/
87 GetSFieldHandle(const GetSFieldHandle &source);
88 GetSFieldHandle(const SFAttachmentPtrMap *pField,
89 const FieldDescriptionBase *pDescription,
90 FieldContainer *pContainer );
92 /*---------------------------------------------------------------------*/
94 virtual const FieldType &getType (void) const;
95 virtual bool isPointerField(void) const;
97 /*---------------------------------------------------------------------*/
99 virtual void traverse(TraverseCallback oCallBack);
101 /*---------------------------------------------------------------------*/
103 virtual bool empty (void );
104 virtual void flatten(MapList &vList);
105 virtual void flatten(ContainerList &vList);
107 /*---------------------------------------------------------------------*/
109 virtual void pushValueToStream(OutStream &str) const;
110 virtual void pushSizeToStream (OutStream &str) const;
112 /*---------------------------------------------------------------------*/
114 virtual bool equal(Base::Ptr rhs) const;
116 /*---------------------------------------------------------------------*/
118 SFAttachmentPtrMap const * operator ->(void);
119 SFAttachmentPtrMap const & operator * (void);
122 /*! \ingroup GrpBaseFieldContainerFields
123 \ingroup GrpLibOSGBase
126 template<>
127 class OSG_BASE_DLLMAPPING
128 EditSFieldHandle<SFAttachmentPtrMap> : public EditMapFieldHandle
130 /*========================= PROTECTED ===============================*/
132 private:
134 void operator =(const EditSFieldHandle &other);
136 /*========================= PROTECTED ===============================*/
138 protected:
140 typedef EditMapFieldHandle Inherited;
141 typedef EditFieldHandle Base;
143 typedef boost::function<void(Attachment * const,
144 UInt32 )> AddMethod;
146 typedef boost::function<void(Attachment * const,
147 Attachment * const)> ReplaceMethod;
149 /*========================== PUBLIC =================================*/
151 FieldContainer *_pContainer;
152 AddMethod _fAddMethod;
153 ReplaceMethod _fReplaceMethod;
155 public:
157 typedef boost::shared_ptr<EditSFieldHandle> Ptr;
159 /*---------------------------------------------------------------------*/
161 EditSFieldHandle(const EditSFieldHandle &source );
162 EditSFieldHandle( SFAttachmentPtrMap *pField,
163 const FieldDescriptionBase *pDescription,
164 FieldContainer *pContainer );
166 /*---------------------------------------------------------------------*/
168 virtual const FieldType &getType (void) const;
169 virtual bool isPointerField(void) const;
171 /*---------------------------------------------------------------------*/
173 virtual void add ( FieldContainer * rhs,
174 const std::string & szBindings);
176 virtual void replaceByObj( Attachment * const pOld,
177 Attachment * const pNew );
179 /*---------------------------------------------------------------------*/
181 virtual void traverse(TraverseCallback oCallBack);
183 /*---------------------------------------------------------------------*/
185 virtual bool empty (void );
186 virtual void flatten(MapList &vList);
187 virtual void flatten(ContainerList &vList);
189 /*---------------------------------------------------------------------*/
191 virtual bool loadFromBin( BinaryDataHandler *pMem,
192 UInt32 uiNumElements,
193 bool hasBindingInfo,
194 std::vector<UInt16> &vBindings,
195 std::vector<UInt32> &vIds );
197 virtual void fillFrom (const std::vector<UInt16> &vBindings,
198 const std::vector<UInt32> &vIds,
199 const std::map<UInt32, UInt32> &vIdMap );
201 /*---------------------------------------------------------------------*/
203 virtual void pushValueToStream(OutStream &str) const;
204 virtual void pushSizeToStream (OutStream &str) const;
206 /*---------------------------------------------------------------------*/
208 void setAddMethod (AddMethod fMethod);
209 void setReplaceMethod(ReplaceMethod fMethod);
211 virtual bool equal (Base::Ptr rhs ) const;
213 /*---------------------------------------------------------------------*/
215 virtual void pushValueFromCString(const Char8 *str );
217 virtual void copyValues ( GetFieldHandlePtr source) const;
218 virtual void shareValues ( GetFieldHandlePtr source) const;
220 /*---------------------------------------------------------------------*/
222 virtual void cloneValues(
223 GetFieldHandlePtr pSrc,
224 const TypePtrVector &shareTypes = TypePtrVector(),
225 const TypePtrVector &ignoreTypes = TypePtrVector(),
226 const TypeIdVector &shareGroupIds = TypeIdVector (),
227 const TypeIdVector &ignoreGroupIds = TypeIdVector ()) const;
231 OSG_END_NAMESPACE
233 #include "OSGAttachmentMapSFields.inl"
235 #endif /* _OSGATTACHMENTMAPSFIELDS_H_ */