|
||||
File indexing completed on 2025-01-18 10:05:36
0001 // Created on: 1995-06-01 0002 // Created by: Christian CAILLET 0003 // Copyright (c) 1995-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 _XSControl_WorkSession_HeaderFile 0018 #define _XSControl_WorkSession_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <IFSelect_WorkSession.hxx> 0024 #include <IFSelect_ReturnStatus.hxx> 0025 #include <XSControl_TransferWriter.hxx> 0026 class XSControl_Controller; 0027 class XSControl_TransferReader; 0028 class XSControl_Vars; 0029 class Transfer_TransientProcess; 0030 class Interface_InterfaceModel; 0031 class Transfer_FinderProcess; 0032 class TopoDS_Shape; 0033 class Interface_CheckIterator; 0034 0035 0036 class XSControl_WorkSession; 0037 DEFINE_STANDARD_HANDLE(XSControl_WorkSession, IFSelect_WorkSession) 0038 0039 using XSControl_WorkSessionMap = NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>; 0040 0041 //! This WorkSession completes the basic one, by adding : 0042 //! - use of Controller, with norm selection... 0043 //! - management of transfers (both ways) with auxiliary classes 0044 //! TransferReader and TransferWriter 0045 //! -> these transfers may work with a Context List : its items 0046 //! are given by the user, according to the transfer to be 0047 //! i.e. it is interpreted by the Actors 0048 //! Each item is accessed by a Name 0049 class XSControl_WorkSession : public IFSelect_WorkSession 0050 { 0051 public: 0052 0053 Standard_EXPORT XSControl_WorkSession(); 0054 0055 ~XSControl_WorkSession() 0056 { ClearBinders(); } 0057 0058 //! In addition to basic ClearData, clears Transfer and Management 0059 //! for interactive use, for mode = 0,1,2 and over 4 0060 //! Plus : mode = 5 to clear Transfers (both ways) only 0061 //! mode = 6 to clear enforced results 0062 //! mode = 7 to clear transfers, results 0063 Standard_EXPORT virtual void ClearData (const Standard_Integer theMode) Standard_OVERRIDE; 0064 0065 //! Selects a Norm defined by its name. 0066 //! A Norm is described and handled by a Controller 0067 //! Returns True if done, False if <normname> is unknown 0068 //! 0069 //! The current Profile for this Norm is taken. 0070 Standard_EXPORT Standard_Boolean SelectNorm (const Standard_CString theNormName); 0071 0072 //! Selects a Norm defined by its Controller itself 0073 Standard_EXPORT void SetController (const Handle(XSControl_Controller)& theCtl); 0074 0075 //! Returns the name of the last Selected Norm. If none is 0076 //! defined, returns an empty string 0077 //! By default, returns the complete name of the norm 0078 //! If <rsc> is True, returns the short name used for resource 0079 Standard_EXPORT Standard_CString SelectedNorm (const Standard_Boolean theRsc = Standard_False) const; 0080 0081 //! Returns the norm controller itself 0082 const Handle(XSControl_Controller) & NormAdaptor() const 0083 { return myController; } 0084 0085 //! Returns the current Context List, Null if not defined 0086 //! The Context is given to the TransientProcess for TransferRead 0087 const XSControl_WorkSessionMap& Context() const 0088 { return myContext; } 0089 0090 //! Sets the current Context List, as a whole 0091 //! Sets it to the TransferReader 0092 Standard_EXPORT void SetAllContext (const XSControl_WorkSessionMap& theContext); 0093 0094 //! Clears the whole current Context (nullifies it) 0095 Standard_EXPORT void ClearContext(); 0096 0097 //! Prints the transfer status of a transferred item, as being 0098 //! the Mapped n0 <num>, from MapWriter if <wri> is True, or 0099 //! from MapReader if <wri> is False 0100 //! Returns True when done, False else (i.e. num out of range) 0101 Standard_EXPORT Standard_Boolean PrintTransferStatus (const Standard_Integer theNum, const Standard_Boolean theWri, Standard_OStream& theS) const; 0102 0103 //! Sets a Transfer Reader, by internal ways, according mode : 0104 //! 0 recreates it clear, 1 clears it (does not recreate) 0105 //! 2 aligns Roots of TransientProcess from final Results 0106 //! 3 aligns final Results from Roots of TransientProcess 0107 //! 4 begins a new transfer (by BeginTransfer) 0108 //! 5 recreates TransferReader then begins a new transfer 0109 Standard_EXPORT void InitTransferReader (const Standard_Integer theMode); 0110 0111 //! Sets a Transfer Reader, which manages transfers on reading 0112 Standard_EXPORT void SetTransferReader (const Handle(XSControl_TransferReader)& theTR); 0113 0114 //! Returns the Transfer Reader, Null if not set 0115 const Handle(XSControl_TransferReader) & TransferReader () const 0116 { return myTransferReader; } 0117 0118 //! Returns the TransientProcess(internal data for TransferReader) 0119 Standard_EXPORT Handle(Transfer_TransientProcess) MapReader() const; 0120 0121 //! Changes the Map Reader, i.e. considers that the new one 0122 //! defines the relevant read results (forgets the former ones) 0123 //! Returns True when done, False in case of bad definition, i.e. 0124 //! if Model from TP differs from that of Session 0125 Standard_EXPORT Standard_Boolean SetMapReader (const Handle(Transfer_TransientProcess)& theTP); 0126 0127 //! Returns the result attached to a starting entity 0128 //! If <mode> = 0, returns Final Result 0129 //! If <mode> = 1, considers Last Result 0130 //! If <mode> = 2, considers Final, else if absent, Last 0131 //! returns it as Transient, if result is not transient returns 0132 //! the Binder 0133 //! <mode> = 10,11,12 idem but returns the Binder itself 0134 //! (if it is not, e.g. Shape, returns the Binder) 0135 //! <mode> = 20, returns the ResultFromModel 0136 Standard_EXPORT Handle(Standard_Transient) Result (const Handle(Standard_Transient)& theEnt, const Standard_Integer theMode) const; 0137 0138 //! Commands the transfer of, either one entity, or a list 0139 //! I.E. calls the TransferReader after having analysed <ents> 0140 //! It is cumulated from the last BeginTransfer 0141 //! <ents> is processed by GiveList, hence : 0142 //! - <ents> a Selection : its SelectionResult 0143 //! - <ents> a HSequenceOfTransient : this list 0144 //! - <ents> the Model : in this specific case, all the roots, 0145 //! with no cumulation of former transfers (TransferReadRoots) 0146 Standard_EXPORT Standard_Integer TransferReadOne (const Handle(Standard_Transient)& theEnts, 0147 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0148 0149 //! Commands the transfer of all the root entities of the model 0150 //! i.e. calls TransferRoot from the TransferReader with the Graph 0151 //! No cumulation with former calls to TransferReadOne 0152 Standard_EXPORT Standard_Integer TransferReadRoots(const Message_ProgressRange& theProgress = Message_ProgressRange()); 0153 0154 //! produces and returns a new Model well conditioned 0155 //! It is produced by the Norm Controller 0156 //! It can be Null (if this function is not implemented) 0157 Standard_EXPORT Handle(Interface_InterfaceModel) NewModel(); 0158 0159 //! Returns the Transfer Reader, Null if not set 0160 const Handle(XSControl_TransferWriter) & TransferWriter() const 0161 { return myTransferWriter; } 0162 0163 //! Changes the Map Reader, i.e. considers that the new one 0164 //! defines the relevant read results (forgets the former ones) 0165 //! Returns True when done, False if <FP> is Null 0166 Standard_Boolean SetMapWriter (const Handle(Transfer_FinderProcess)& theFP) 0167 { 0168 if (theFP.IsNull()) return Standard_False; 0169 myTransferWriter->SetFinderProcess(theFP); 0170 return Standard_True; 0171 } 0172 0173 //! Transfers a Shape from CasCade to a model of current norm, 0174 //! according to the last call to SetModeWriteShape 0175 //! Returns status :Done if OK, Fail if error during transfer, 0176 //! Error if transfer badly initialised 0177 Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape 0178 (const TopoDS_Shape& theShape, 0179 const Standard_Boolean theCompGraph = Standard_True, 0180 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0181 0182 //! Returns the check-list of last transfer (write) 0183 //! It is recorded in the FinderProcess, but it must be bound with 0184 //! resulting entities (in the resulting file model) rather than 0185 //! with original objects (in fact, their mappers) 0186 Standard_EXPORT Interface_CheckIterator TransferWriteCheckList() const; 0187 0188 const Handle(XSControl_Vars) & Vars() const 0189 { return myVars; } 0190 0191 void SetVars (const Handle(XSControl_Vars)& theVars) 0192 { myVars = theVars; } 0193 0194 DEFINE_STANDARD_RTTIEXT(XSControl_WorkSession,IFSelect_WorkSession) 0195 0196 private: 0197 0198 //! Clears binders 0199 Standard_EXPORT void ClearBinders(); 0200 0201 Handle(XSControl_Controller) myController; 0202 Handle(XSControl_TransferReader) myTransferReader; 0203 Handle(XSControl_TransferWriter) myTransferWriter; 0204 XSControl_WorkSessionMap myContext; 0205 Handle(XSControl_Vars) myVars; 0206 }; 0207 0208 #endif // _XSControl_WorkSession_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |