changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / Base / FieldContainer / Misc / OSGFieldContainerUtils.h
blob2ba47696b399f7f288550cb43b13481d6882ce5e
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 _OSGFIELDCONTAINERUTILS_H_
40 #define _OSGFIELDCONTAINERUTILS_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGConfig.h"
46 #include "OSGBaseTypes.h"
47 #include "OSGFieldContainerMFields.h"
49 #include <iosfwd>
50 #include <map>
52 OSG_BEGIN_NAMESPACE
54 /*! \ingroup GrpSystemFieldContainerUtils
57 OSG_BASE_DLLMAPPING
58 bool compareContainerEqual(const FieldContainer *lhs,
59 const FieldContainer *rhs,
60 bool ignoreAttachments = true,
61 bool compareIdentity = false);
63 //---------------------------------------------------------------------------
64 // MemoryConsumption
65 //---------------------------------------------------------------------------
67 /*! \ingroup GrpSystemFieldContainerUtils
68 \ingroup GrpLibOSGSystem
69 \nohierarchy
72 class OSG_BASE_DLLMAPPING MemoryConsumption
74 public:
76 typedef std::pair<SizeT, UInt32 > MemCountPair;
77 typedef std::map <UInt32, MemCountPair> TypeMemMap;
78 typedef TypeMemMap::iterator TypeMemMapIt;
79 typedef TypeMemMap::const_iterator TypeMemMapConstIt;
81 void scan (void );
82 void print(std::ostream &os, bool ignoreProto = true) const;
84 TypeMemMapConstIt beginMap (void) const;
85 TypeMemMapConstIt endMap (void) const;
87 TypeMemMapConstIt beginAccumMap(void) const;
88 TypeMemMapConstIt endAccumMap (void) const;
90 private:
92 TypeMemMap _memMap;
95 class ControlFindNamedElemInterface
97 public:
99 ControlFindNamedElemInterface(void);
100 virtual ~ControlFindNamedElemInterface(void);
102 virtual BitVector excludeFields(void) const = 0;
105 #if 0
106 struct FieldPathEntry;
107 #endif
109 /*! \ingroup GrpSystemFieldContainerUtils
112 typedef boost::function<
113 FieldContainer * (const Char8 *szName)> ContainerResolver;
115 #if 0
116 /*! \ingroup GrpSystemFieldContainerUtils
119 OSG_BASE_DLLMAPPING
120 void splitFieldPath( std::vector<FieldPathEntry> &vSplitPath,
121 const Char8 *szFieldPath);
123 /*! \ingroup GrpSystemFieldContainerUtils
126 OSG_BASE_DLLMAPPING
127 FieldContainer *resolveFieldPath(std::vector<FieldPathEntry> &vSplitPath,
128 FieldContainer *pRoot );
129 #endif
131 /*! \ingroup GrpSystemFieldContainerUtils
134 OSG_BASE_DLLMAPPING
135 FieldContainer *resolveFieldPath(const Char8 *szNodeName,
136 ContainerResolver oResolver );
138 /*! \ingroup GrpSystemFieldContainerUtils
141 OSG_BASE_DLLMAPPING
142 FieldContainer *findNamedComponent( FieldContainer *pCnt,
143 const Char8 *szName);
145 /*---------------------------------------------------------------------*/
146 /* Container Utils, from OpenSGToolbox, Author: David Kabala */
148 OSG_BASE_DLLMAPPING
149 FieldContainer *getFieldContainer(const std::string &szTypeName,
150 const std::string &szName);
152 OSG_BASE_DLLMAPPING
153 FieldContainer *getFieldContainer(const FieldContainerType *pType,
154 const std::string &szName);
156 OSG_BASE_DLLMAPPING
157 FieldContainer *getFieldContainer(const std::string &szName);
160 OSG_BASE_DLLMAPPING
161 bool isFieldContentDerivedFrom(const FieldType &oFieldType,
162 const FieldContainerType *pFCType);
164 OSG_BASE_DLLMAPPING
165 const FieldContainerType *getFieldContainerTypeFromPtrType(
166 const DataType &oType);
168 OSG_BASE_DLLMAPPING
169 const FieldContainerType *getClosestAncestor(
170 const FieldContainerType *pType,
171 MFUnrecFieldContainerPtr::const_iterator begin,
172 MFUnrecFieldContainerPtr::const_iterator end);
174 OSG_BASE_DLLMAPPING
175 std::vector<FieldContainer *> getAllContainersByDerivedType(
176 const FieldContainerType *pType);
179 #if 0
180 OSG_BASE_DLLMAPPING
181 std::vector<FieldContainer *> getAllFieldContainers (
182 const std::string &szName);
184 OSG_BASE_DLLMAPPING
185 std::vector<FieldContainer *> getAllContainersByType(
186 const FieldContainerType *pType);
187 #endif
189 OSG_END_NAMESPACE
191 #endif // _OSGFIELDCONTAINERUTILS_H_