0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / TDF / TDF_Tool.hxx
CommitLineData
42cf5bc1 1// Created by: DAUTRY Philippe
2// Copyright (c) 1997-1999 Matra Datavision
3// Copyright (c) 1999-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _TDF_Tool_HeaderFile
17#define _TDF_Tool_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_DefineAlloc.hxx>
21#include <Standard_Handle.hxx>
22
23#include <Standard_Integer.hxx>
42cf5bc1 24#include <TDF_AttributeMap.hxx>
25#include <TColStd_ListOfInteger.hxx>
26#include <Standard_CString.hxx>
27#include <TDF_LabelList.hxx>
28#include <TDF_LabelIntegerMap.hxx>
29#include <Standard_OStream.hxx>
30class TDF_Label;
31class TDF_IDFilter;
32class TCollection_AsciiString;
33class TDF_Data;
34
35
36//! This class provides general services for a data framework.
37class TDF_Tool
38{
39public:
40
41 DEFINE_STANDARD_ALLOC
42
43
44 //! Returns the number of labels of the tree,
45 //! including <aLabel>. aLabel is also included in this figure.
46 //! This information is useful in setting the size of an array.
47 Standard_EXPORT static Standard_Integer NbLabels (const TDF_Label& aLabel);
48
49 //! Returns the total number of attributes attached
50 //! to the labels dependent on the label aLabel.
51 //! The attributes of aLabel are also included in this figure.
52 //! This information is useful in setting the size of an array.
53 Standard_EXPORT static Standard_Integer NbAttributes (const TDF_Label& aLabel);
54
55 //! Returns the number of attributes of the tree,
56 //! selected by a<Filter>, including those of
57 //! <aLabel>.
58 Standard_EXPORT static Standard_Integer NbAttributes (const TDF_Label& aLabel, const TDF_IDFilter& aFilter);
59
60 //! Returns true if <aLabel> and its descendants
61 //! reference only attributes or labels attached to
62 //! themselves.
63 Standard_EXPORT static Standard_Boolean IsSelfContained (const TDF_Label& aLabel);
64
65 //! Returns true if <aLabel> and its descendants
66 //! reference only attributes or labels attached to
67 //! themselves and kept by <aFilter>.
68 Standard_EXPORT static Standard_Boolean IsSelfContained (const TDF_Label& aLabel, const TDF_IDFilter& aFilter);
69
70 //! Returns in <theAtts> the attributes having out
71 //! references.
72 //!
73 //! Caution: <theAtts> is not cleared before use!
74 Standard_EXPORT static void OutReferers (const TDF_Label& theLabel, TDF_AttributeMap& theAtts);
75
76 //! Returns in <atts> the attributes having out
77 //! references and kept by <aFilterForReferers>.
78 //! It considers only the references kept by <aFilterForReferences>.
79 //! Caution: <atts> is not cleared before use!
80 Standard_EXPORT static void OutReferers (const TDF_Label& aLabel, const TDF_IDFilter& aFilterForReferers, const TDF_IDFilter& aFilterForReferences, TDF_AttributeMap& atts);
81
82 //! Returns in <atts> the referenced attributes.
83 //! Caution: <atts> is not cleared before use!
84 Standard_EXPORT static void OutReferences (const TDF_Label& aLabel, TDF_AttributeMap& atts);
85
86 //! Returns in <atts> the referenced attributes and kept by <aFilterForReferences>.
03ca365a 87 //! It considers only the referrers kept by <aFilterForReferers>.
42cf5bc1 88 //! Caution: <atts> is not cleared before use!
89 Standard_EXPORT static void OutReferences (const TDF_Label& aLabel, const TDF_IDFilter& aFilterForReferers, const TDF_IDFilter& aFilterForReferences, TDF_AttributeMap& atts);
90
91 //! Returns the label having the same sub-entry as
92 //! <aLabel> but located as descendant as <toRoot>
93 //! instead of <fromRoot>.
94 //!
03ca365a 95 //! Example :
42cf5bc1 96 //!
97 //! aLabel = 0:3:24:7:2:7
98 //! fromRoot = 0:3:24
99 //! toRoot = 0:5
100 //! returned label = 0:5:7:2:7
101 Standard_EXPORT static void RelocateLabel (const TDF_Label& aSourceLabel, const TDF_Label& fromRoot, const TDF_Label& toRoot, TDF_Label& aTargetLabel, const Standard_Boolean create = Standard_False);
102
103 //! Returns the entry for the label aLabel in the form
104 //! of the ASCII character string anEntry containing
105 //! the tag list for aLabel.
106 Standard_EXPORT static void Entry (const TDF_Label& aLabel, TCollection_AsciiString& anEntry);
107
108 //! Returns the entry of <aLabel> as list of integers
109 //! in <aTagList>.
110 Standard_EXPORT static void TagList (const TDF_Label& aLabel, TColStd_ListOfInteger& aTagList);
111
112 //! Returns the entry expressed by <anEntry> as list
113 //! of integers in <aTagList>.
114 Standard_EXPORT static void TagList (const TCollection_AsciiString& anEntry, TColStd_ListOfInteger& aTagList);
115
116 //! Returns the label expressed by <anEntry>; creates
117 //! the label if it does not exist and if <create> is
118 //! true.
119 Standard_EXPORT static void Label (const Handle(TDF_Data)& aDF, const TCollection_AsciiString& anEntry, TDF_Label& aLabel, const Standard_Boolean create = Standard_False);
120
121 //! Returns the label expressed by <anEntry>; creates
122 //! the label if it does not exist and if <create> is
123 //! true.
124 Standard_EXPORT static void Label (const Handle(TDF_Data)& aDF, const Standard_CString anEntry, TDF_Label& aLabel, const Standard_Boolean create = Standard_False);
125
126 //! Returns the label expressed by <anEntry>; creates
127 //! the label if it does not exist and if <create> is
128 //! true.
129 Standard_EXPORT static void Label (const Handle(TDF_Data)& aDF, const TColStd_ListOfInteger& aTagList, TDF_Label& aLabel, const Standard_Boolean create = Standard_False);
130
131 //! Adds the labels of <aLabelList> to <aLabelMap> if
132 //! they are unbound, or increases their reference
133 //! counters. At the end of the process, <aLabelList>
134 //! contains only the ADDED labels.
135 Standard_EXPORT static void CountLabels (TDF_LabelList& aLabelList, TDF_LabelIntegerMap& aLabelMap);
136
137 //! Decreases the reference counters of the labels of
138 //! <aLabelList> to <aLabelMap>, and removes labels
139 //! with null counter. At the end of the process,
140 //! <aLabelList> contains only the SUPPRESSED labels.
141 Standard_EXPORT static void DeductLabels (TDF_LabelList& aLabelList, TDF_LabelIntegerMap& aLabelMap);
142
143 //! Dumps <aDF> and its labels and their attributes.
144 Standard_EXPORT static void DeepDump (Standard_OStream& anOS, const Handle(TDF_Data)& aDF);
145
146 //! Dumps <aDF> and its labels and their attributes,
147 //! if their IDs are kept by <aFilter>. Dumps also the
148 //! attributes content.
149 Standard_EXPORT static void ExtendedDeepDump (Standard_OStream& anOS, const Handle(TDF_Data)& aDF, const TDF_IDFilter& aFilter);
150
03ca365a 151 //! Dumps <aLabel>, its children and their attributes.
42cf5bc1 152 Standard_EXPORT static void DeepDump (Standard_OStream& anOS, const TDF_Label& aLabel);
153
03ca365a 154 //! Dumps <aLabel>, its children and their attributes,
42cf5bc1 155 //! if their IDs are kept by <aFilter>. Dumps also the
156 //! attributes content.
157 Standard_EXPORT static void ExtendedDeepDump (Standard_OStream& anOS, const TDF_Label& aLabel, const TDF_IDFilter& aFilter);
158
159
160
161
162protected:
163
164
165
166
167
168private:
169
170
171
172
173
174};
175
176
177
178
179
180
181
182#endif // _TDF_Tool_HeaderFile