1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2003 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 \*---------------------------------------------------------------------------*/
42 GetSFieldHandle<SFChunkBlockPtrMap>::GetSFieldHandle(
43 const GetSFieldHandle &source) :
50 GetSFieldHandle<SFChunkBlockPtrMap>::GetSFieldHandle(
51 const SFChunkBlockPtrMap *pField,
52 const FieldDescriptionBase *pDescription,
53 FieldContainer *pContainer ) :
55 Inherited(pField, pDescription, pContainer)
60 bool GetSFieldHandle<SFChunkBlockPtrMap>::isPointerField(void) const
66 bool GetSFieldHandle<SFChunkBlockPtrMap>::empty(void)
68 bool returnValue = true;
70 SFChunkBlockPtrMap const *pLhs =
71 static_cast<SFChunkBlockPtrMap const *>(_pField);
75 returnValue = pLhs->getValue().empty();
82 void GetSFieldHandle<SFChunkBlockPtrMap>::pushValueToStream(
85 FWARNING(("illegal pushValueToStream called for %s\n",
86 this->getName().c_str()));
91 void GetSFieldHandle<SFChunkBlockPtrMap>::pushSizeToStream(OutStream &str) const
93 FWARNING(("illegal pushSizeToStream called for %s\n",
94 this->getName().c_str()));
99 bool GetSFieldHandle<SFChunkBlockPtrMap>::equal(Base::Ptr rhs) const
101 Ptr pOther = boost::dynamic_pointer_cast<GetSFieldHandle>(rhs);
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);
118 SFChunkBlockPtrMap const *
119 GetSFieldHandle<SFChunkBlockPtrMap>::operator ->(void)
121 return static_cast<SFChunkBlockPtrMap const *>(_pField);
125 SFChunkBlockPtrMap const &
126 GetSFieldHandle<SFChunkBlockPtrMap>::operator * (void)
128 return *(static_cast<SFChunkBlockPtrMap const *>(_pField));
131 /*---------------------------------------------------------------------*/
134 EditSFieldHandle<SFChunkBlockPtrMap>::EditSFieldHandle(
135 const EditSFieldHandle &source) :
138 _pContainer(source._pContainer),
139 _fAddMethod(source._fAddMethod)
144 EditSFieldHandle<SFChunkBlockPtrMap>::EditSFieldHandle(
145 SFChunkBlockPtrMap *pField,
146 const FieldDescriptionBase *pDescription,
147 FieldContainer *pContainer ) :
159 bool EditSFieldHandle<SFChunkBlockPtrMap>::isPointerField(void) const
165 bool EditSFieldHandle<SFChunkBlockPtrMap>::empty(void)
167 bool returnValue = true;
169 SFChunkBlockPtrMap *pLhs = static_cast<SFChunkBlockPtrMap *>(_pField);
173 returnValue = pLhs->getValue().empty();
180 void EditSFieldHandle<SFChunkBlockPtrMap>::pushValueToStream(
181 OutStream &str) const
183 FWARNING(("illegal pushValueToStream called for %s\n",
184 this->getName().c_str()));
189 void EditSFieldHandle<SFChunkBlockPtrMap>::pushSizeToStream(
190 OutStream &str) const
192 FWARNING(("illegal pushSizeToStream called for %s\n",
193 this->getName().c_str()));
198 bool EditSFieldHandle<SFChunkBlockPtrMap>::equal(Base::Ptr rhs) const
200 Ptr pOther = boost::dynamic_pointer_cast<EditSFieldHandle>(rhs);
207 SFChunkBlockPtrMap *pLhs =
208 static_cast<SFChunkBlockPtrMap *>( _pField);
210 SFChunkBlockPtrMap *pRhs =
211 static_cast<SFChunkBlockPtrMap *>(pOther->_pField);
213 return (*pLhs) == (*pRhs);
217 void EditSFieldHandle<SFChunkBlockPtrMap>::setAddMethod(
220 _fAddMethod = fMethod;
224 void EditSFieldHandle<SFChunkBlockPtrMap>::pushValueFromCString(
227 FWARNING(("illegal pushValueFromCString called for %s\n",
228 this->getName().c_str()));
233 void EditSFieldHandle<SFChunkBlockPtrMap>::copyValues(
234 GetFieldHandlePtr source) const
236 FWARNING(("illegal copyValues called for %s\n",
237 this->getName().c_str()));
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)
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)
259 ChunkBlock *att = mapIt->second;
260 KeyType uiBinding = mapIt->first;
264 _fAddMethod(att, uiBinding);