changed: gcc8 base update
[opensg.git] / Source / System / State / Base / OSGChunkBlockMapFields.inl
blob92e952d74c29ad458589d6c126514041ff644a4f
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 inline
42 GetSFieldHandle<SFChunkBlockPtrMap>::GetSFieldHandle(
43     const GetSFieldHandle &source) :
45     Inherited(source)
49 inline
50 GetSFieldHandle<SFChunkBlockPtrMap>::GetSFieldHandle(
51     const SFChunkBlockPtrMap   *pField, 
52     const FieldDescriptionBase *pDescription,
53           FieldContainer       *pContainer  ) :
55     Inherited(pField, pDescription, pContainer)
59 inline
60 bool GetSFieldHandle<SFChunkBlockPtrMap>::isPointerField(void) const
62     return true;
65 inline
66 bool GetSFieldHandle<SFChunkBlockPtrMap>::empty(void)
68     bool returnValue = true;
70     SFChunkBlockPtrMap const *pLhs = 
71         static_cast<SFChunkBlockPtrMap const *>(_pField);
73     if(pLhs != NULL)
74     {
75         returnValue = pLhs->getValue().empty();
76     }
78     return returnValue;
81 inline
82 void GetSFieldHandle<SFChunkBlockPtrMap>::pushValueToStream(
83     OutStream &str) const
85     FWARNING(("illegal pushValueToStream called for %s\n", 
86               this->getName().c_str()));
87     OSG_ASSERT(false);
90 inline
91 void GetSFieldHandle<SFChunkBlockPtrMap>::pushSizeToStream(OutStream &str) const
93     FWARNING(("illegal pushSizeToStream called for %s\n", 
94               this->getName().c_str()));
95     OSG_ASSERT(false);
98 inline
99 bool GetSFieldHandle<SFChunkBlockPtrMap>::equal(Base::Ptr rhs) const
101     Ptr pOther = boost::dynamic_pointer_cast<GetSFieldHandle>(rhs);
103     if(pOther == NULL)
104     {
105         return false;
106     }
108     SFChunkBlockPtrMap const *pLhs = 
109         static_cast<SFChunkBlockPtrMap const *>(        _pField);
111     SFChunkBlockPtrMap const *pRhs = 
112         static_cast<SFChunkBlockPtrMap const *>(pOther->_pField);
114     return (*pLhs) == (*pRhs);
117 inline
118 SFChunkBlockPtrMap const *
119     GetSFieldHandle<SFChunkBlockPtrMap>::operator ->(void)
121     return static_cast<SFChunkBlockPtrMap const *>(_pField);
124 inline
125 SFChunkBlockPtrMap const &
126     GetSFieldHandle<SFChunkBlockPtrMap>::operator * (void)
128     return *(static_cast<SFChunkBlockPtrMap const *>(_pField));
131 /*---------------------------------------------------------------------*/
133 inline
134 EditSFieldHandle<SFChunkBlockPtrMap>::EditSFieldHandle(
135     const EditSFieldHandle &source) :
137      Inherited (source            ),
138     _pContainer(source._pContainer),
139     _fAddMethod(source._fAddMethod)
143 inline
144 EditSFieldHandle<SFChunkBlockPtrMap>::EditSFieldHandle(      
145           SFChunkBlockPtrMap   *pField, 
146     const FieldDescriptionBase *pDescription,
147           FieldContainer       *pContainer  ) :
149      Inherited (pField, 
150                 pDescription,
151                 pContainer  ),
152     _pContainer(NULL        ),
153     _fAddMethod(NULL        )
158 inline
159 bool EditSFieldHandle<SFChunkBlockPtrMap>::isPointerField(void) const
161     return true;
164 inline
165 bool EditSFieldHandle<SFChunkBlockPtrMap>::empty(void)
167     bool returnValue = true;
169     SFChunkBlockPtrMap *pLhs = static_cast<SFChunkBlockPtrMap *>(_pField);
171     if(pLhs != NULL)
172     {
173         returnValue = pLhs->getValue().empty();
174     }
176     return returnValue;
179 inline
180 void EditSFieldHandle<SFChunkBlockPtrMap>::pushValueToStream(
181     OutStream &str) const
183     FWARNING(("illegal pushValueToStream called for %s\n", 
184               this->getName().c_str()));
185     OSG_ASSERT(false);
188 inline
189 void EditSFieldHandle<SFChunkBlockPtrMap>::pushSizeToStream(
190     OutStream &str) const
192     FWARNING(("illegal pushSizeToStream called for %s\n", 
193               this->getName().c_str()));
194     OSG_ASSERT(false);
197 inline
198 bool EditSFieldHandle<SFChunkBlockPtrMap>::equal(Base::Ptr rhs) const
200     Ptr pOther = boost::dynamic_pointer_cast<EditSFieldHandle>(rhs);
202     if(pOther == NULL)
203     {
204         return false;
205     }
207     SFChunkBlockPtrMap *pLhs = 
208         static_cast<SFChunkBlockPtrMap *>(        _pField);
210     SFChunkBlockPtrMap *pRhs = 
211         static_cast<SFChunkBlockPtrMap *>(pOther->_pField);
213     return (*pLhs) == (*pRhs);
216 inline
217 void EditSFieldHandle<SFChunkBlockPtrMap>::setAddMethod(
218     AddMethod fMethod)
220     _fAddMethod = fMethod;
223 inline
224 void EditSFieldHandle<SFChunkBlockPtrMap>::pushValueFromCString(
225     const Char8 *str)
227     FWARNING(("illegal pushValueFromCString called for %s\n", 
228               this->getName().c_str()));
229     OSG_ASSERT(false);
232 inline
233 void EditSFieldHandle<SFChunkBlockPtrMap>::copyValues(
234     GetFieldHandlePtr source) const
236     FWARNING(("illegal copyValues called for %s\n", 
237               this->getName().c_str()));
238     OSG_ASSERT(false);
241 inline
242 void EditSFieldHandle<SFChunkBlockPtrMap>::shareValues(
243     GetFieldHandlePtr source) const
245     SFChunkBlockPtrMap::GetHandlePtr pGetHandle = 
246         boost::dynamic_pointer_cast<
247             SFChunkBlockPtrMap::GetHandle>(source);
249     if(pGetHandle == NULL || pGetHandle->isValid() == false)
250         return;
252     const SFChunkBlockPtrMap &pMatMap = **pGetHandle;
254     ChunkBlockMap::const_iterator mapIt  = pMatMap.getValue().begin();
255     ChunkBlockMap::const_iterator mapEnd = pMatMap.getValue().end();
257     for(; mapIt != mapEnd; ++mapIt)
258     {
259         ChunkBlock *att       = mapIt->second;
260         KeyType     uiBinding = mapIt->first;
262         if(_fAddMethod)
263         {
264             _fAddMethod(att, uiBinding);
265         }
266     }
269 OSG_END_NAMESPACE