changed: gcc8 base update
[opensg.git] / Source / Base / FieldContainer / Fields / OSGAttachmentMapSFields.inl
blobb6ebddbeb7daf9f9838afc4d01abdf50db149bd6
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 OSG_BEGIN_NAMESPACE
41 /*---------------------------------------------------------------------*/
43 inline
44 GetSFieldHandle<SFAttachmentPtrMap>::GetSFieldHandle(
45     const GetSFieldHandle &source) :
47     Inherited(source)
51 inline
52 GetSFieldHandle<SFAttachmentPtrMap>::GetSFieldHandle(
53     const SFAttachmentPtrMap   *pField, 
54     const FieldDescriptionBase *pDescription,
55           FieldContainer       *pContainer  ) :
57     Inherited(pField, pDescription, pContainer)
61 inline
62 bool 
63    GetSFieldHandle<SFAttachmentPtrMap>::isPointerField(void) const
65     return true;
68 inline
69 bool GetSFieldHandle<SFAttachmentPtrMap>::empty(void)
71     bool returnValue = true;
73     SFAttachmentPtrMap const *pLhs = 
74         static_cast<SFAttachmentPtrMap const *>(_pField);
76     if(pLhs != NULL)
77     {
78         returnValue = pLhs->getValue().empty();
79     }
81     return returnValue;
84 inline
85 void GetSFieldHandle<SFAttachmentPtrMap>::pushValueToStream(
86     OutStream &str) const
88     FWARNING(("illegal pushValueToStream called for %s\n", 
89               this->getName().c_str()));
90     OSG_ASSERT(false);
93 inline
94 void GetSFieldHandle<SFAttachmentPtrMap>::pushSizeToStream(
95     OutStream &str) const
97     FWARNING(("illegal pushSizeToStream called for %s\n", 
98               this->getName().c_str()));
99     OSG_ASSERT(false);
102 inline
103 bool GetSFieldHandle<SFAttachmentPtrMap>::equal(
104     Base::Ptr rhs) const
106     Ptr pOther = boost::dynamic_pointer_cast<GetSFieldHandle>(rhs);
108     if(pOther == NULL)
109     {
110         return false;
111     }
113     SFAttachmentPtrMap const *pLhs = 
114         static_cast<SFAttachmentPtrMap const *>(        _pField);
116     SFAttachmentPtrMap const *pRhs = 
117         static_cast<SFAttachmentPtrMap const *>(pOther->_pField);
119     return (*pLhs) == (*pRhs);
122 inline
123 SFAttachmentPtrMap const *
124     GetSFieldHandle<SFAttachmentPtrMap>::operator ->(void)
126     return static_cast<SFAttachmentPtrMap const *>(_pField);
129 inline
130 SFAttachmentPtrMap const &
131     GetSFieldHandle<SFAttachmentPtrMap>::operator * (void)
133     return *(static_cast<SFAttachmentPtrMap const *>(_pField));
136 /*---------------------------------------------------------------------*/
138 inline
139 EditSFieldHandle<SFAttachmentPtrMap>::EditSFieldHandle(
140     const EditSFieldHandle &source) :
142      Inherited     (source                ),
143     _pContainer    (source._pContainer    ),
144     _fAddMethod    (source._fAddMethod    ),
145     _fReplaceMethod(source._fReplaceMethod)
149 inline
150 EditSFieldHandle<SFAttachmentPtrMap>::EditSFieldHandle(      
151           SFAttachmentPtrMap   *pField, 
152     const FieldDescriptionBase *pDescription,
153           FieldContainer       *pContainer  ) :
155      Inherited     (pField, 
156                     pDescription,
157                     pContainer  ),
158     _pContainer    (NULL        ),
159     _fAddMethod    (NULL        ),
160     _fReplaceMethod(NULL        )
165 inline
166 bool EditSFieldHandle<SFAttachmentPtrMap>::isPointerField(void) const
168     return true;
171 inline
172 bool EditSFieldHandle<SFAttachmentPtrMap>::empty(void)
174     bool returnValue = true;
176     SFAttachmentPtrMap *pLhs = static_cast<SFAttachmentPtrMap *>(_pField);
178     if(pLhs != NULL)
179     {
180         returnValue = pLhs->getValue().empty();
181     }
183     return returnValue;
186 inline
187 void EditSFieldHandle<SFAttachmentPtrMap>::pushValueToStream(
188     OutStream &str) const
190     FWARNING(("illegal pushValueToStream called for %s\n", 
191               this->getName().c_str()));
192     OSG_ASSERT(false);
195 inline
196 void EditSFieldHandle<SFAttachmentPtrMap>::pushSizeToStream(
197     OutStream &str) const
199     FWARNING(("illegal pushSizeToStream called for %s\n", 
200               this->getName().c_str()));
201     OSG_ASSERT(false);
204 inline
205 bool EditSFieldHandle<SFAttachmentPtrMap>::equal(
206     Base::Ptr rhs) const
208     Ptr pOther = boost::dynamic_pointer_cast<EditSFieldHandle>(rhs);
210     if(pOther == NULL)
211     {
212         return false;
213     }
215     SFAttachmentPtrMap *pLhs = 
216         static_cast<SFAttachmentPtrMap *>(        _pField);
218     SFAttachmentPtrMap *pRhs = 
219         static_cast<SFAttachmentPtrMap *>(pOther->_pField);
221     return (*pLhs) == (*pRhs);
224 inline
225 void EditSFieldHandle<SFAttachmentPtrMap>::setAddMethod(
226     AddMethod fMethod)
228     _fAddMethod = fMethod;
231 inline
232 void EditSFieldHandle<SFAttachmentPtrMap>::setReplaceMethod(
233     ReplaceMethod fMethod)
235     _fReplaceMethod = fMethod;
238 inline
239 void EditSFieldHandle<SFAttachmentPtrMap>::pushValueFromCString(
240     const Char8 *str)
242     FWARNING(("illegal pushValueFromCString called for %s\n", 
243               this->getName().c_str()));
244     OSG_ASSERT(false);
247 inline
248 void EditSFieldHandle<SFAttachmentPtrMap>::copyValues(
249     GetFieldHandlePtr source) const
251     FWARNING(("illegal copyValues called for %s\n", 
252               this->getName().c_str()));
253     OSG_ASSERT(false);
256 inline
257 void EditSFieldHandle<SFAttachmentPtrMap>::shareValues(
258     GetFieldHandlePtr source) const
260     SFAttachmentPtrMap::GetHandlePtr pGetHandle = 
261         boost::dynamic_pointer_cast<
262             SFAttachmentPtrMap::GetHandle>(source);
264     if(pGetHandle == NULL || pGetHandle->isValid() == false)
265         return;
267     const SFAttachmentPtrMap &pAttMap = **pGetHandle;
269     AttachmentMap::const_iterator mapIt  = pAttMap.getValue().begin();
270     AttachmentMap::const_iterator mapEnd = pAttMap.getValue().end();
272     for(; mapIt != mapEnd; ++mapIt)
273     {
274         Attachment *att       = mapIt->second;
275         UInt16      uiBinding = UInt16(mapIt->first &
276                                        0x0000FFFF    );
278         if(_fAddMethod)
279         {
280             _fAddMethod(att, uiBinding);
281         }
282     }
285 OSG_END_NAMESPACE