1 // File: TObj_Partition.hxx
2 // Created: Thu Nov 23 11:26:54 2004
3 // Author: Pavel TELKOV
4 // Copyright: Open CASCADE 2007
5 // The original implementation Copyright: (C) RINA S.p.A
7 #ifndef TObj_Partition_HeaderFile
8 #define TObj_Partition_HeaderFile
10 #include <TObj_Object.hxx>
11 #include <TObj_Persistence.hxx>
13 class Handle(TCollection_HExtendedString);
14 class Handle(TObj_Partition);
17 * This class privides tool handling one of partitions (the set of
18 * homogenious elements) in the OCAF based model`s data structure
21 class TObj_Partition : public TObj_Object
26 DataTag_First = TObj_Object::DataTag_Last,
28 DataTag_Last = DataTag_First + 100
36 //! Constructor is protected;
37 //! static methods are used for creation of this type of objects
38 Standard_EXPORT TObj_Partition (const TDF_Label& theLabel);
42 * Method for create partition
45 //! Creates a new partition on given label.
46 static Standard_EXPORT Handle(TObj_Partition) Create
47 (const TDF_Label& theLabel);
51 * Methods hanling name of the object
54 //! Sets name of the object. partition does not check unique of own name
55 virtual Standard_EXPORT Standard_Boolean SetName
56 (const Handle(TCollection_HExtendedString)& theName) const;
60 * Method for updating object afrer restoring
63 //! Preforms updating the links and dependances of the object which are not
64 //! stored in persistence. Does not register the partition name
65 virtual Standard_EXPORT void AfterRetrieval();
69 * Methods handling of the objects in partition
72 //! Creates and Returns label for new object in partition.
73 Standard_EXPORT TDF_Label NewLabel() const;
75 //! Sets prefix for names of the objects in partition.
76 Standard_EXPORT void SetNamePrefix
77 (const Handle(TCollection_HExtendedString)& thePrefix);
79 //! Returns prefix for names of the objects in partition.
80 Standard_EXPORT Handle(TCollection_HExtendedString) GetNamePrefix() const
83 //! Generates and returns name for new object in partition.
84 //! if theIsToChangeCount is true partition icrease own counter
85 //! to generate new name next time starting from new counter value
86 Standard_EXPORT Handle(TCollection_HExtendedString) GetNewName
87 ( const Standard_Boolean theIsToChangeCount = Standard_True );
89 //! Return Last index in partition (reserved);
90 Standard_EXPORT Standard_Integer GetLastIndex() const;
92 //! Sets Last index in partition (reserved);
93 Standard_EXPORT void SetLastIndex(const Standard_Integer theIndex);
97 * Methods to define partition by object
100 //! Returns the partition in which object is stored. Null partition
101 //! returned if not found
102 static Standard_EXPORT Handle(TObj_Partition) GetPartition
103 (const Handle(TObj_Object)& theObject);
107 * Methods for updating the object
110 //! Does nothing in the partition.
111 virtual Standard_EXPORT Standard_Boolean Update()
112 {return Standard_True;}
116 * protected redefined methods
119 //! Coping the data of me to Target object.
120 //! return Standard_False is Target object is different type
121 Standard_EXPORT virtual Standard_Boolean copyData
122 (const Handle(TObj_Object)& theTargetObject);
129 //! prefix for naming of objects in the partition
130 Handle(TCollection_HExtendedString) myPrefix;
133 //! Persistence of TObj object
134 DECLARE_TOBJOCAF_PERSISTENCE(TObj_Partition,TObj_Object)
138 DEFINE_STANDARD_RTTI(TObj_Partition)
141 friend class TObj_Model;
145 //! Define handle class for TObj_Partition
146 DEFINE_STANDARD_HANDLE(TObj_Partition,TObj_Object)