|
||||
File indexing completed on 2025-01-18 10:03:55
0001 // Created on: 1993-01-08 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 _IFSelect_WorkLibrary_HeaderFile 0018 #define _IFSelect_WorkLibrary_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <Standard_Integer.hxx> 0024 #include <Interface_HArray1OfHAsciiString.hxx> 0025 #include <Standard_Transient.hxx> 0026 class Interface_InterfaceModel; 0027 class Interface_Protocol; 0028 class IFSelect_ContextWrite; 0029 class Interface_EntityIterator; 0030 class Interface_CopyTool; 0031 0032 class IFSelect_WorkLibrary; 0033 DEFINE_STANDARD_HANDLE(IFSelect_WorkLibrary, Standard_Transient) 0034 0035 //! This class defines the (empty) frame which can be used to 0036 //! enrich a XSTEP set with new capabilities 0037 //! In particular, a specific WorkLibrary must give the way for 0038 //! Reading a File into a Model, and Writing a Model to a File 0039 //! Thus, it is possible to define several Work Libraries for each 0040 //! norm, but recommended to define one general class for each one : 0041 //! this general class will define the Read and Write methods. 0042 //! 0043 //! Also a Dump service is provided, it can produce, according the 0044 //! norm, either a parcel of a file for an entity, or any other 0045 //! kind of information relevant for the norm, 0046 class IFSelect_WorkLibrary : public Standard_Transient 0047 { 0048 0049 public: 0050 0051 0052 //! Gives the way to Read a File and transfer it to a Model 0053 //! <mod> is the resulting Model, which has to be created by this 0054 //! method. In case of error, <mod> must be returned Null 0055 //! Return value is a status with free values. 0056 //! Simply, 0 is for "Execution OK" 0057 //! The Protocol can be used to work (e.g. create the Model, read 0058 //! and recognize the Entities) 0059 Standard_EXPORT virtual Standard_Integer ReadFile (const Standard_CString name, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const = 0; 0060 0061 //! Interface to read a data from the specified stream. 0062 //! @param model is the resulting Model, which has to be created by this method. 0063 //! In case of error, model must be returned Null 0064 //! Return value is a status: 0 - OK, 1 - read failure, -1 - stream failure. 0065 //! 0066 //! Default implementation returns 1 (error). 0067 Standard_EXPORT virtual Standard_Integer ReadStream (const Standard_CString theName, std::istream& theIStream, 0068 Handle(Interface_InterfaceModel)& model, 0069 const Handle(Interface_Protocol)& protocol) const; 0070 0071 //! Gives the way to Write a File from a Model. 0072 //! <ctx> contains all necessary information : the model, the 0073 //! protocol, the file name, and the list of File Modifiers to be 0074 //! applied, also with restricted list of selected entities for 0075 //! each one, if required. 0076 //! In return, it brings the produced check-list 0077 //! 0078 //! The WorkLibrary has to query <applied> to get then run the 0079 //! ContextWrite by looping like this (example) : 0080 //! for (numap = 1; numap <= ctx.NbModifiers(); numap ++) { 0081 //! ctx.SetModifier (numap); 0082 //! cast ctx.FileModifier() to specific type -> variable filemod 0083 //! if (!filemod.IsNull()) filemod->Perform (ctx,writer); 0084 //! filemod then works with ctx. It can, either act on the 0085 //! model itself (for instance on its header), or iterate 0086 //! on selected entities (Start/Next/More/Value) 0087 //! it can call AddFail or AddWarning, as necessary 0088 //! } 0089 Standard_EXPORT virtual Standard_Boolean WriteFile (IFSelect_ContextWrite& ctx) const = 0; 0090 0091 //! Performs the copy of entities from an original model to a new 0092 //! one. It must also copy headers if any. Returns True when done. 0093 //! The provided default works by copying the individual entities 0094 //! designated in the list, by using the general service class 0095 //! CopyTool. 0096 //! It can be redefined for a norm which, either implements Copy 0097 //! by another way (do not forget to Bind each copied result with 0098 //! its original entity in TC) and returns True, or does not know 0099 //! how to copy and returns False 0100 Standard_EXPORT virtual Standard_Boolean CopyModel (const Handle(Interface_InterfaceModel)& original, const Handle(Interface_InterfaceModel)& newmodel, const Interface_EntityIterator& list, Interface_CopyTool& TC) const; 0101 0102 //! Gives the way of dumping an entity under a form comprehensive 0103 //! for each norm. <model> helps to identify, number ... entities. 0104 //! <level> is to be interpreted for each norm (because of the 0105 //! formats which can be very different) 0106 Standard_EXPORT virtual void DumpEntity (const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol, const Handle(Standard_Transient)& entity, Standard_OStream& S, const Standard_Integer level) const = 0; 0107 0108 //! Calls deferred DumpEntity with the recorded default level 0109 Standard_EXPORT void DumpEntity (const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol, const Handle(Standard_Transient)& entity, Standard_OStream& S) const; 0110 0111 //! Records a default level and a maximum value for level 0112 //! level for DumpEntity can go between 0 and <max> 0113 //! default value will be <def> 0114 Standard_EXPORT void SetDumpLevels (const Standard_Integer def, const Standard_Integer max); 0115 0116 //! Returns the recorded default and maximum dump levels 0117 //! If none was recorded, max is returned negative, def as zero 0118 Standard_EXPORT void DumpLevels (Standard_Integer& def, Standard_Integer& max) const; 0119 0120 //! Records a short line of help for a level (0 - max) 0121 Standard_EXPORT void SetDumpHelp (const Standard_Integer level, const Standard_CString help); 0122 0123 //! Returns the help line recorded for <level>, or an empty string 0124 Standard_EXPORT Standard_CString DumpHelp (const Standard_Integer level) const; 0125 0126 0127 0128 0129 DEFINE_STANDARD_RTTIEXT(IFSelect_WorkLibrary,Standard_Transient) 0130 0131 protected: 0132 0133 0134 //! Required to initialise fields 0135 Standard_EXPORT IFSelect_WorkLibrary(); 0136 0137 0138 0139 private: 0140 0141 0142 Standard_Integer thelevdef; 0143 Handle(Interface_HArray1OfHAsciiString) thelevhlp; 0144 0145 0146 }; 0147 0148 0149 0150 0151 0152 0153 0154 #endif // _IFSelect_WorkLibrary_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |