fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / GraphOp / OSGVerifyGraphOp.h
blob5b9428c32dcd4a61fe2410e4bc5d4c8c6666f55d
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 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 \*---------------------------------------------------------------------------*/
40 #ifndef _OSGVERIFYGRAPHOP_H_
41 #define _OSGVERIFYGRAPHOP_H_
42 #ifdef __sgi
43 #pragma once
44 #endif
46 #include "OSGGraphOp.h"
47 #include "OSGUtilDef.h"
48 #include "OSGGeometry.h"
50 OSG_BEGIN_NAMESPACE
52 /*! \ingroup GrpUtilGraphOp
53 \ingroup GrpLibOSGUtil
56 class OSG_UTIL_DLLMAPPING VerifyGraphOp : public GraphOp
58 /*========================== PUBLIC =================================*/
60 public:
62 /*---------------------------------------------------------------------*/
63 /*! \name Types */
64 /*! \{ */
66 typedef GraphOp Inherited;
67 typedef VerifyGraphOp Self;
69 OSG_GEN_INTERNAL_MEMOBJPTR(VerifyGraphOp);
71 /*! \} */
72 /*---------------------------------------------------------------------*/
73 /*! \name Classname */
74 /*! \{ */
76 static const char *getClassname(void) { return "VerifyGraphOp"; };
78 /*! \} */
79 /*---------------------------------------------------------------------*/
80 /*! \name Constructors */
81 /*! \{ */
83 static ObjTransitPtr create(bool repair = true,
84 bool verbose = true );
86 virtual GraphOpTransitPtr clone (void );
88 /*! \} */
89 /*---------------------------------------------------------------------*/
90 /*! \name Main methods */
91 /*! \{ */
93 virtual bool traverse(Node *node);
95 void setVerbose(bool verbose);
96 void setRepair (bool repair );
98 void setParams(const std::string params);
99 std::string usage ( void );
101 /*! \} */
102 /*========================= PROTECTED ===============================*/
104 protected:
106 Action::ResultE traverseEnter(Node * const node);
107 Action::ResultE traverseLeave(Node * const node, Action::ResultE res);
109 /*---------------------------------------------------------------------*/
110 /*! \name Destructors */
111 /*! \{ */
113 VerifyGraphOp( bool repair = true,
114 bool verbose = false,
115 const char *name = "Verify");
116 virtual ~VerifyGraphOp(void );
118 /*! \} */
119 /*========================== PRIVATE ================================*/
121 private:
123 /* Some internal helper methods */
125 Action::ResultE verifyGeometry(Node * const node);
126 bool verifyIndexMap(Geometry *geo, bool &repair);
127 bool repairGeometry(void);
129 /* Configuration variables */
131 bool _repair;
132 bool _verbose;
134 /* Traversal variables */
136 UInt32 _numErrors; /**< The running total of errors found. */
138 std::vector<OSG::Geometry *> _corruptedGeos;
139 std::vector<OSG::Node *> _corruptedNodes;
143 OSG_GEN_MEMOBJPTR(VerifyGraphOp);
146 OSG_END_NAMESPACE
148 #endif /* _OSGVERIFYGRAPHOP_H_ */