Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:16:16

0001 // Created on: 2008-06-22
0002 // Created by: Vladislav ROMASHKO
0003 // Copyright (c) 2008-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 _TFunction_Scope_HeaderFile
0017 #define _TFunction_Scope_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <Standard_Integer.hxx>
0023 #include <TDF_Label.hxx>
0024 #include <NCollection_DoubleMap.hxx>
0025 #include <TFunction_Logbook.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 //! Keeps a scope of functions.
0034 class TFunction_Scope : public TDF_Attribute
0035 {
0036 
0037 public:
0038   //! Static methods
0039   //! ==============
0040   //! Finds or Creates a TFunction_Scope attribute at the root label accessed by <Access>.
0041   //! Returns the attribute.
0042   Standard_EXPORT static occ::handle<TFunction_Scope> Set(const TDF_Label& Access);
0043 
0044   //! Returns the GUID for Scope attribute.
0045   //! Instant methods
0046   //! ===============
0047   //! Constructor (empty).
0048   Standard_EXPORT static const Standard_GUID& GetID();
0049 
0050   Standard_EXPORT TFunction_Scope();
0051 
0052   //! Adds a function to the scope of functions.
0053   Standard_EXPORT bool AddFunction(const TDF_Label& L);
0054 
0055   //! Removes a function from the scope of functions.
0056   Standard_EXPORT bool RemoveFunction(const TDF_Label& L);
0057 
0058   //! Removes a function from the scope of functions.
0059   Standard_EXPORT bool RemoveFunction(const int ID);
0060 
0061   //! Removes all functions from the scope of functions.
0062   Standard_EXPORT void RemoveAllFunctions();
0063 
0064   //! Returns true if the function exists with such an ID.
0065   Standard_EXPORT bool HasFunction(const int ID) const;
0066 
0067   //! Returns true if the label contains a function of this scope.
0068   Standard_EXPORT bool HasFunction(const TDF_Label& L) const;
0069 
0070   //! Returns an ID of the function.
0071   Standard_EXPORT int GetFunction(const TDF_Label& L) const;
0072 
0073   //! Returns the label of the function with this ID.
0074   Standard_EXPORT const TDF_Label& GetFunction(const int ID) const;
0075 
0076   //! Returns the Logbook used in TFunction_Driver methods.
0077   //! Implementation of Attribute methods
0078   //! ===================================
0079   Standard_EXPORT occ::handle<TFunction_Logbook> GetLogbook() const;
0080 
0081   Standard_EXPORT const Standard_GUID& ID() const override;
0082 
0083   Standard_EXPORT void Restore(const occ::handle<TDF_Attribute>& with) override;
0084 
0085   Standard_EXPORT void Paste(const occ::handle<TDF_Attribute>&       into,
0086                              const occ::handle<TDF_RelocationTable>& RT) const override;
0087 
0088   Standard_EXPORT occ::handle<TDF_Attribute> NewEmpty() const override;
0089 
0090   Standard_EXPORT Standard_OStream& Dump(Standard_OStream& anOS) const override;
0091 
0092   //! Returns the scope of functions.
0093   Standard_EXPORT const NCollection_DoubleMap<int, TDF_Label>& GetFunctions() const;
0094 
0095   //! Returns the scope of functions for modification.
0096   //! Warning: Don't use this method if You are not sure what You do!
0097   Standard_EXPORT NCollection_DoubleMap<int, TDF_Label>& ChangeFunctions();
0098 
0099   Standard_EXPORT void SetFreeID(const int ID);
0100 
0101   Standard_EXPORT int GetFreeID() const;
0102 
0103   DEFINE_STANDARD_RTTIEXT(TFunction_Scope, TDF_Attribute)
0104 
0105 private:
0106   NCollection_DoubleMap<int, TDF_Label> myFunctions;
0107   int                                   myFreeID;
0108 };
0109 
0110 #endif // _TFunction_Scope_HeaderFile