fixed: stay with old cmake qt link setup (policy CMP0020)
[opensg.git] / Source / System / State / Base / OSGChunkListHandlerMixin.inl
blob7ea43423a33cecfb3c0179828e7e9898bad04ba5
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 template <class Desc> inline
42 ChunkListHandlerMixin<Desc>::ListEditHandle::ListEditHandle(
43     const ListEditHandle &source) :
45     Inherited(source)
49 template <class Desc> inline
50 ChunkListHandlerMixin<Desc>::ListEditHandle::ListEditHandle(      
51           FieldT                *pField, 
52     const FieldDescriptionBase  *pDescription,
53           FieldContainer        *pContainer  ) :
55     Inherited(pField,
56               pDescription,
57               pContainer  )
62 template <class Desc> inline
63 bool ChunkListHandlerMixin<Desc>::ListEditHandle::add(
64     FieldContainer *newFC) const
66     ChunkHelper *pHelper = dynamic_cast<ChunkHelper *>(newFC);
68     if(pHelper != NULL)
69     {
70         FinalContainer *pCnt = dynamic_cast<FinalContainer *>(
71             this->_pContainer);
73         if(pCnt != NULL)
74         {
75             pCnt->addChunk( pHelper->getChunk(), pHelper->getSlot());
76         }
78         return true;
79     }
81     Inherited::add(newFC);
83     return true;
87 /*-------------------------------------------------------------------------*/
88 /*                                Set                                      */
90 /*-------------------------------------------------------------------------*/
91 /* Binary access                                                           */
93 /*-------------------------------------------------------------------------*/
94 /*                             Assignment                                  */
97 /*-------------------------------------------------------------------------*/
98 /*                            Constructors                                 */
100 template <class Desc> inline
101 ChunkListHandlerMixin<Desc>::ChunkListHandlerMixin(void) :
102     Inherited()
106 template <class Desc> inline
107 ChunkListHandlerMixin<Desc>::ChunkListHandlerMixin(
108     const ChunkListHandlerMixin &source) :
110     Inherited(source)
114 template <class Desc> inline
115 ChunkListHandlerMixin<Desc>::~ChunkListHandlerMixin(void)
119 template <class Desc> inline
120 void ChunkListHandlerMixin<Desc>::dump(      UInt32    uiIndent,
121                                        const BitVector bvFlags ) const
123     Inherited::dump(uiIndent, bvFlags);
126 template <class Desc> inline
127 EditFieldHandlePtr ChunkListHandlerMixin<Desc>::editHandleChunks(void)
129     typedef ListEditHandle    ChunksEditHandle;
130     typedef ListEditHandlePtr ChunksEditHandlePtr;
132     ChunksEditHandlePtr returnValue(
133         new ChunksEditHandle(
134              &this->_mfChunks,
135              this->getType().getFieldDesc(Self::ChunksFieldId),
136              this));
138     returnValue->setAddMethod(
139         boost::bind(&FinalContainer::pushToChunks,
140                     static_cast<FinalContainer *>(this), _1));
142     returnValue->setReplaceMethod(
143         boost::bind(&FinalContainer::replaceChunk,
144                     static_cast<FinalContainer *>(this), _1, _2));
146     this->editMField(Self::ChunksFieldMask, this->_mfChunks);
148     return returnValue;
151 /*-------------------------------------------------------------------------*/
152 /*                             Destructor                                  */
154 /*-------------------------------------------------------------------------*/
155 /*                             Assignment                                  */
157 /*-------------------------------------------------------------------------*/
158 /*                             Comparison                                  */
160 OSG_END_NAMESPACE