|
||||
File indexing completed on 2025-01-18 10:04:07
0001 // Created on: 1993-02-02 0002 // Created by: Christian CAILLET 0003 // Copyright (c) 1993-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 _Interface_GeneralModule_HeaderFile 0018 #define _Interface_GeneralModule_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <Standard_Transient.hxx> 0024 #include <Standard_Integer.hxx> 0025 class Interface_InterfaceModel; 0026 class Interface_EntityIterator; 0027 class Interface_ShareTool; 0028 class Interface_Check; 0029 class Interface_CopyTool; 0030 class TCollection_HAsciiString; 0031 0032 0033 class Interface_GeneralModule; 0034 DEFINE_STANDARD_HANDLE(Interface_GeneralModule, Standard_Transient) 0035 0036 //! This class defines general services, which must be provided 0037 //! for each type of Entity (i.e. of Transient Object processed 0038 //! by an Interface) : Shared List, Check, Copy, Delete, Category 0039 //! 0040 //! To optimise processing (e.g. firstly bind an Entity to a Module 0041 //! then calls Module), each recognized Entity Type corresponds 0042 //! to a Case Number, determined by the Protocol each class of 0043 //! GeneralModule belongs to. 0044 class Interface_GeneralModule : public Standard_Transient 0045 { 0046 0047 public: 0048 0049 0050 //! Specific filling of the list of Entities shared by an Entity 0051 //! <ent>, according a Case Number <CN> (formerly computed by 0052 //! CaseNum), considered in the context of a Model <model> 0053 //! Default calls FillSharedCase (i.e., ignores the model) 0054 //! Can be redefined to use the model for working 0055 Standard_EXPORT virtual void FillShared (const Handle(Interface_InterfaceModel)& model, const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const; 0056 0057 //! Specific filling of the list of Entities shared by an Entity 0058 //! <ent>, according a Case Number <CN> (formerly computed by 0059 //! CaseNum). Can use the internal utility method Share, below 0060 Standard_EXPORT virtual void FillSharedCase (const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const = 0; 0061 0062 //! Adds an Entity to a Shared List (uses GetOneItem on <iter>) 0063 Standard_EXPORT void Share (Interface_EntityIterator& iter, const Handle(Standard_Transient)& shared) const; 0064 0065 //! List the Implied References of <ent> considered in the context 0066 //! of a Model <model> : i.e. the Entities which are Referenced 0067 //! while not considered as Shared (not copied if <ent> is, 0068 //! references not renewed by CopyCase but by ImpliedCase, only 0069 //! if referenced Entities have been Copied too) 0070 //! FillShared + ListImplied give the complete list of References 0071 //! Default calls ListImpliedCase (i.e. ignores the model) 0072 //! Can be redefined to use the model for working 0073 Standard_EXPORT virtual void ListImplied (const Handle(Interface_InterfaceModel)& model, const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const; 0074 0075 //! List the Implied References of <ent> (see above) 0076 //! are Referenced while not considered as Shared (not copied if 0077 //! <ent> is, references not renewed by CopyCase but by 0078 //! ImpliedCase, only if referenced Entities have been Copied too) 0079 //! FillSharedCase + ListImpliedCase give the complete list of 0080 //! Referenced Entities 0081 //! The provided default method does nothing (Implied References 0082 //! are specific of a little amount of Entity Classes). 0083 Standard_EXPORT virtual void ListImpliedCase (const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const; 0084 0085 //! Specific Checking of an Entity <ent> 0086 //! Can check context queried through a ShareTool, as required 0087 Standard_EXPORT virtual void CheckCase (const Standard_Integer CN, const Handle(Standard_Transient)& ent, const Interface_ShareTool& shares, Handle(Interface_Check)& ach) const = 0; 0088 0089 //! Specific answer to the question "is Copy properly implemented" 0090 //! Remark that it should be in phase with the implementation of 0091 //! NewVoid+CopyCase/NewCopyCase 0092 //! Default returns always False, can be redefined 0093 Standard_EXPORT virtual Standard_Boolean CanCopy (const Standard_Integer CN, const Handle(Standard_Transient)& ent) const; 0094 0095 //! Dispatches an entity 0096 //! Returns True if it works by copy, False if it just duplicates 0097 //! the starting Handle 0098 //! 0099 //! Dispatching means producing a new entity, image of the 0100 //! starting one, in order to be put into a new Model, this Model 0101 //! being itself the result of a dispatch from an original Model 0102 //! 0103 //! According to the cases, dispatch can either 0104 //! * just return <entto> as equating <entfrom> 0105 //! -> the new model designates the starting entity : it is 0106 //! lighter, but the dispatched entity being shared might not be 0107 //! modified for dispatch 0108 //! * copy <entfrom> to <entto> 0109 //! by calling NewVoid+CopyCase (two steps) or NewCopiedCase (1) 0110 //! -> the dispatched entity is a COPY, hence it can be modified 0111 //! 0112 //! The provided default just duplicates the handle without 0113 //! copying, then returns False. Can be redefined 0114 Standard_EXPORT virtual Standard_Boolean Dispatch (const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const; 0115 0116 //! Creates a new void entity <entto> according to a Case Number 0117 //! This entity remains to be filled, by reading from a file or 0118 //! by copying from another entity of same type (see CopyCase) 0119 Standard_EXPORT virtual Standard_Boolean NewVoid (const Standard_Integer CN, Handle(Standard_Transient)& entto) const = 0; 0120 0121 //! Specific Copy ("Deep") from <entfrom> to <entto> (same type) 0122 //! by using a CopyTool which provides its working Map. 0123 //! Use method Transferred from CopyTool to work 0124 Standard_EXPORT virtual void CopyCase (const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const = 0; 0125 0126 //! Specific operator (create+copy) defaulted to do nothing. 0127 //! It can be redefined : When it is not possible to work in two 0128 //! steps (NewVoid then CopyCase). This can occur when there is 0129 //! no default constructor : hence the result <entto> must be 0130 //! created with an effective definition. 0131 //! Remark : if NewCopiedCase is defined, CopyCase has nothing to do 0132 //! Returns True if it has produced something, false else 0133 Standard_EXPORT virtual Standard_Boolean NewCopiedCase (const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const; 0134 0135 //! Specific Copying of Implied References 0136 //! A Default is provided which does nothing (must current case !) 0137 //! Already copied references (by CopyFrom) must remain unchanged 0138 //! Use method Search from CopyTool to work 0139 Standard_EXPORT virtual void RenewImpliedCase (const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, const Handle(Standard_Transient)& entto, const Interface_CopyTool& TC) const; 0140 0141 //! Prepares an entity to be deleted. What does it mean : 0142 //! Basically, any class of entity may define its own destructor 0143 //! By default, it does nothing but calling destructors on fields 0144 //! With the Memory Manager, it is useless to call destructor, 0145 //! it is done automatically when the Handle is nullified(cleared) 0146 //! BUT this is ineffective in looping structures (whatever these 0147 //! are "Implied" references or not). 0148 //! 0149 //! THUS : if no loop may appear in definitions, a class which 0150 //! inherits from TShared is correctly managed by automatic way 0151 //! BUT if there can be loops (or simply back pointers), they must 0152 //! be broken, for instance by clearing fields of one of the nodes 0153 //! The default does nothing, to be redefined if a loop can occur 0154 //! (Implied generally requires WhenDelete, but other cases can 0155 //! occur) 0156 //! 0157 //! Warning : <dispatched> tells if the entity to be deleted has been 0158 //! produced by Dispatch or not. Hence WhenDelete must be in 0159 //! coherence with Dispatch 0160 //! Dispatch can either copy or not. 0161 //! If it copies the entity, this one should be deleted 0162 //! If it doesn't (i.e. duplicates the handle) nothing to do 0163 //! 0164 //! If <dispatch> is False, normal deletion is to be performed 0165 Standard_EXPORT virtual void WhenDeleteCase (const Standard_Integer CN, const Handle(Standard_Transient)& ent, const Standard_Boolean dispatched) const; 0166 0167 //! Returns a category number which characterizes an entity 0168 //! Category Numbers are managed by the class Category 0169 //! <shares> can be used to evaluate this number in the context 0170 //! Default returns 0 which means "unspecified" 0171 Standard_EXPORT virtual Standard_Integer CategoryNumber (const Standard_Integer CN, const Handle(Standard_Transient)& ent, const Interface_ShareTool& shares) const; 0172 0173 //! Determines if an entity brings a Name (or widerly, if a Name 0174 //! can be attached to it, through the ShareTool 0175 //! By default, returns a Null Handle (no name can be produced) 0176 //! Can be redefined 0177 //! 0178 //! Warning : While this string may be edited on the spot, if it is a read 0179 //! field, the returned value must be copied before. 0180 Standard_EXPORT virtual Handle(TCollection_HAsciiString) Name (const Standard_Integer CN, const Handle(Standard_Transient)& ent, const Interface_ShareTool& shares) const; 0181 0182 0183 0184 0185 DEFINE_STANDARD_RTTIEXT(Interface_GeneralModule,Standard_Transient) 0186 0187 protected: 0188 0189 0190 0191 0192 private: 0193 0194 0195 0196 0197 }; 0198 0199 0200 0201 0202 0203 0204 0205 #endif // _Interface_GeneralModule_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |