changed: gcc8 base update
[opensg.git] / Source / Base / FieldContainer / Connector / OSGFieldConnector.h
blob33e5c013d052eef1edc57e66f1792a2a4c874b44
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 #ifndef _OSGFIELDCONNECTOR_H_
40 #define _OSGFIELDCONNECTOR_H_
42 #include "OSGBaseDef.h"
44 OSG_BEGIN_NAMESPACE
46 class Field;
48 /*! \ingroup GrpBaseFieldContainerConnector
49 \ingroup GrpLibOSGBase
52 class OSG_BASE_DLLMAPPING BasicFieldConnector
54 public:
56 BasicFieldConnector(BitVector bSrcMask,
57 BitVector bDstMask);
59 virtual ~BasicFieldConnector(void);
61 void setTargetContainer(FieldContainer *pDst);
63 bool match(BitVector fieldMask);
65 bool match( BitVector bSrcMask,
66 const FieldContainer *pDst,
67 BitVector bDstMask);
69 virtual void process(void) = 0;
71 FieldContainer *getDst(void) const;
73 virtual BasicFieldConnector *clone(const Field *pSrcField,
74 BitVector bSrcMask,
75 Field *pDstField,
76 BitVector bDstMask) = 0;
78 protected:
80 BitVector _bSrcMask;
81 BitVector _bDstMask;
83 FieldContainer *_pDst;
85 private:
87 BasicFieldConnector(const BasicFieldConnector &other);
88 void operator =(const BasicFieldConnector &rhs);
91 /*! \ingroup GrpBaseFieldContainerConnector
92 \ingroup GrpLibOSGBase
95 template <class SrcFieldT, class DstFieldT>
96 class SFieldConnector : public BasicFieldConnector
98 typedef BasicFieldConnector Inherited;
99 typedef SFieldConnector<SrcFieldT, DstFieldT> Self;
101 public:
103 SFieldConnector(const SrcFieldT *pSrcField,
104 BitVector bSrcMask,
105 DstFieldT *pDstField,
106 BitVector bDstMask);
108 virtual ~SFieldConnector(void);
110 virtual void process(void);
112 virtual BasicFieldConnector *clone(const Field *pSrcField,
113 BitVector bSrcMask,
114 Field *pDstField,
115 BitVector bDstMask);
117 protected:
119 const SrcFieldT *_pSrcField;
120 DstFieldT *_pDstField;
122 private:
124 SFieldConnector(const SFieldConnector &other);
125 void operator =(const SFieldConnector &rhs);
128 /*! \ingroup GrpBaseFieldContainerConnector
129 \ingroup GrpLibOSGBase
132 template <class SrcFieldT, class DstFieldT>
133 class MFieldConnector : public BasicFieldConnector
135 typedef BasicFieldConnector Inherited;
136 typedef MFieldConnector<SrcFieldT, DstFieldT> Self;
138 public:
140 MFieldConnector(const SrcFieldT *pSrcField,
141 BitVector bSrcMask,
142 DstFieldT *pDstField,
143 BitVector bDstMask);
145 virtual ~MFieldConnector(void);
147 virtual void process(void);
149 virtual BasicFieldConnector *clone(const Field *pSrcField,
150 BitVector bSrcMask,
151 Field *pDstField,
152 BitVector bDstMask);
154 protected:
156 const SrcFieldT *_pSrcField;
157 DstFieldT *_pDstField;
159 private:
161 MFieldConnector(const MFieldConnector &other);
162 void operator =(const MFieldConnector &rhs);
165 OSG_BASE_DLLMAPPING
166 bool addConnection( OSG::AttachmentContainer *pSrcContainer,
167 const OSG::Char8 *szSrcName,
168 OSG::FieldContainer *pDstContainer,
169 const OSG::Char8 *szDstName );
171 OSG_BASE_DLLMAPPING
172 bool subConnection( OSG::AttachmentContainer *pSrcContainer,
173 const OSG::Char8 *szSrcName,
174 OSG::FieldContainer *pDstContainer,
175 const OSG::Char8 *szDstName);
178 OSG_END_NAMESPACE
180 #include "OSGFieldConnector.inl"
182 #endif