Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:22

0001 // Created on: 2004-11-23
0002 // Created by: Pavel TELKOV
0003 // Copyright (c) 2004-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 // The original implementation Copyright: (C) RINA S.p.A
0017 
0018 #ifndef TObj_Partition_HeaderFile
0019 #define TObj_Partition_HeaderFile
0020 
0021 #include <TObj_Object.hxx>
0022 #include <TObj_Persistence.hxx>
0023 
0024 
0025 /**
0026 * This class provides tool handling one of partitions (the set of
0027 * homogeneous elements) in the OCAF based model`s data structure
0028 */
0029 
0030 class TObj_Partition : public TObj_Object
0031 {
0032  protected:
0033   enum DataTag
0034   {
0035     DataTag_First = TObj_Object::DataTag_Last,
0036     DataTag_LastIndex,
0037     DataTag_Last = DataTag_First + 100
0038   };
0039 
0040  protected:
0041   /**
0042   * Constructor
0043   */
0044 
0045   //! Constructor is protected;
0046   //! static methods are used for creation of this type of objects
0047   Standard_EXPORT TObj_Partition (const TDF_Label& theLabel, const Standard_Boolean theSetName = Standard_True);
0048 
0049  public:
0050   /**
0051   * Method for create partition
0052   */
0053 
0054   //! Creates a new partition on given label.
0055   static Standard_EXPORT Handle(TObj_Partition) Create
0056                         (const TDF_Label& theLabel, const Standard_Boolean theSetName = Standard_True);
0057 
0058  public:
0059   /**
0060   * Methods handling name of the object
0061   */
0062 
0063   //! Sets name of the object. partition does not check unique of own name
0064   virtual Standard_EXPORT Standard_Boolean SetName
0065                         (const Handle(TCollection_HExtendedString)& theName) const Standard_OVERRIDE;
0066 
0067  public:
0068   /**
0069   * Method for updating object afrer restoring
0070   */
0071 
0072   //! Performs updating the links and dependencies of the object which are not
0073   //! stored in persistence. Does not register the partition name
0074   virtual Standard_EXPORT void AfterRetrieval() Standard_OVERRIDE;
0075 
0076  public:
0077   /**
0078   * Methods handling of the objects in partition
0079   */
0080 
0081   //! Creates and Returns label for new object in partition.
0082   Standard_EXPORT TDF_Label NewLabel() const;
0083 
0084   //! Sets prefix for names of the objects in partition.
0085   Standard_EXPORT void SetNamePrefix
0086                         (const Handle(TCollection_HExtendedString)& thePrefix);
0087 
0088   //! Returns prefix for names of the objects in partition.
0089   Handle(TCollection_HExtendedString) GetNamePrefix() const
0090   { return myPrefix; }
0091 
0092   //! Generates and returns name for new object in partition.
0093   //! if theIsToChangeCount is true partition increase own counter
0094   //!  to generate new name next time starting from new counter value
0095   Standard_EXPORT Handle(TCollection_HExtendedString) GetNewName
0096     ( const Standard_Boolean theIsToChangeCount = Standard_True );
0097 
0098   //! Return Last index in partition (reserved);
0099   Standard_EXPORT Standard_Integer GetLastIndex() const;
0100 
0101   //! Sets Last index in partition (reserved);
0102   Standard_EXPORT void SetLastIndex(const Standard_Integer theIndex);
0103 
0104  public:
0105   /**
0106   * Methods to define partition by object
0107   */
0108 
0109   //! Returns the partition in which object is stored. Null partition
0110   //! returned if not found
0111   static Standard_EXPORT Handle(TObj_Partition) GetPartition
0112                         (const Handle(TObj_Object)& theObject);
0113 
0114  public:
0115   /**
0116   * Methods for updating the object
0117   */
0118 
0119   //! Does nothing in the partition.
0120   virtual Standard_Boolean Update()
0121   {return Standard_True;}
0122 
0123  protected:
0124   /**
0125   * protected redefined methods
0126   */
0127 
0128   //! Coping the data of me to Target object.
0129   //! return Standard_False is Target object is different type
0130   Standard_EXPORT virtual Standard_Boolean copyData
0131                         (const Handle(TObj_Object)& theTargetObject) Standard_OVERRIDE;
0132 
0133  private:
0134   /**
0135   * fields
0136   */
0137 
0138   //! prefix for naming of objects in the partition
0139   Handle(TCollection_HExtendedString) myPrefix;
0140 
0141  protected:
0142   //! Persistence of TObj object
0143   DECLARE_TOBJOCAF_PERSISTENCE(TObj_Partition,TObj_Object)
0144 
0145  public:
0146   //! CASCADE RTTI
0147   DEFINE_STANDARD_RTTIEXT(TObj_Partition,TObj_Object)
0148 
0149  public:
0150   friend class TObj_Model;
0151 
0152 };
0153 
0154 //! Define handle class for TObj_Partition
0155 DEFINE_STANDARD_HANDLE(TObj_Partition,TObj_Object)
0156 
0157 #endif
0158 
0159 #ifdef _MSC_VER
0160 #pragma once
0161 #endif