1 // Created by: DAUTRY Philippe
2 // Copyright (c) 1997-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _TDF_ComparisonTool_HeaderFile
17 #define _TDF_ComparisonTool_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <Standard_Integer.hxx>
27 class TDF_RelocationTable;
31 //! This class provides services to compare sets of
32 //! information. The use of this tool can works after
33 //! a copy, acted by a CopyTool.
35 //! * Compare(...) compares two DataSet and returns
38 //! * SourceUnbound(...) builds the difference between
39 //! a relocation dictionnary and a source set of
42 //! * TargetUnbound(...) does the same between a
43 //! relocation dictionnary and a target set of
46 //! * Cut(aDataSet, anLabel) removes a set of
49 //! * IsSelfContained(...) returns true if all the
50 //! labels of the attributes of the given DataSet are
51 //! descendant of the given label.
52 class TDF_ComparisonTool
59 //! Compares <aSourceDataSet> with <aTargetDataSet>,
60 //! updating <aRelocationTable> with labels and
61 //! attributes found in both sets.
62 Standard_EXPORT static void Compare (const Handle(TDF_DataSet)& aSourceDataSet, const Handle(TDF_DataSet)& aTargetDataSet, const TDF_IDFilter& aFilter, const Handle(TDF_RelocationTable)& aRelocationTable);
64 //! Finds from <aRefDataSet> all the keys not bound
65 //! into <aRelocationTable> and put them into
66 //! <aDiffDataSet>. Returns True if the difference
67 //! contains at least one key. (A key is a source
70 //! <anOption> may take the following values:
71 //! 1 : labels treatment only;
72 //! 2 : attributes treatment only (default value);
73 //! 3 : both labels & attributes treatment.
74 Standard_EXPORT static Standard_Boolean SourceUnbound (const Handle(TDF_DataSet)& aRefDataSet, const Handle(TDF_RelocationTable)& aRelocationTable, const TDF_IDFilter& aFilter, const Handle(TDF_DataSet)& aDiffDataSet, const Standard_Integer anOption = 2);
76 //! Substracts from <aRefDataSet> all the items bound
77 //! into <aRelocationTable>. The result is put into
78 //! <aDiffDataSet>. Returns True if the difference
79 //! contains at least one item. (An item is a target
82 //! <anOption> may take the following values:
83 //! 1 : labels treatment only;
84 //! 2 : attributes treatment only(default value);
85 //! 3 : both labels & attributes treatment.
86 Standard_EXPORT static Standard_Boolean TargetUnbound (const Handle(TDF_DataSet)& aRefDataSet, const Handle(TDF_RelocationTable)& aRelocationTable, const TDF_IDFilter& aFilter, const Handle(TDF_DataSet)& aDiffDataSet, const Standard_Integer anOption = 2);
88 //! Removes attributes from <aDataSet>.
89 Standard_EXPORT static void Cut (const Handle(TDF_DataSet)& aDataSet);
91 //! Returns true if all the labels of <aDataSet> are
92 //! descendant of <aLabel>.
93 Standard_EXPORT static Standard_Boolean IsSelfContained (const TDF_Label& aLabel, const Handle(TDF_DataSet)& aDataSet);
107 //! Internal comparison method used by Compare(...).
108 Standard_EXPORT static void Compare (const TDF_Label& aSrcLabel, const TDF_Label& aTrgLabel, const Handle(TDF_DataSet)& aSourceDataSet, const Handle(TDF_DataSet)& aTargetDataSet, const TDF_IDFilter& aFilter, const Handle(TDF_RelocationTable)& aRelocationTable);
110 //! Internal function used by SourceUnbound() and
112 Standard_EXPORT static Standard_Boolean Unbound (const Handle(TDF_DataSet)& aRefDataSet, const Handle(TDF_RelocationTable)& aRelocationTable, const TDF_IDFilter& aFilter, const Handle(TDF_DataSet)& aDiffDataSet, const Standard_Integer anOption, const Standard_Boolean theSource);
125 #endif // _TDF_ComparisonTool_HeaderFile