1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 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 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGCONNECTORATTACHMENT_H_
40 #define _OSGCONNECTORATTACHMENT_H_
45 #include "OSGConnectorAttachmentBase.h"
49 class BasicFieldConnector
;
51 /*! \ingroup GrpBaseFieldContainerConnector
52 \ingroup GrpLibOSGBase
56 class OSG_BASE_DLLMAPPING ConnectorAttachment
:
57 public ConnectorAttachmentBase
61 /*========================== PUBLIC =================================*/
65 typedef ConnectorAttachmentBase Inherited
;
66 typedef ConnectorAttachment Self
;
68 /*---------------------------------------------------------------------*/
72 virtual void changed(ConstFieldMaskArg whichField
,
77 /*---------------------------------------------------------------------*/
81 void addConnection (BasicFieldConnector
*pConnector
);
83 void processChanged (FieldContainer
*pObj
,
87 void targetDestroyed(FieldContainer
*pObj
,
92 /*---------------------------------------------------------------------*/
96 bool hasConnectionTo (const FieldContainer
*pDst
) const;
97 void removeConnectionTo(const FieldContainer
*pDst
);
100 /*---------------------------------------------------------------------*/
104 void removeConnections( BitVector bSrcMask
,
105 const FieldContainer
*pDst
,
109 /*---------------------------------------------------------------------*/
113 virtual void dump( UInt32 uiIndent
= 0,
114 const BitVector bvFlags
= 0) const;
117 /*========================= PROTECTED ===============================*/
121 typedef std::vector
<BasicFieldConnector
*> ConnectionStore
;
122 typedef std::map
<FieldContainer
*,
123 UInt32
> ConnectionCount
;
125 // Variables should all be in ConnectorAttachmentBase.
127 ConnectionStore _vConnections
;
129 /*---------------------------------------------------------------------*/
130 /*! \name Constructors */
133 ConnectorAttachment(void);
134 ConnectorAttachment(const ConnectorAttachment
&source
);
137 /*---------------------------------------------------------------------*/
138 /*! \name Destructors */
141 virtual ~ConnectorAttachment(void);
144 /*---------------------------------------------------------------------*/
148 virtual bool unlinkParent(FieldContainer
* const pParent
,
149 UInt16
const parentFieldId
);
151 virtual void resolveLinks(void );
154 /*---------------------------------------------------------------------*/
158 static void initMethod(InitPhase ePhase
);
161 /*---------------------------------------------------------------------*/
165 void countConnections(ConnectionCount
&mCount
);
168 /*========================== PRIVATE ================================*/
172 friend class FieldContainer
;
173 friend class ConnectorAttachmentBase
;
175 // prohibit default functions (move to 'public' if you need one)
176 void operator =(const ConnectorAttachment
&source
);
179 typedef ConnectorAttachment
*ConnectorAttachmentP
;
182 void addConnector(OSG::AttachmentContainer
*pContainer
,
183 OSG::BasicFieldConnector
*pConn
);
186 void subConnector(OSG::AttachmentContainer
*pSrcContainer
,
187 OSG::BitVector bSrcMask
,
188 OSG::FieldContainer
*pDstContainer
,
189 OSG::BitVector bDstMask
);
193 #include "OSGConnectorAttachmentBase.inl"
194 #include "OSGConnectorAttachment.inl"
196 #endif /* _OSGCONNECTORATTACHMENT_H_ */