changed: gcc8 base update
[opensg.git] / Source / Base / FieldContainer / Connector / OSGFieldConnector.inl
blob927c15764869641f10c3b45d666036b6d5a8bbd3
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
42 inline
43 BasicFieldConnector::BasicFieldConnector(BitVector bSrcMask,
44                                          BitVector bDstMask) :
45     _bSrcMask(bSrcMask),
46     _bDstMask(bDstMask),
47     _pDst    (NULL    )
51 inline
52 BasicFieldConnector::~BasicFieldConnector(void)
56 inline
57 void BasicFieldConnector::setTargetContainer(FieldContainer *pDst)
59     _pDst = pDst;
62 inline
63 bool BasicFieldConnector::match(BitVector fieldMask)
65     return (_bSrcMask & fieldMask) != 0;
68 inline
69 bool BasicFieldConnector::match(      BitVector       bSrcMask,
70                                 const FieldContainer *pDst,
71                                       BitVector       bDstMask)
73     bool returnValue = (_bSrcMask & bSrcMask) != 0;
75     if(pDst != NULL)
76     {
77         returnValue &= (_pDst                  == pDst) &&
78                        ((_bDstMask & bDstMask) != 0   );
79     }
81     return returnValue;
84 inline
85 FieldContainer *BasicFieldConnector::getDst(void) const
87     return _pDst;
90 template <class SrcFieldT, class DstFieldT> inline
91 SFieldConnector<SrcFieldT, DstFieldT>::SFieldConnector(
92     const SrcFieldT *pSrcField,
93           BitVector  bSrcMask,
94           DstFieldT *pDstField,
95           BitVector  bDstMask) :
97      Inherited(bSrcMask,
98                bDstMask ),
99     _pSrcField(pSrcField),
100     _pDstField(pDstField)
104 template <class SrcFieldT, class DstFieldT> inline
105 SFieldConnector<SrcFieldT, DstFieldT>::~SFieldConnector(void)
109 template <class SrcFieldT, class DstFieldT> inline
110 BasicFieldConnector *SFieldConnector<SrcFieldT, DstFieldT>::clone(
111     const Field     *pSrcField,
112           BitVector  bSrcMask,
113           Field     *pDstField,
114           BitVector  bDstMask )
116     return new Self(static_cast<const SrcFieldT *>(pSrcField),
117                     bSrcMask,
118                     static_cast<      DstFieldT *>(pDstField),
119                     bDstMask                                 );
122 template <class SrcFieldT, class DstFieldT> inline
123 MFieldConnector<SrcFieldT, DstFieldT>::MFieldConnector(
124     const SrcFieldT *pSrcField,
125           BitVector  bSrcMask,
126           DstFieldT *pDstField,
127           BitVector  bDstMask) :
129      Inherited(bSrcMask,
130                bDstMask ),
131     _pSrcField(pSrcField),
132     _pDstField(pDstField)
136 template <class SrcFieldT, class DstFieldT> inline
137 MFieldConnector<SrcFieldT, DstFieldT>::~MFieldConnector(void)
141 template <class SrcFieldT, class DstFieldT> inline
142 BasicFieldConnector *MFieldConnector<SrcFieldT, DstFieldT>::clone(
143     const Field     *pSrcField,
144           BitVector  bSrcMask,
145           Field     *pDstField,
146           BitVector  bDstMask)
148     return new Self(static_cast<const SrcFieldT *>(pSrcField),
149                     bSrcMask,
150                     static_cast<      DstFieldT *>(pDstField),
151                     bDstMask                                 );
155 OSG_END_NAMESPACE