Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-04 09:16:26

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_ComparisonTool_HeaderFile
0017 #define _TDF_ComparisonTool_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 class TDF_DataSet;
0025 class TDF_IDFilter;
0026 class TDF_RelocationTable;
0027 class TDF_Label;
0028 
0029 //! This class provides services to compare sets of
0030 //! information. The use of this tool can works after
0031 //! a copy, acted by a CopyTool.
0032 //!
0033 //! * Compare(...) compares two DataSet and returns the result.
0034 //!
0035 //! * SourceUnbound(...) builds the difference between
0036 //! a relocation dictionary and a source set of information.
0037 //!
0038 //! * TargetUnbound(...) does the same between a
0039 //! relocation dictionary and a target set of information.
0040 //!
0041 //! * Cut(aDataSet, anLabel) removes a set of attributes.
0042 //!
0043 //! * IsSelfContained(...) returns true if all the
0044 //! labels of the attributes of the given DataSet are
0045 //! descendant of the given label.
0046 class TDF_ComparisonTool
0047 {
0048 public:
0049   DEFINE_STANDARD_ALLOC
0050 
0051   //! Compares <aSourceDataSet> with <aTargetDataSet>,
0052   //! updating <aRelocationTable> with labels and
0053   //! attributes found in both sets.
0054   Standard_EXPORT static void Compare(const occ::handle<TDF_DataSet>&         aSourceDataSet,
0055                                       const occ::handle<TDF_DataSet>&         aTargetDataSet,
0056                                       const TDF_IDFilter&                     aFilter,
0057                                       const occ::handle<TDF_RelocationTable>& aRelocationTable);
0058 
0059   //! Finds from <aRefDataSet> all the keys not bound
0060   //! into <aRelocationTable> and put them into
0061   //! <aDiffDataSet>. Returns True if the difference
0062   //! contains at least one key. (A key is a source
0063   //! object).
0064   //!
0065   //! <anOption> may take the following values:
0066   //! 1 : labels treatment only;
0067   //! 2 : attributes treatment only (default value);
0068   //! 3 : both labels & attributes treatment.
0069   Standard_EXPORT static bool SourceUnbound(
0070     const occ::handle<TDF_DataSet>&         aRefDataSet,
0071     const occ::handle<TDF_RelocationTable>& aRelocationTable,
0072     const TDF_IDFilter&                     aFilter,
0073     const occ::handle<TDF_DataSet>&         aDiffDataSet,
0074     const int                               anOption = 2);
0075 
0076   //! Subtracts from <aRefDataSet> all the items bound
0077   //! into <aRelocationTable>. The result is put into
0078   //! <aDiffDataSet>. Returns True if the difference
0079   //! contains at least one item. (An item is a target
0080   //! object).
0081   //!
0082   //! <anOption> may take the following values:
0083   //! 1 : labels treatment only;
0084   //! 2 : attributes treatment only (default value);
0085   //! 3 : both labels & attributes treatment.
0086   Standard_EXPORT static bool TargetUnbound(
0087     const occ::handle<TDF_DataSet>&         aRefDataSet,
0088     const occ::handle<TDF_RelocationTable>& aRelocationTable,
0089     const TDF_IDFilter&                     aFilter,
0090     const occ::handle<TDF_DataSet>&         aDiffDataSet,
0091     const int                               anOption = 2);
0092 
0093   //! Removes attributes from <aDataSet>.
0094   Standard_EXPORT static void Cut(const occ::handle<TDF_DataSet>& aDataSet);
0095 
0096   //! Returns true if all the labels of <aDataSet> are
0097   //! descendant of <aLabel>.
0098   Standard_EXPORT static bool IsSelfContained(const TDF_Label&                aLabel,
0099                                               const occ::handle<TDF_DataSet>& aDataSet);
0100 
0101 private:
0102   //! Internal comparison method used by Compare(...).
0103   Standard_EXPORT static void Compare(const TDF_Label&                        aSrcLabel,
0104                                       const TDF_Label&                        aTrgLabel,
0105                                       const occ::handle<TDF_DataSet>&         aSourceDataSet,
0106                                       const occ::handle<TDF_DataSet>&         aTargetDataSet,
0107                                       const TDF_IDFilter&                     aFilter,
0108                                       const occ::handle<TDF_RelocationTable>& aRelocationTable);
0109 
0110   //! Internal function used by SourceUnbound() and
0111   //! TargetUnbound().
0112   Standard_EXPORT static bool Unbound(const occ::handle<TDF_DataSet>&         aRefDataSet,
0113                                       const occ::handle<TDF_RelocationTable>& aRelocationTable,
0114                                       const TDF_IDFilter&                     aFilter,
0115                                       const occ::handle<TDF_DataSet>&         aDiffDataSet,
0116                                       const int                               anOption,
0117                                       const bool                              theSource);
0118 };
0119 
0120 #endif // _TDF_ComparisonTool_HeaderFile