Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:21

0001 // Created by: DAUTRY Philippe
0002 // Copyright (c) 1997-1999 Matra Datavision
0003 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _TDF_Tool_HeaderFile
0017 #define _TDF_Tool_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <TDF_AttributeMap.hxx>
0025 #include <TColStd_ListOfInteger.hxx>
0026 #include <Standard_CString.hxx>
0027 #include <TDF_LabelList.hxx>
0028 #include <TDF_LabelIntegerMap.hxx>
0029 #include <Standard_OStream.hxx>
0030 class TDF_Label;
0031 class TDF_IDFilter;
0032 class TCollection_AsciiString;
0033 class TDF_Data;
0034 
0035 
0036 //! This class provides general services for a data framework.
0037 class TDF_Tool 
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042 
0043   
0044   //! Returns the number of labels of the tree,
0045   //! including <aLabel>. aLabel is also included in this figure.
0046   //! This information is useful in setting the size of an array.
0047   Standard_EXPORT static Standard_Integer NbLabels (const TDF_Label& aLabel);
0048   
0049   //! Returns the total number of attributes attached
0050   //! to the labels dependent on the label aLabel.
0051   //! The attributes of aLabel are also included in this figure.
0052   //! This information is useful in setting the size of an array.
0053   Standard_EXPORT static Standard_Integer NbAttributes (const TDF_Label& aLabel);
0054   
0055   //! Returns the number of attributes of the tree,
0056   //! selected by a<Filter>, including those of
0057   //! <aLabel>.
0058   Standard_EXPORT static Standard_Integer NbAttributes (const TDF_Label& aLabel, const TDF_IDFilter& aFilter);
0059   
0060   //! Returns true if <aLabel> and its descendants
0061   //! reference only attributes or labels attached to
0062   //! themselves.
0063   Standard_EXPORT static Standard_Boolean IsSelfContained (const TDF_Label& aLabel);
0064   
0065   //! Returns true if <aLabel> and its descendants
0066   //! reference only attributes or labels attached to
0067   //! themselves and kept by <aFilter>.
0068   Standard_EXPORT static Standard_Boolean IsSelfContained (const TDF_Label& aLabel, const TDF_IDFilter& aFilter);
0069   
0070   //! Returns in <theAtts> the attributes having out
0071   //! references.
0072   //!
0073   //! Caution: <theAtts> is not cleared before use!
0074   Standard_EXPORT static void OutReferers (const TDF_Label& theLabel, TDF_AttributeMap& theAtts);
0075   
0076   //! Returns in <atts> the attributes having out
0077   //! references and kept by <aFilterForReferers>.
0078   //! It considers only the references kept by <aFilterForReferences>.
0079   //! Caution: <atts> is not cleared before use!
0080   Standard_EXPORT static void OutReferers (const TDF_Label& aLabel, const TDF_IDFilter& aFilterForReferers, const TDF_IDFilter& aFilterForReferences, TDF_AttributeMap& atts);
0081   
0082   //! Returns in <atts> the referenced attributes.
0083   //! Caution: <atts> is not cleared before use!
0084   Standard_EXPORT static void OutReferences (const TDF_Label& aLabel, TDF_AttributeMap& atts);
0085   
0086   //! Returns in <atts> the referenced attributes and kept by <aFilterForReferences>.
0087   //! It considers only the referrers kept by <aFilterForReferers>.
0088   //! Caution: <atts> is not cleared before use!
0089   Standard_EXPORT static void OutReferences (const TDF_Label& aLabel, const TDF_IDFilter& aFilterForReferers, const TDF_IDFilter& aFilterForReferences, TDF_AttributeMap& atts);
0090   
0091   //! Returns the label having the same sub-entry as
0092   //! <aLabel> but located as descendant as <toRoot>
0093   //! instead of <fromRoot>.
0094   //!
0095   //! Example :
0096   //!
0097   //! aLabel = 0:3:24:7:2:7
0098   //! fromRoot = 0:3:24
0099   //! toRoot = 0:5
0100   //! returned label = 0:5:7:2:7
0101   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);
0102   
0103   //! Returns the entry for the label aLabel in the form
0104   //! of the ASCII character string anEntry containing
0105   //! the tag list for aLabel.
0106   Standard_EXPORT static void Entry (const TDF_Label& aLabel, TCollection_AsciiString& anEntry);
0107   
0108   //! Returns the entry of <aLabel> as list of integers
0109   //! in <aTagList>.
0110   Standard_EXPORT static void TagList (const TDF_Label& aLabel, TColStd_ListOfInteger& aTagList);
0111   
0112   //! Returns the entry expressed by <anEntry> as list
0113   //! of integers in <aTagList>.
0114   Standard_EXPORT static void TagList (const TCollection_AsciiString& anEntry, TColStd_ListOfInteger& aTagList);
0115   
0116   //! Returns the label expressed by <anEntry>; creates
0117   //! the label if it does not exist and if <create> is
0118   //! true.
0119   Standard_EXPORT static void Label (const Handle(TDF_Data)& aDF, const TCollection_AsciiString& anEntry, TDF_Label& aLabel, const Standard_Boolean create = Standard_False);
0120   
0121   //! Returns the label expressed by <anEntry>; creates
0122   //! the label if it does not exist and if <create> is
0123   //! true.
0124   Standard_EXPORT static void Label (const Handle(TDF_Data)& aDF, const Standard_CString anEntry, TDF_Label& aLabel, const Standard_Boolean create = Standard_False);
0125   
0126   //! Returns the label expressed by <anEntry>; creates
0127   //! the label if it does not exist and if <create> is
0128   //! true.
0129   Standard_EXPORT static void Label (const Handle(TDF_Data)& aDF, const TColStd_ListOfInteger& aTagList, TDF_Label& aLabel, const Standard_Boolean create = Standard_False);
0130   
0131   //! Adds the labels of <aLabelList> to <aLabelMap> if
0132   //! they are unbound, or increases their reference
0133   //! counters. At the end of the process, <aLabelList>
0134   //! contains only the ADDED labels.
0135   Standard_EXPORT static void CountLabels (TDF_LabelList& aLabelList, TDF_LabelIntegerMap& aLabelMap);
0136   
0137   //! Decreases the reference counters of the labels of
0138   //! <aLabelList> to <aLabelMap>, and removes labels
0139   //! with null counter. At the end of the process,
0140   //! <aLabelList> contains only the SUPPRESSED labels.
0141   Standard_EXPORT static void DeductLabels (TDF_LabelList& aLabelList, TDF_LabelIntegerMap& aLabelMap);
0142   
0143   //! Dumps <aDF> and its labels and their attributes.
0144   Standard_EXPORT static void DeepDump (Standard_OStream& anOS, const Handle(TDF_Data)& aDF);
0145   
0146   //! Dumps <aDF> and its labels and their attributes,
0147   //! if their IDs are kept by <aFilter>. Dumps also the
0148   //! attributes content.
0149   Standard_EXPORT static void ExtendedDeepDump (Standard_OStream& anOS, const Handle(TDF_Data)& aDF, const TDF_IDFilter& aFilter);
0150   
0151   //! Dumps <aLabel>, its children and their attributes.
0152   Standard_EXPORT static void DeepDump (Standard_OStream& anOS, const TDF_Label& aLabel);
0153   
0154   //! Dumps <aLabel>, its children and their attributes,
0155   //! if their IDs are kept by <aFilter>. Dumps also the
0156   //! attributes content.
0157   Standard_EXPORT static void ExtendedDeepDump (Standard_OStream& anOS, const TDF_Label& aLabel, const TDF_IDFilter& aFilter);
0158 
0159 
0160 
0161 
0162 protected:
0163 
0164 
0165 
0166 
0167 
0168 private:
0169 
0170 
0171 
0172 
0173 
0174 };
0175 
0176 
0177 
0178 
0179 
0180 
0181 
0182 #endif // _TDF_Tool_HeaderFile