changed: gcc8 base update
[opensg.git] / Source / System / FieldContainer / Misc / OSGSceneGraphUtils.h
blobf4e7194f23cc6ef440c5d9f8d3b3fd4577f9e7a0
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 _OSGSCENEGRAPHUTILS_H_
40 #define _OSGSCENEGRAPHUTILS_H_
42 #include "OSGConfig.h"
43 #include "OSGFieldContainer.h"
44 #include "OSGAction.h"
46 #include <iosfwd>
47 #include <map>
49 #include <boost/bind.hpp>
51 OSG_BEGIN_NAMESPACE
53 //---------------------------------------------------------------------------
54 // SceneGraphPrinter
55 //---------------------------------------------------------------------------
57 /*! \ingroup GrpSystemFieldContainerUtils
58 \ingroup GrpLibOSGSystem
59 \nohierarchy
62 class OSG_SYSTEM_DLLMAPPING SceneGraphPrinter
64 /*========================== PUBLIC =================================*/
66 public:
68 /*---------------------------------------------------------------------*/
69 /*! \name Types */
70 /*! \{ */
72 typedef SceneGraphPrinter Self;
74 typedef boost::function<void (SceneGraphPrinter *,
75 NodeCore * )> CorePrintFunction;
77 /*! \} */
78 /*---------------------------------------------------------------------*/
79 /*! \name Constructors/Destructor */
80 /*! \{ */
82 SceneGraphPrinter(Node *root);
84 /*! \} */
85 /*---------------------------------------------------------------------*/
86 /*! \name Printing */
87 /*! \{ */
89 void printDownTree(std::ostream &os);
90 void printUpTree (std::ostream &os);
92 /*! \} */
93 /*---------------------------------------------------------------------*/
94 /*! \name Core Print Function */
95 /*! \{ */
97 void addPrintFunc(const FieldContainerType &fcTpye,
98 const CorePrintFunction &printFunc);
99 void subPrintFunc(const FieldContainerType &fcTpye );
101 void incIndent (void);
102 void decIndent (void);
103 std::ostream &indentStream(void);
104 std::ostream &getStream (void);
105 Node* getCurrNode (void);
107 /*! \} */
108 /*========================= PROTECTED ===============================*/
110 protected:
112 typedef std::map<UInt32, CorePrintFunction> PrintFuncMap;
113 typedef PrintFuncMap::iterator PrintFuncMapIt;
114 typedef PrintFuncMap::const_iterator PrintFuncMapConstIt;
116 Node *_pRoot;
117 Node *_pCurrNode;
118 std::ostream *_pStream;
119 UInt32 _indent;
120 PrintFuncMap _printFuncMap;
122 Action::ResultE traverseEnter(Node *node );
123 Action::ResultE traverseLeave(Node *node, Action::ResultE res);
125 /*=========================== PRIVATE ===============================*/
127 private:
129 SceneGraphPrinter(const SceneGraphPrinter &other);
130 void operator =(const SceneGraphPrinter &rhs);
133 /*! \ingroup GrpBaseFieldContainerNodes
136 template<class CoreT>
137 void collectCoresByType(Node *pRoot,
138 std::vector<CoreT *> &result);
140 OSG_END_NAMESPACE
142 #include "OSGSceneGraphUtils.inl"
144 #endif // _OSGSCENEGRAPHUTILS_H_