Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:24:26

0001 // Created on: 1999-07-19
0002 // Created by: Denis PASCAL
0003 // Copyright (c) 1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TFunction_Logbook_HeaderFile
0018 #define _TFunction_Logbook_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TDF_Label.hxx>
0025 #include <NCollection_Map.hxx>
0026 #include <TDF_Attribute.hxx>
0027 #include <Standard_OStream.hxx>
0028 class TDF_Label;
0029 class Standard_GUID;
0030 class TFunction_Logbook;
0031 class TDF_RelocationTable;
0032 
0033 //! This class contains information which is written and
0034 //! read during the solving process. Information is divided
0035 //! in three groups.
0036 //!
0037 //! * Touched Labels  (modified by the end user),
0038 //! * Impacted Labels (modified during execution of the function),
0039 //! * Valid Labels    (within the valid label scope).
0040 class TFunction_Logbook : public TDF_Attribute
0041 {
0042 public:
0043   //! Finds or Creates a TFunction_Logbook attribute at the root label accessed by <Access>.
0044   //! Returns the attribute.
0045   Standard_EXPORT static occ::handle<TFunction_Logbook> Set(const TDF_Label& Access);
0046 
0047   //! Returns the GUID for logbook attribute.
0048   Standard_EXPORT static const Standard_GUID& GetID();
0049 
0050   //! The methods manipulating the data
0051   //! (touched, impacted and valid labels)
0052   //  ====================================
0053 
0054   //! Constructor (empty).
0055   Standard_EXPORT TFunction_Logbook();
0056 
0057   //! Clears this logbook to its default, empty state.
0058   Standard_EXPORT void Clear();
0059   Standard_EXPORT bool IsEmpty() const;
0060 
0061   //! Sets the label L as a touched label in this logbook.
0062   //! In other words, L is understood to have been modified by the end user.
0063   void SetTouched(const TDF_Label& L);
0064 
0065   //! Sets the label L as an impacted label in this logbook.
0066   //! This method is called by execution of the function driver.
0067   Standard_EXPORT void SetImpacted(const TDF_Label& L, const bool WithChildren = false);
0068 
0069   //! Sets the label L as a valid label in this logbook.
0070   Standard_EXPORT void SetValid(const TDF_Label& L, const bool WithChildren = false);
0071   Standard_EXPORT void SetValid(const NCollection_Map<TDF_Label>& Ls);
0072 
0073   //! Returns True if the label L is touched or impacted. This method
0074   //! is called by <TFunction_FunctionDriver::MustExecute>.
0075   //! If <WithChildren> is set to true, the method checks
0076   //! all the sublabels of <L> too.
0077   Standard_EXPORT bool IsModified(const TDF_Label& L, const bool WithChildren = false) const;
0078 
0079   //! Returns the map of touched labels in this logbook.
0080   //! A touched label is the one modified by the end user.
0081   const NCollection_Map<TDF_Label>& GetTouched() const;
0082 
0083   //! Returns the map of impacted labels contained in this logbook.
0084   const NCollection_Map<TDF_Label>& GetImpacted() const;
0085 
0086   //! Returns the map of valid labels in this logbook.
0087   const NCollection_Map<TDF_Label>& GetValid() const;
0088   Standard_EXPORT void              GetValid(NCollection_Map<TDF_Label>& Ls) const;
0089 
0090   //! Sets status of execution.
0091   void Done(const bool status);
0092 
0093   //! Returns status of execution.
0094   bool IsDone() const;
0095 
0096   //! The methods inherited from TDF_Attribute
0097   //  ========================================
0098 
0099   //! Returns the ID of the attribute.
0100   Standard_EXPORT const Standard_GUID& ID() const override;
0101 
0102   //! Undos (and redos) the attribute.
0103   Standard_EXPORT void Restore(const occ::handle<TDF_Attribute>& with) override;
0104 
0105   //! Pastes the attribute to another label.
0106   Standard_EXPORT void Paste(const occ::handle<TDF_Attribute>&       into,
0107                              const occ::handle<TDF_RelocationTable>& RT) const override;
0108 
0109   //! Returns a new empty instance of the attribute.
0110   Standard_EXPORT occ::handle<TDF_Attribute> NewEmpty() const override;
0111 
0112   //! Prints th data of the attributes (touched, impacted and valid labels).
0113   Standard_EXPORT Standard_OStream& Dump(Standard_OStream& anOS) const override;
0114 
0115   DEFINE_STANDARD_RTTIEXT(TFunction_Logbook, TDF_Attribute)
0116 
0117 private:
0118   NCollection_Map<TDF_Label> myTouched;
0119   NCollection_Map<TDF_Label> myImpacted;
0120   NCollection_Map<TDF_Label> myValid;
0121   bool                       isDone;
0122 };
0123 
0124 #include <TFunction_Logbook.lxx>
0125 
0126 #endif // _TFunction_Logbook_HeaderFile