fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Base / FieldContainer / Fields / PointerFields / OSGChildPointerMField.inl
blobf445dab37eea393b70521b1498f34ef931e1825e
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *                 Copyright (C) 2008 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 /*-------------------------------------------------------------------------*/
42 /* ChildMFieldIterator<PtrTypeT>                                        */
43 /*-------------------------------------------------------------------------*/
45 /*-------------------------------------------------------------------------*/
46 /* Constructors                                                            */
48 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
49 ChildMFieldIterator<PtrTypeT,
50                     RefCountPolicy,
51                     iNamespace    >::ChildMFieldIterator(void) :
52      Inherited(    ),
53     _pField   (NULL)
57 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
58 ChildMFieldIterator<PtrTypeT,
59                     RefCountPolicy,
60                     iNamespace    >::ChildMFieldIterator(const Self &source) :
61      Inherited(source        ),
62     _pField   (source._pField)
66 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
67 ChildMFieldIterator<PtrTypeT,
68                     RefCountPolicy,
69                     iNamespace    >::ChildMFieldIterator(
70                         const PtrStoreItType &storeIter,
71                               MFieldType     *pField   ) :
72      Inherited(storeIter),
73     _pField   (pField   )
78 /*-------------------------------------------------------------------------*/
79 /* Destructor                                                              */
81 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
82 ChildMFieldIterator<PtrTypeT,
83                     RefCountPolicy,
84                     iNamespace    >::~ChildMFieldIterator(void)
88 /*-------------------------------------------------------------------------*/
89 /* Operators                                                               */
91 #ifndef OSG_CLEAN_FCFIELDS
92 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
93 typename ChildMFieldIterator<PtrTypeT,
94                              RefCountPolicy,
95                              iNamespace    >::reference
96 ChildMFieldIterator<PtrTypeT,
97                     RefCountPolicy,
98                     iNamespace    >::operator * (void) const
100     return reference(*this, _pField);
104 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
105 typename ChildMFieldIterator<PtrTypeT,
106                              RefCountPolicy,
107                              iNamespace    >::reference
108     ChildMFieldIterator<PtrTypeT,
109                         RefCountPolicy,
110                         iNamespace    >::operator [](
111                             const difference_type offset) const
113     return reference(*this + offset, _pField);
115 #else
116 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
117 typename ChildMFieldIterator<PtrTypeT,
118                              RefCountPolicy,
119                              iNamespace    >::const_value
120 ChildMFieldIterator<PtrTypeT,
121                     RefCountPolicy,
122                     iNamespace    >::operator * (void) const
124     return static_cast<const_value>(
125         AccessHandler::validate(this->Inherited::operator*()));
129 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
130 typename ChildMFieldIterator<PtrTypeT,
131                              RefCountPolicy,
132                              iNamespace    >::const_value
133     ChildMFieldIterator<PtrTypeT,
134                         RefCountPolicy,
135                         iNamespace    >::operator [](
136                             const difference_type offset) const
138     return reference(*this + offset, _pField);
140 #endif
143 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
144 typename ChildMFieldIterator<PtrTypeT,
145                              RefCountPolicy,
146                              iNamespace    >::Self &
147     ChildMFieldIterator<PtrTypeT,
148                         RefCountPolicy,
149                         iNamespace    >::operator ++(void)
151     this->Inherited::operator++();
153     return *this;
156 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
157 typename ChildMFieldIterator<PtrTypeT, RefCountPolicy, iNamespace>::Self
158     ChildMFieldIterator<PtrTypeT,
159                         RefCountPolicy,
160                         iNamespace    >::operator ++(int)
162     Self retVal = *this;
164     this->Inherited::operator++();
166     return retVal;
169 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
170 typename ChildMFieldIterator<PtrTypeT,
171                              RefCountPolicy,
172                              iNamespace    >::Self &
173     ChildMFieldIterator<PtrTypeT,
174                         RefCountPolicy,
175                         iNamespace    >::operator --(void)
177     this->Inherited::operator--();
179     return *this;
182 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
183 typename ChildMFieldIterator<PtrTypeT, RefCountPolicy, iNamespace>::Self
184     ChildMFieldIterator<PtrTypeT,
185                         RefCountPolicy,
186                         iNamespace    >::operator --(int)
188     Self retVal = *this;
190     this->Inherited::operator--();
192     return retVal;
195 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
196 typename ChildMFieldIterator<PtrTypeT,
197                              RefCountPolicy,
198                              iNamespace    >::Self &
199     ChildMFieldIterator<PtrTypeT,
200                         RefCountPolicy,
201                         iNamespace>::operator +=(const difference_type offset)
203     this->Inherited::operator+=(offset);
205     return *this;
208 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
209 typename ChildMFieldIterator<PtrTypeT, RefCountPolicy, iNamespace>::Self
210     ChildMFieldIterator<PtrTypeT,
211                         RefCountPolicy,
212                         iNamespace   >::operator +(
213                             const difference_type offset) const
215     Self retVal = *this;
217     return retVal += offset;
220 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
221 typename ChildMFieldIterator<PtrTypeT, RefCountPolicy, iNamespace>::Self &
222     ChildMFieldIterator<PtrTypeT,
223                         RefCountPolicy,
224                         iNamespace    >::operator -=(
225                             const difference_type offset)
227     this->Inherited::operator-=(offset);
229     return *this;
232 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
233 typename ChildMFieldIterator<PtrTypeT, RefCountPolicy, iNamespace>::Self
234     ChildMFieldIterator<PtrTypeT,
235                         RefCountPolicy,
236                         iNamespace    >::operator -(
237                             const difference_type offset) const
239     Self retVal = *this;
241     return retVal -= offset;
245 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
246 bool ChildMFieldIterator<PtrTypeT,
247                          RefCountPolicy,
248                          iNamespace    >::operator == (const Self &rhs) const
250     return *(static_cast<const Inherited *>(this)) == rhs;
253 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
254 bool ChildMFieldIterator<PtrTypeT,
255                         RefCountPolicy,
256                         iNamespace    >::operator != (const Self &rhs) const
258     return ! (*this == rhs);
261 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
262 bool ChildMFieldIterator<PtrTypeT,
263                         RefCountPolicy,
264                         iNamespace    >::operator == (
265                             const const_iterator &rhs) const
267     return *(static_cast<const Inherited *>(this)) == rhs;
270 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
271 bool ChildMFieldIterator<PtrTypeT,
272                         RefCountPolicy,
273                         iNamespace    >::operator != (
274                             const const_iterator &rhs) const
276     return ! (*this == rhs);
280 /*-------------------------------------------------------------------------*/
281 /* Base                                                                    */
283 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
284 const typename ChildMFieldIterator<PtrTypeT,
285                                    RefCountPolicy,
286                                    iNamespace    >::PtrStoreItType &
287     ChildMFieldIterator<PtrTypeT,
288                         RefCountPolicy,
289                         iNamespace    >::base(void) const
291     return *this;
295 /*-------------------------------------------------------------------------*/
296 /* Free Functions                                                          */
298 template <class PtrTypeT, class RefCountPolicyT, Int32 iNamespace>
299 typename ChildMFieldIterator<PtrTypeT,
300                              RefCountPolicyT,
301                              iNamespace      >::difference_type
302     operator-(ChildMFieldIterator<PtrTypeT,
303                                   RefCountPolicyT,
304                                   iNamespace      > const &lhs,
305               ChildMFieldIterator<PtrTypeT,
306                                   RefCountPolicyT,
307                                   iNamespace      > const &rhs )
309     return (lhs.base() - rhs.base());
312 template <class PtrTypeT, class RefCountPolicyT, Int32 iNamespace>
313 ChildMFieldIterator<PtrTypeT, RefCountPolicyT, iNamespace>
314     operator+(
315         typename ChildMFieldIterator<PtrTypeT,
316                                      RefCountPolicyT,
317                                      iNamespace      >::differece_type const offset,
318         ChildMFieldIterator<PtrTypeT,
319                             RefCountPolicyT,
320                             iNamespace               >                 const &rhs   )
322     return ChildMFieldIterator<PtrTypeT,
323                                RefCountPolicyT,
324                                iNamespace      >(rhs) += offset;
328 /*-------------------------------------------------------------------------*/
329 /* ChildMFieldConstIterator<PtrTypeT>                            */
330 /*-------------------------------------------------------------------------*/
332 /*-------------------------------------------------------------------------*/
333 /* Constructors                                                            */
335 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
336 ChildMFieldConstIterator<PtrTypeT,
337                          RefCountPolicy,
338                          iNamespace    >::ChildMFieldConstIterator(void) :
339     Inherited()
343 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
344 ChildMFieldConstIterator<PtrTypeT,
345                          RefCountPolicy,
346                          iNamespace    >::ChildMFieldConstIterator(
347                              const Self &source) :
348     Inherited(source)
352 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
353 ChildMFieldConstIterator<PtrTypeT,
354                          RefCountPolicy,
355                          iNamespace    >::ChildMFieldConstIterator(
356                              const iterator &fieldIter) :
357     Inherited(fieldIter.base())
361 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
362 ChildMFieldConstIterator<PtrTypeT,
363                          RefCountPolicy,
364                          iNamespace    >::ChildMFieldConstIterator(
365                              const PtrStoreConstItType &storeIter) :
366     Inherited(storeIter)
370 /*-------------------------------------------------------------------------*/
371 /* Destructor                                                              */
373 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
374 ChildMFieldConstIterator<PtrTypeT,
375                          RefCountPolicy,
376                          iNamespace    >::~ChildMFieldConstIterator(void)
381 /*-------------------------------------------------------------------------*/
382 /* Operators                                                               */
384 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
385 typename ChildMFieldConstIterator<PtrTypeT,
386                                   RefCountPolicy,
387                                   iNamespace    >::const_value
388     ChildMFieldConstIterator<PtrTypeT,
389                              RefCountPolicy,
390                              iNamespace    >::operator *(void) const
392     return static_cast<const_value>(
393         AccessHandler::validate(this->Inherited::operator*()));
397 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
398 typename ChildMFieldConstIterator<PtrTypeT,
399                                   RefCountPolicy,
400                                   iNamespace    >::const_value
401     ChildMFieldConstIterator<PtrTypeT,
402                              RefCountPolicy,
403                              iNamespace    >::operator [](
404                                  const difference_type offset) const
406     return *(*this + offset);
410 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
411 typename ChildMFieldConstIterator<PtrTypeT,
412                                   RefCountPolicy,
413                                   iNamespace    >::Self &
414     ChildMFieldConstIterator<PtrTypeT,
415                              RefCountPolicy,
416                              iNamespace    >::operator ++(void)
418     this->Inherited::operator++();
420     return *this;
423 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
424 typename ChildMFieldConstIterator<PtrTypeT,
425                                   RefCountPolicy,
426                                   iNamespace    >::Self
427     ChildMFieldConstIterator<PtrTypeT,
428                              RefCountPolicy,
429                              iNamespace    >::operator ++(int)
431     Self retVal = *this;
433     this->Inherited::operator++();
435     return retVal;
438 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
439 typename ChildMFieldConstIterator<PtrTypeT,
440                                   RefCountPolicy,
441                                   iNamespace    >::Self &
442     ChildMFieldConstIterator<PtrTypeT,
443                              RefCountPolicy,
444                              iNamespace    >::operator --(void)
446     this->Inherited::operator--();
448     return *this;
451 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
452 typename ChildMFieldConstIterator<PtrTypeT,
453                                   RefCountPolicy,
454                                   iNamespace    >::Self
455     ChildMFieldConstIterator<PtrTypeT,
456                              RefCountPolicy,
457                              iNamespace    >::operator --(int)
459     Self retVal = *this;
461     this->Inherited::oprator--();
463     return retVal;
466 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
467 typename ChildMFieldConstIterator<PtrTypeT,
468                                   RefCountPolicy,
469                                   iNamespace   >::Self &
470     ChildMFieldConstIterator<PtrTypeT,
471                              RefCountPolicy,
472                              iNamespace    >::operator +=(
473                                  const difference_type offset)
475     this->Inherited::operator+=(offset);
477     return *this;
480 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
481 typename ChildMFieldConstIterator<PtrTypeT,
482                                   RefCountPolicy,
483                                   iNamespace    >::Self
484     ChildMFieldConstIterator<PtrTypeT,
485                              RefCountPolicy,
486                              iNamespace    >::operator +(
487                                  const difference_type offset) const
489     Self retVal = *this;
491     return retVal += offset;
494 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
495 typename ChildMFieldConstIterator<PtrTypeT,
496                                   RefCountPolicy,
497                                   iNamespace    >::Self &
498     ChildMFieldConstIterator<PtrTypeT,
499                              RefCountPolicy,
500                              iNamespace    >::operator -=(
501                                  const difference_type offset)
503     this->Inherited::operator-=(offset);
505     return *this;
508 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
509 typename ChildMFieldConstIterator<PtrTypeT,
510                                   RefCountPolicy,
511                                   iNamespace    >::Self
512     ChildMFieldConstIterator<PtrTypeT,
513                              RefCountPolicy,
514                              iNamespace    >::operator -(
515                                  const difference_type offset) const
517     Self retVal = *this;
519     return retVal -= offset;
522 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
523 bool ChildMFieldConstIterator<PtrTypeT,
524                               RefCountPolicy,
525                               iNamespace    >::operator == (
526                                   const Self &rhs) const
528     return *(static_cast<const Inherited *>(this)) == rhs;
531 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
532 bool ChildMFieldConstIterator<PtrTypeT,
533                               RefCountPolicy,
534                               iNamespace    >::operator != (
535                                   const Self &rhs) const
537     return ! (*this == rhs);
540 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
541 bool ChildMFieldConstIterator<PtrTypeT,
542                               RefCountPolicy,
543                               iNamespace    >::operator == (
544                                   const iterator &rhs) const
546     return *(static_cast<const Inherited *>(this)) == rhs;
549 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
550 bool ChildMFieldConstIterator<PtrTypeT,
551                               RefCountPolicy,
552                               iNamespace    >::operator != (
553                                   const iterator &rhs) const
555     return ! (*this == rhs);
559 /*-------------------------------------------------------------------------*/
560 /* Base                                                                    */
562 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
563 const typename ChildMFieldConstIterator<PtrTypeT,
564                                         RefCountPolicy,
565                                         iNamespace    >::PtrStoreConstItType &
566     ChildMFieldConstIterator<PtrTypeT,
567                              RefCountPolicy,
568                              iNamespace    >::base(void) const
570     return *this;
574 /*-------------------------------------------------------------------------*/
575 /* Free Functions                                                          */
577 template <class PtrTypeT, class RefCountPolicyT, Int32 iNamespace>
578 typename ChildMFieldConstIterator<PtrTypeT,
579                                   RefCountPolicyT,
580                                   iNamespace      >::difference_type
581     operator-(ChildMFieldConstIterator<PtrTypeT,
582                                        RefCountPolicyT,
583                                        iNamespace      > const &lhs,
584               ChildMFieldConstIterator<PtrTypeT,
585                                        RefCountPolicyT,
586                                        iNamespace      > const &rhs )
588     return (lhs.base() - rhs.base());
591 template <class PtrTypeT, class RefCountPolicyT, Int32 iNamespace>
592 typename ChildMFieldConstIterator<PtrTypeT,
593                                   RefCountPolicyT,
594                                   iNamespace      >::difference_type
595     operator-(ChildMFieldIterator     <PtrTypeT,
596                                        RefCountPolicyT,
597                                        iNamespace      > const &lhs,
598               ChildMFieldConstIterator<PtrTypeT,
599                                        RefCountPolicyT,
600                                        iNamespace      > const &rhs )
602     return (lhs.base() - rhs.base());
605 template <class PtrTypeT, class RefCountPolicyT, Int32 iNamespace>
606 typename ChildMFieldConstIterator<PtrTypeT,
607                                   RefCountPolicyT,
608                                   iNamespace      >::difference_type
609     operator-(ChildMFieldConstIterator<PtrTypeT,
610                                        RefCountPolicyT,
611                                        iNamespace      > const &lhs,
612               ChildMFieldIterator     <PtrTypeT,
613                                        RefCountPolicyT,
614                                        iNamespace      > const &rhs )
616     return (lhs.base() - rhs.base());
619 template <class PtrTypeT, class RefCountPolicyT, Int32 iNamespace>
620 ChildMFieldConstIterator<PtrTypeT, RefCountPolicyT, iNamespace>
621     operator+(
622         typename ChildMFieldConstIterator<PtrTypeT,
623                                           RefCountPolicyT,
624                                           iNamespace      >::difference_type const offset,
625         ChildMFieldConstIterator<PtrTypeT,
626                                  RefCountPolicyT,
627                                  iNamespace      >                           const &rhs   )
629     return ChildMFieldConstIterator<PtrTypeT,
630                                     RefCountPolicyT,
631                                     iNamespace      >(rhs) += offset;
635 /*-------------------------------------------------------------------------*/
636 /* ChildMFieldReferenceProxy<PtrTypeT>                                  */
637 /*-------------------------------------------------------------------------*/
639 /*-------------------------------------------------------------------------*/
640 /* Constructors                                                            */
642 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
643 ChildMFieldReferenceProxy<PtrTypeT,
644                           RefCountPolicy,
645                           iNamespace    >::ChildMFieldReferenceProxy(
646                               const PtrStoreItType &storeIter,
647                                     MFieldType     *pField   ) :
648     _storeIter(storeIter),
649     _pField   (pField   )
653 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
654 ChildMFieldReferenceProxy<PtrTypeT,
655                           RefCountPolicy,
656                           iNamespace    >::ChildMFieldReferenceProxy(
657                               const Self &source) :
658     _storeIter(source._storeIter),
659     _pField   (source._pField   )
663 /*-------------------------------------------------------------------------*/
664 /* Destructor                                                              */
666 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
667 ChildMFieldReferenceProxy<PtrTypeT,
668                           RefCountPolicy,
669                           iNamespace    >::~ChildMFieldReferenceProxy(void)
673 /*-------------------------------------------------------------------------*/
674 /* Operators                                                               */
676 #ifndef OSG_DOXYGEN_IGNORE_RECOG_PROBS
677 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
678 ChildMFieldReferenceProxy<PtrTypeT,
679                           RefCountPolicy,
680                           iNamespace    >::operator
681     typename ChildMFieldReferenceProxy<PtrTypeT,
682                                        RefCountPolicy,
683                                        iNamespace    >::const_value(void) const
685     return static_cast<const_value>(AccessHandler::validate(*_storeIter));
687 #endif
689 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
690 typename ChildMFieldReferenceProxy<PtrTypeT,
691                                    RefCountPolicy,
692                                    iNamespace    >::const_value
693      ChildMFieldReferenceProxy<PtrTypeT,
694                                RefCountPolicy,
695                                iNamespace    >::operator->(void) const
697     return static_cast<const_value>(AccessHandler::validate(*_storeIter));
700 template <class PtrTypeT, typename RefCountPolicy, Int32 iNamespace> inline
701 const typename ChildMFieldReferenceProxy<PtrTypeT,
702                                          RefCountPolicy,
703                                          iNamespace    >::Self &
704     ChildMFieldReferenceProxy<PtrTypeT,
705                               RefCountPolicy,
706                               iNamespace    >::operator =(const_value newValue)
708     AccessHandler::onReplace(_pField, *_storeIter, newValue);
710     *_storeIter = newValue;
712     return *this;
716 /*-------------------------------------------------------------------------*/
717 /* ChildPointerMField<PtrTypeT,                                         */
718 /*                    NamespaceI  >                                        */
719 /*-------------------------------------------------------------------------*/
721 /*-------------------------------------------------------------------------*/
722 /* Class Type                                                              */
724 /*-------------------------------------------------------------------------*/
725 /* Constructors                                                            */
727 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
728 ChildPointerMField<PtrTypeT,
729                    RefCountPolicy,
730                    NamespaceI  >::ChildPointerMField(
731                        FieldContainer * const pParent,
732                        UInt16                 usChildFieldId,
733                        UInt16                 usParentFieldId) :
734     Inherited(pParent, usChildFieldId, usParentFieldId)
738 /*-------------------------------------------------------------------------*/
739 /* Destructor                                                              */
741 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
742 ChildPointerMField<PtrTypeT,
743                    RefCountPolicy,
744                    NamespaceI    >::~ChildPointerMField(void)
749 /*-------------------------------------------------------------------------*/
750 /* Std Library Interface                                                   */
752 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
753 void ChildPointerMField<PtrTypeT,
754                         RefCountPolicy,
755                         NamespaceI    >::copyFromBin(BinaryDataHandler &pMem)
757     Inherited::copyFromBin(pMem);
761 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
762 typename ChildPointerMField<PtrTypeT,
763                             RefCountPolicy,
764                             NamespaceI  >::iterator
765     ChildPointerMField<PtrTypeT,
766                        RefCountPolicy,
767                        NamespaceI    >::begin_nc(void)
769     return iterator(this->_ptrStore.begin(), this);
772 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
773 typename ChildPointerMField<PtrTypeT,
774                             RefCountPolicy,
775                             NamespaceI    >::iterator
776     ChildPointerMField<PtrTypeT,
777                        RefCountPolicy,
778                        NamespaceI    >::end_nc(void)
780     return iterator(this->_ptrStore.end(), this);
783 #ifndef OSG_CLEAN_FCFIELDS
784 #if 0
785     reference front_nc(void             );
786     reference back_nc (void             );
787 #endif
788 #endif
790 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
791 typename ChildPointerMField<PtrTypeT,
792                             RefCountPolicy,
793                             NamespaceI    >::iterator
794     ChildPointerMField<PtrTypeT,
795                        RefCountPolicy,
796                        NamespaceI    >::find_nc(const_value value)
798     return iterator(this->ptrStoreFind(value), this);
801 #ifndef OSG_CLEAN_FCFIELDS
802 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
803 typename ChildPointerMField<PtrTypeT,
804                             RefCountPolicy,
805                             NamespaceI  >::iterator
806     ChildPointerMField<PtrTypeT,
807                        RefCountPolicy,
808                        NamespaceI    >::begin(void)
810 #ifdef OSG_CHECK_CONST_CORRECT_FIELD_USAGE
811     BOOST_STATIC_ASSERT(sizeof(PtrTypeT) == 0);
812 #endif
814     return iterator(this->_ptrStore.begin(), this);
817 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
818 typename ChildPointerMField<PtrTypeT,
819                             RefCountPolicy,
820                             NamespaceI    >::iterator
821     ChildPointerMField<PtrTypeT,
822                        RefCountPolicy,
823                        NamespaceI    >::end(void)
825 #ifdef OSG_CHECK_CONST_CORRECT_FIELD_USAGE
826     BOOST_STATIC_ASSERT(sizeof(PtrTypeT) == 0);
827 #endif
829     return iterator(this->_ptrStore.end(), this);
832 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
833 typename ChildPointerMField<PtrTypeT,
834                             RefCountPolicy,
835                             NamespaceI    >::reverse_iterator
836     ChildPointerMField<PtrTypeT,
837                        RefCountPolicy,
838                        NamespaceI    >::rbegin(void)
840 #ifdef OSG_CHECK_CONST_CORRECT_FIELD_USAGE
841     BOOST_STATIC_ASSERT(sizeof(PtrTypeT) == 0);
842 #endif
844     return reverse_iterator(this->end());
847 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
848 typename ChildPointerMField<PtrTypeT,
849                             RefCountPolicy,
850                             NamespaceI    >::reverse_iterator
851     ChildPointerMField<PtrTypeT,
852                        RefCountPolicy,
853                        NamespaceI    >::rend(void)
855 #ifdef OSG_CHECK_CONST_CORRECT_FIELD_USAGE
856     BOOST_STATIC_ASSERT(sizeof(PtrTypeT) == 0);
857 #endif
859     return reverse_iterator(this->begin());
861 #endif
863 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
864 typename ChildPointerMField<PtrTypeT,
865                             RefCountPolicy,
866                             NamespaceI  >::const_iterator
867     ChildPointerMField<PtrTypeT,
868                        RefCountPolicy,
869                        NamespaceI    >::begin(void) const
871     return const_iterator(this->_ptrStore.begin());
874 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
875 typename ChildPointerMField<PtrTypeT,
876                             RefCountPolicy,
877                             NamespaceI  >::const_iterator
878     ChildPointerMField<PtrTypeT,
879                        RefCountPolicy,
880                        NamespaceI    >::end(void) const
882     return const_iterator(this->_ptrStore.end());
885 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
886 typename ChildPointerMField<PtrTypeT,
887                             RefCountPolicy,
888                             NamespaceI    >::const_reverse_iterator
889     ChildPointerMField<PtrTypeT,
890                        RefCountPolicy,
891                        NamespaceI  >::rbegin(void) const
893     return const_reverse_iterator(this->end());
896 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
897 typename ChildPointerMField<PtrTypeT,
898                             RefCountPolicy,
899                             NamespaceI  >::const_reverse_iterator
900     ChildPointerMField<PtrTypeT,
901                        RefCountPolicy,
902                        NamespaceI    >::rend(void) const
904     return const_reverse_iterator(this->begin());
908 #ifndef OSG_CLEAN_FCFIELDS
909 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
910 typename ChildPointerMField<PtrTypeT,
911                             RefCountPolicy,
912                             NamespaceI    >::reference
913     ChildPointerMField<PtrTypeT,
914                        RefCountPolicy,
915                        NamespaceI    >::front(void)
917 #ifdef OSG_CHECK_CONST_CORRECT_FIELD_USAGE
918     BOOST_STATIC_ASSERT(sizeof(PtrTypeT) == 0);
919 #endif
921     return reference(this->_ptrStore.begin(), this);
924 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
925 typename ChildPointerMField<PtrTypeT,
926                             RefCountPolicy,
927                             NamespaceI    >::reference
928     ChildPointerMField<PtrTypeT,
929                        RefCountPolicy,
930                        NamespaceI    >::back(void)
932 #ifdef OSG_CHECK_CONST_CORRECT_FIELD_USAGE
933     BOOST_STATIC_ASSERT(sizeof(PtrTypeT) == 0);
934 #endif
936     return reference(this->editRawStore().end() - 1, this);
938 #endif
940 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
941 typename ChildPointerMField<PtrTypeT,
942                             RefCountPolicy,
943                             NamespaceI  >::const_value
944     ChildPointerMField<PtrTypeT,
945                        RefCountPolicy,
946                        NamespaceI    >::front(void) const
948     return static_cast<const_value>(this->ptrStoreGet(this->_ptrStore.begin()));
952 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
953 typename ChildPointerMField<PtrTypeT,
954                             RefCountPolicy,
955                             NamespaceI    >::const_value
956     ChildPointerMField<PtrTypeT,
957                        RefCountPolicy,
958                        NamespaceI    >::back(void) const
960     return static_cast<const_value>(
961         this->ptrStoreGet(this->_ptrStore.end() - 1));
967 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
968 typename ChildPointerMField<PtrTypeT,
969                             RefCountPolicy,
970                             NamespaceI    >::iterator
971     ChildPointerMField<PtrTypeT,
972                        RefCountPolicy,
973                        NamespaceI    >::insert(iterator    pos,
974                                                const_value value)
976     return iterator(this->ptrStoreInsert(pos.base(), value), this);
979 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
980 void ChildPointerMField<PtrTypeT,
981                         RefCountPolicy,
982                         NamespaceI     >::insert(iterator    pos,
983                                                  size_type   n,
984                                                  const_value value)
986     this->ptrStoreInsert(pos, n, value);
989 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI>
990 template <class InputIteratorT                                        > inline
991 void ChildPointerMField<PtrTypeT,
992                         RefCountPolicy,
993                         NamespaceI  >::insert(iterator       pos,
994                                               InputIteratorT first,
995                                               InputIteratorT last)
997     this->ptrStoreInsert(pos, first, last);
1000 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1001 void ChildPointerMField<PtrTypeT,
1002                         RefCountPolicy,
1003                         NamespaceI    >::erase(size_type index)
1005     return this->ptrStoreErase(index);
1008 #ifndef OSG_CLEAN_FCFIELDS
1009 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1010 typename ChildPointerMField<PtrTypeT,
1011                             RefCountPolicy,
1012                             NamespaceI    >::iterator
1013     ChildPointerMField<PtrTypeT,
1014                        RefCountPolicy,
1015                        NamespaceI    >::erase(iterator pos)
1017     return iterator(this->ptrStoreErase(pos.base()), this);
1020 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1021 typename ChildPointerMField<PtrTypeT,
1022                             RefCountPolicy,
1023                             NamespaceI    >::iterator
1024     ChildPointerMField<PtrTypeT,
1025                        RefCountPolicy,
1026                        NamespaceI    >::erase(
1027         iterator first, iterator last)
1029     return iterator(this->ptrStoreErase(first.base(), last.base()), this);
1031 #endif
1033 #ifndef OSG_CLEAN_FCFIELDS
1034 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1035 typename ChildPointerMField<PtrTypeT,
1036                             RefCountPolicy,
1037                             NamespaceI    >::iterator
1038     ChildPointerMField<PtrTypeT,
1039                        RefCountPolicy,
1040                        NamespaceI    >::find(const_value value)
1042 #ifdef OSG_CHECK_CONST_CORRECT_FIELD_USAGE
1043     BOOST_STATIC_ASSERT(sizeof(PtrTypeT) == 0);
1044 #endif
1046     return iterator(this->ptrStoreFind(value), this);
1048 #endif
1050 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1051 typename ChildPointerMField<PtrTypeT,
1052                             RefCountPolicy,
1053                             NamespaceI    >::const_iterator
1054     ChildPointerMField<PtrTypeT,
1055                        RefCountPolicy,
1056                        NamespaceI    >::find(const_value value) const
1058     return const_iterator(this->ptrStoreFind(value),
1059                           this                     );
1063 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1064 void ChildPointerMField<PtrTypeT,
1065                         RefCountPolicy,
1066                         NamespaceI    >::push_back(const_value value)
1068     this->ptrStoreAppend(value);
1071 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1072 void ChildPointerMField<PtrTypeT,
1073                         RefCountPolicy,
1074                         NamespaceI    >::resize(size_t      newSize,
1075                                                 const_value value  )
1077     this->ptrStoreResize(newSize, value);
1080 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1081 void ChildPointerMField<PtrTypeT,
1082                         RefCountPolicy,
1083                         NamespaceI    >::reserve(size_type newSize)
1085     this->_ptrStore.reserve(newSize);
1088 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1089 void ChildPointerMField<PtrTypeT,
1090                         RefCountPolicy,
1091                         NamespaceI    >::clear(void)
1093     this->ptrStoreClear();
1097 #ifdef OSG_1_COMPAT
1098 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1099 void ChildPointerMField<PtrTypeT,
1100                         RefCountPolicy,
1101                         NamespaceI    >::addValue(const_value value)
1103     this->ptrStoreAppend(value);
1105 #endif
1108 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1109 void ChildPointerMField<PtrTypeT,
1110                         RefCountPolicy,
1111                         NamespaceI    >::assign(size_type   newSize,
1112                                                 const_value value  )
1114     this->ptrStoreClear();
1116     for(size_type i = 0; i < newSize; ++i)
1117         this->ptrStoreAppend(value);
1120 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI>
1121 template <class InputIteratorT                                        > inline
1122 void ChildPointerMField<PtrTypeT,
1123                         RefCountPolicy,
1124                         NamespaceI    >::assign(InputIteratorT first,
1125                                                 InputIteratorT last)
1127     this->ptrStoreAssign(first, last);
1131 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1132 void ChildPointerMField<PtrTypeT,
1133                         RefCountPolicy,
1134                         NamespaceI    >::replace(size_type   uiIdx,
1135                                                  const_value value)
1137     this->ptrStoreReplace(uiIdx, value);
1140 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1141 void ChildPointerMField<PtrTypeT,
1142                         RefCountPolicy,
1143                         NamespaceI    >::replace(iterator    pos,
1144                                                  const_value value)
1146     this->ptrStoreReplace(pos.base(), value);
1150 /*-------------------------------------------------------------------------*/
1151 /* Index Operator                                                          */
1153 #ifndef OSG_CLEAN_FCFIELDS
1154 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1155 typename ChildPointerMField<PtrTypeT,
1156                             RefCountPolicy,
1157                             NamespaceI  >::reference
1158     ChildPointerMField<PtrTypeT,
1159                        RefCountPolicy,
1160                        NamespaceI    >::operator [](const size_type index)
1162 #ifdef OSG_CHECK_CONST_CORRECT_FIELD_USAGE
1163     BOOST_STATIC_ASSERT(sizeof(PtrTypeT) == 0);
1164 #endif
1166     return reference(this->_ptrStore.begin() + index, this);
1168 #endif
1170 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1171 typename ChildPointerMField<PtrTypeT,
1172                             RefCountPolicy,
1173                             NamespaceI  >::const_value
1174     ChildPointerMField<PtrTypeT,
1175                        RefCountPolicy,
1176                        NamespaceI  >::operator [](const size_type index) const
1178     return static_cast<const_value>(this->ptrStoreGet(index));
1182 #ifdef OSG_MT_CPTR_ASPECT
1183 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI> inline
1184 void ChildPointerMField<PtrTypeT,
1185                        RefCountPolicy,
1186                        NamespaceI  >::syncWith(Self               &source,
1187                                                ConstFieldMaskArg   syncMode,
1188                                                UInt32              uiSyncInfo,
1189                                                AspectOffsetStore  &oOffsets  )
1191     Inherited::syncWith(source, syncMode, uiSyncInfo, oOffsets);
1193 #endif
1195 /*-------------------------------------------------------------------------*/
1196 /* Assignment                                                              */
1198 #if 0
1200 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI>
1201 inline void
1202     ChildPointerMField<PtrTypeT,
1203                                RefCountPolicy,
1204                        NamespaceI  >::setValues(Self const &source)
1206     this->assign(source.begin(), source.end());
1209 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI>
1210 inline typename ChildPointerMField<PtrTypeT,
1211                                RefCountPolicy,
1212                                    NamespaceI  >::Self &
1213     ChildPointerMField<PtrTypeT,
1214                                RefCountPolicy,
1215                        NamespaceI  >::operator=(Self const &source)
1217     this->setValues(source);
1219     return *this;
1222 /*-------------------------------------------------------------------------*/
1223 /* Value Access                                                            */
1225 template <class PtrTypeT, typename RefCountPolicy, Int32 NamespaceI>
1226 inline typename ChildPointerMField<PtrTypeT,
1227                                RefCountPolicy,
1228                                    NamespaceI  >::ValueStoreType const &
1229     ChildPointerMField<PtrTypeT,
1230                                RefCountPolicy,
1231                        NamespaceI  >::getValues(void) const
1233     return this->template getStore<ValueType>();
1235 #endif
1237 OSG_END_NAMESPACE