1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2008 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 _OSGFIELDCONTAINERUTILS_H_
40 #define _OSGFIELDCONTAINERUTILS_H_
45 #include "OSGConfig.h"
46 #include "OSGBaseTypes.h"
47 #include "OSGFieldContainerMFields.h"
54 /*! \ingroup GrpSystemFieldContainerUtils
58 bool compareContainerEqual(const FieldContainer
*lhs
,
59 const FieldContainer
*rhs
,
60 bool ignoreAttachments
= true,
61 bool compareIdentity
= false);
63 //---------------------------------------------------------------------------
65 //---------------------------------------------------------------------------
67 /*! \ingroup GrpSystemFieldContainerUtils
68 \ingroup GrpLibOSGSystem
72 class OSG_BASE_DLLMAPPING MemoryConsumption
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
;
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;
95 class ControlFindNamedElemInterface
99 ControlFindNamedElemInterface(void);
100 virtual ~ControlFindNamedElemInterface(void);
102 virtual BitVector
excludeFields(void) const = 0;
106 struct FieldPathEntry
;
109 /*! \ingroup GrpSystemFieldContainerUtils
112 typedef boost::function
<
113 FieldContainer
* (const Char8
*szName
)> ContainerResolver
;
116 /*! \ingroup GrpSystemFieldContainerUtils
120 void splitFieldPath( std::vector
<FieldPathEntry
> &vSplitPath
,
121 const Char8
*szFieldPath
);
123 /*! \ingroup GrpSystemFieldContainerUtils
127 FieldContainer
*resolveFieldPath(std::vector
<FieldPathEntry
> &vSplitPath
,
128 FieldContainer
*pRoot
);
131 /*! \ingroup GrpSystemFieldContainerUtils
135 FieldContainer
*resolveFieldPath(const Char8
*szNodeName
,
136 ContainerResolver oResolver
);
138 /*! \ingroup GrpSystemFieldContainerUtils
142 FieldContainer
*findNamedComponent( FieldContainer
*pCnt
,
143 const Char8
*szName
);
145 /*---------------------------------------------------------------------*/
146 /* Container Utils, from OpenSGToolbox, Author: David Kabala */
149 FieldContainer
*getFieldContainer(const std::string
&szTypeName
,
150 const std::string
&szName
);
153 FieldContainer
*getFieldContainer(const FieldContainerType
*pType
,
154 const std::string
&szName
);
157 FieldContainer
*getFieldContainer(const std::string
&szName
);
161 bool isFieldContentDerivedFrom(const FieldType
&oFieldType
,
162 const FieldContainerType
*pFCType
);
165 const FieldContainerType
*getFieldContainerTypeFromPtrType(
166 const DataType
&oType
);
169 const FieldContainerType
*getClosestAncestor(
170 const FieldContainerType
*pType
,
171 MFUnrecFieldContainerPtr::const_iterator begin
,
172 MFUnrecFieldContainerPtr::const_iterator end
);
175 std::vector
<FieldContainer
*> getAllContainersByDerivedType(
176 const FieldContainerType
*pType
);
181 std::vector
<FieldContainer
*> getAllFieldContainers (
182 const std::string
&szName
);
185 std::vector
<FieldContainer
*> getAllContainersByType(
186 const FieldContainerType
*pType
);
191 #endif // _OSGFIELDCONTAINERUTILS_H_