1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 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 _OSGSHAREPTRGRAPHOP_H_
40 #define _OSGSHAREPTRGRAPHOP_H_
50 #include "OSGGraphOp.h"
51 #include "OSGUtilDef.h"
56 /*! \ingroup GrpUtilGraphOp
57 \ingroup GrpLibOSGUtil
60 class OSG_UTIL_DLLMAPPING SharePtrGraphOp
: public GraphOp
62 /*========================== PUBLIC =================================*/
66 /*---------------------------------------------------------------------*/
70 typedef GraphOp Inherited
;
71 typedef SharePtrGraphOp Self
;
73 OSG_GEN_INTERNAL_MEMOBJPTR(SharePtrGraphOp
);
76 /*---------------------------------------------------------------------*/
77 /*! \name Class Get */
80 static const char *getClassname(void) { return "SharePtrGraphOp"; };
83 /*---------------------------------------------------------------------*/
84 /*! \name Constructors */
87 static ObjTransitPtr
create(void);
89 virtual GraphOpTransitPtr
clone (void);
92 /*---------------------------------------------------------------------*/
93 /*! \name Main methods */
96 bool traverse(Node
*root
);
99 /*---------------------------------------------------------------------*/
100 /*! \name Parameters */
103 void setParams(const std::string params
);
105 void setIncludes(const std::string
&includes
);
106 void setExcludes(const std::string
&excludes
);
108 std::string
usage(void);
112 /*========================= PROTECTED ===============================*/
116 /*---------------------------------------------------------------------*/
117 /*! \name Destructors */
120 SharePtrGraphOp(const char* name
= "SharePtr");
121 virtual ~SharePtrGraphOp(void );
124 /*========================== PRIVATE ================================*/
128 virtual Action::ResultE
traverseEnter(Node
* const node
);
129 virtual Action::ResultE
traverseLeave(Node
* const node
,
130 Action::ResultE res
);
132 typedef std::set
<UInt32
> FCIdSet
;
133 typedef FCIdSet::iterator FCIdSetIt
;
134 typedef FCIdSet::const_iterator FCIdSetConstIt
;
136 typedef std::set
<FieldContainerUnrecPtr
> FCSet
;
137 typedef FCSet::iterator FCSetIt
;
139 typedef std::map
<UInt32
, FCSet
> FCTypeMap
;
140 typedef FCTypeMap::iterator FCTypeMapIt
;
142 typedef std::map
<UInt32
, UInt32
> ShareCount
;
143 typedef ShareCount::iterator ShareCountIt
;
145 FieldContainer
*shareFC(FieldContainer
*fc
);
147 bool checkInSet (UInt32 fcTypeId
, const FCIdSet
&idSet
);
148 bool checkIncludeSet(UInt32 fcTypeId
);
149 bool checkExcludeSet(UInt32 fcTypeId
);
156 // FCIdSet _visitedSet;
158 ShareCount _shareCount
;
163 OSG_GEN_MEMOBJPTR(SharePtrGraphOp
);
167 #endif /* _OSGSHAREPTRGRAPHOP_H_ */