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 \*---------------------------------------------------------------------------*/
41 /*---------------------------------------------------------------------*/
44 GetSFieldHandle<SFAttachmentPtrMap>::GetSFieldHandle(
45 const GetSFieldHandle &source) :
52 GetSFieldHandle<SFAttachmentPtrMap>::GetSFieldHandle(
53 const SFAttachmentPtrMap *pField,
54 const FieldDescriptionBase *pDescription,
55 FieldContainer *pContainer ) :
57 Inherited(pField, pDescription, pContainer)
63 GetSFieldHandle<SFAttachmentPtrMap>::isPointerField(void) const
69 bool GetSFieldHandle<SFAttachmentPtrMap>::empty(void)
71 bool returnValue = true;
73 SFAttachmentPtrMap const *pLhs =
74 static_cast<SFAttachmentPtrMap const *>(_pField);
78 returnValue = pLhs->getValue().empty();
85 void GetSFieldHandle<SFAttachmentPtrMap>::pushValueToStream(
88 FWARNING(("illegal pushValueToStream called for %s\n",
89 this->getName().c_str()));
94 void GetSFieldHandle<SFAttachmentPtrMap>::pushSizeToStream(
97 FWARNING(("illegal pushSizeToStream called for %s\n",
98 this->getName().c_str()));
103 bool GetSFieldHandle<SFAttachmentPtrMap>::equal(
106 Ptr pOther = boost::dynamic_pointer_cast<GetSFieldHandle>(rhs);
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);
123 SFAttachmentPtrMap const *
124 GetSFieldHandle<SFAttachmentPtrMap>::operator ->(void)
126 return static_cast<SFAttachmentPtrMap const *>(_pField);
130 SFAttachmentPtrMap const &
131 GetSFieldHandle<SFAttachmentPtrMap>::operator * (void)
133 return *(static_cast<SFAttachmentPtrMap const *>(_pField));
136 /*---------------------------------------------------------------------*/
139 EditSFieldHandle<SFAttachmentPtrMap>::EditSFieldHandle(
140 const EditSFieldHandle &source) :
143 _pContainer (source._pContainer ),
144 _fAddMethod (source._fAddMethod ),
145 _fReplaceMethod(source._fReplaceMethod)
150 EditSFieldHandle<SFAttachmentPtrMap>::EditSFieldHandle(
151 SFAttachmentPtrMap *pField,
152 const FieldDescriptionBase *pDescription,
153 FieldContainer *pContainer ) :
160 _fReplaceMethod(NULL )
166 bool EditSFieldHandle<SFAttachmentPtrMap>::isPointerField(void) const
172 bool EditSFieldHandle<SFAttachmentPtrMap>::empty(void)
174 bool returnValue = true;
176 SFAttachmentPtrMap *pLhs = static_cast<SFAttachmentPtrMap *>(_pField);
180 returnValue = pLhs->getValue().empty();
187 void EditSFieldHandle<SFAttachmentPtrMap>::pushValueToStream(
188 OutStream &str) const
190 FWARNING(("illegal pushValueToStream called for %s\n",
191 this->getName().c_str()));
196 void EditSFieldHandle<SFAttachmentPtrMap>::pushSizeToStream(
197 OutStream &str) const
199 FWARNING(("illegal pushSizeToStream called for %s\n",
200 this->getName().c_str()));
205 bool EditSFieldHandle<SFAttachmentPtrMap>::equal(
208 Ptr pOther = boost::dynamic_pointer_cast<EditSFieldHandle>(rhs);
215 SFAttachmentPtrMap *pLhs =
216 static_cast<SFAttachmentPtrMap *>( _pField);
218 SFAttachmentPtrMap *pRhs =
219 static_cast<SFAttachmentPtrMap *>(pOther->_pField);
221 return (*pLhs) == (*pRhs);
225 void EditSFieldHandle<SFAttachmentPtrMap>::setAddMethod(
228 _fAddMethod = fMethod;
232 void EditSFieldHandle<SFAttachmentPtrMap>::setReplaceMethod(
233 ReplaceMethod fMethod)
235 _fReplaceMethod = fMethod;
239 void EditSFieldHandle<SFAttachmentPtrMap>::pushValueFromCString(
242 FWARNING(("illegal pushValueFromCString called for %s\n",
243 this->getName().c_str()));
248 void EditSFieldHandle<SFAttachmentPtrMap>::copyValues(
249 GetFieldHandlePtr source) const
251 FWARNING(("illegal copyValues called for %s\n",
252 this->getName().c_str()));
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)
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)
274 Attachment *att = mapIt->second;
275 UInt16 uiBinding = UInt16(mapIt->first &
280 _fAddMethod(att, uiBinding);