Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-25 09:21:36

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_CopyTool_HeaderFile
0017 #define _TDF_CopyTool_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <TDF_Label.hxx>
0024 #include <NCollection_DataMap.hxx>
0025 #include <TDF_Attribute.hxx>
0026 #include <NCollection_Map.hxx>
0027 class TDF_DataSet;
0028 class TDF_RelocationTable;
0029 class TDF_IDFilter;
0030 class TDF_Label;
0031 
0032 //! This class provides services to build, copy or
0033 //! paste a set of information.
0034 //!
0035 //! Copy methods:
0036 //! -------------
0037 //!
0038 //! * Copy(aSourceDataSet, aTargetLabel,
0039 //! aRelocationTable) copies a source DataSet under
0040 //! its target place (see below: IMPORTANT NOTICE 1).
0041 //!
0042 //! * Copy(aSourceDataSet, anTargetLabel,
0043 //! aRelocationTable, aFilter) does the same job as
0044 //! the previous method. But <aFilter> gives a list of
0045 //! IDs for which a target attribute prevails over a
0046 //! source one. In this special case, the source
0047 //! attribute will be copied only if there will be no
0048 //! target attribute.
0049 //!
0050 //! IMPORTANT NOTICE : Label pre-binding
0051 //! ------------------
0052 //!
0053 //! For it is possible to copy root labels in another
0054 //! place in the same Data or in a different one with
0055 //! other tags, it is necessary to inform the Copy
0056 //! algorithm about the target place. To do so:
0057 //!
0058 //! * first get or create new target root labels;
0059 //!
0060 //! * then bind them with the source root labels using
0061 //! the relocation table method:
0062 //! SetRelocation(aSourceLabel, aTargetLabel);
0063 //!
0064 //! * finally call Copy(...) with the relocation table
0065 //! previously set. In this way, this method will take
0066 //! these relocations in account.
0067 class TDF_CopyTool
0068 {
0069 public:
0070   DEFINE_STANDARD_ALLOC
0071 
0072   //! Copy <aSourceDataSet> with using and updating
0073   //! <aRelocationTable>. This method ignores target
0074   //! attributes privilege over source ones.
0075   Standard_EXPORT static void Copy(const occ::handle<TDF_DataSet>&         aSourceDataSet,
0076                                    const occ::handle<TDF_RelocationTable>& aRelocationTable);
0077 
0078   //! Copy <aSourceDataSet> using and updating
0079   //! <aRelocationTable>. Use <aPrivilegeFilter> to give
0080   //! a list of IDs for which the target attribute
0081   //! prevails over the source one.
0082   Standard_EXPORT static void Copy(const occ::handle<TDF_DataSet>&         aSourceDataSet,
0083                                    const occ::handle<TDF_RelocationTable>& aRelocationTable,
0084                                    const TDF_IDFilter&                     aPrivilegeFilter);
0085 
0086   //! Copy <aSourceDataSet> using and updating
0087   //! <aRelocationTable>. Use <aPrivilegeFilter> to give
0088   //! a list of IDs for which the target attribute
0089   //! prevails over the source one. If <setSelfContained>
0090   //! is set to true, every TDF_Reference will be
0091   //! replaced by the referenced structure
0092   //! according to <aRefFilter>.
0093   //!
0094   //! NB: <aRefFilter> is used only if <setSelfContained>
0095   //! is true.
0096   //! Internal root label copy recursive method.
0097   Standard_EXPORT static void Copy(const occ::handle<TDF_DataSet>&         aSourceDataSet,
0098                                    const occ::handle<TDF_RelocationTable>& aRelocationTable,
0099                                    const TDF_IDFilter&                     aPrivilegeFilter,
0100                                    const TDF_IDFilter&                     aRefFilter,
0101                                    const bool                              setSelfContained);
0102 
0103 private:
0104   //! Internal root label copy recursive method.
0105   Standard_EXPORT static void CopyLabels(
0106     const TDF_Label&                                                             aSLabel,
0107     TDF_Label&                                                                   aTargetLabel,
0108     NCollection_DataMap<TDF_Label, TDF_Label>&                                   aLabMap,
0109     NCollection_DataMap<occ::handle<TDF_Attribute>, occ::handle<TDF_Attribute>>& aAttMap,
0110     const NCollection_Map<TDF_Label>&                                            aSrcLabelMap,
0111     const NCollection_Map<occ::handle<TDF_Attribute>>&                           aSrcAttributeMap);
0112 
0113   //! Internal attribute copy method.
0114   Standard_EXPORT static void CopyAttributes(
0115     const TDF_Label&                                                             aSLabel,
0116     TDF_Label&                                                                   aTargetLabel,
0117     NCollection_DataMap<occ::handle<TDF_Attribute>, occ::handle<TDF_Attribute>>& aAttMap,
0118     const NCollection_Map<occ::handle<TDF_Attribute>>&                           aSrcAttributeMap);
0119 };
0120 
0121 #endif // _TDF_CopyTool_HeaderFile