Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-06 08:46:34

0001 // Created on: 1992-04-06
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1992-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 _IGESData_IGESReaderTool_HeaderFile
0018 #define _IGESData_IGESReaderTool_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Interface_GeneralLib.hxx>
0025 #include <Interface_ReaderLib.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <IGESData_IGESType.hxx>
0028 #include <IGESData_ReadStage.hxx>
0029 #include <Interface_FileReaderTool.hxx>
0030 class Interface_ParamList;
0031 class IGESData_FileRecognizer;
0032 class Interface_Check;
0033 class IGESData_IGESReaderData;
0034 class IGESData_Protocol;
0035 class Standard_Transient;
0036 class Interface_InterfaceModel;
0037 class IGESData_IGESEntity;
0038 class IGESData_DirPart;
0039 class IGESData_ParamReader;
0040 
0041 //! specific FileReaderTool for IGES
0042 //! Parameters are accessed through specific objects, ParamReaders
0043 class IGESData_IGESReaderTool : public Interface_FileReaderTool
0044 {
0045 public:
0046   DEFINE_STANDARD_ALLOC
0047 
0048   //! creates IGESReaderTool to work with an IGESReaderData and an
0049   //! IGES Protocol.
0050   //! Actually, no Lib is used
0051   Standard_EXPORT IGESData_IGESReaderTool(const Handle(IGESData_IGESReaderData)& reader,
0052                                           const Handle(IGESData_Protocol)&       protocol);
0053 
0054   //! binds empty entities to records, works with the Protocol
0055   //! (from IGESData) stored and later used
0056   //! RQ : Actually, sets DNum into IGES Entities
0057   //! Also loads the list of parameters for ParamReader
0058   Standard_EXPORT void Prepare(const Handle(IGESData_FileRecognizer)& reco);
0059 
0060   //! recognizes records by asking Protocol (on data of DirType)
0061   Standard_EXPORT Standard_Boolean Recognize(const Standard_Integer      num,
0062                                              Handle(Interface_Check)&    ach,
0063                                              Handle(Standard_Transient)& ent) Standard_OVERRIDE;
0064 
0065   //! fills model's header, that is, its GlobalSection
0066   Standard_EXPORT void BeginRead(const Handle(Interface_InterfaceModel)& amodel) Standard_OVERRIDE;
0067 
0068   //! fills an entity, given record no; works by calling ReadDirPart
0069   //! then ReadParams (with help of a ParamReader), then if required
0070   //! ReadProps and ReadAssocs, from IGESEntity
0071   //! Returns True if no fail has been recorded
0072   Standard_EXPORT Standard_Boolean AnalyseRecord(const Standard_Integer            num,
0073                                                  const Handle(Standard_Transient)& anent,
0074                                                  Handle(Interface_Check)& acheck) Standard_OVERRIDE;
0075 
0076   //! after reading entities, true line weights can be computed
0077   Standard_EXPORT virtual void EndRead(const Handle(Interface_InterfaceModel)& amodel)
0078     Standard_OVERRIDE;
0079 
0080   //! Reads directory part components from file; DP is the literal
0081   //! directory part, IR detains entities referenced by DP
0082   Standard_EXPORT void ReadDir(const Handle(IGESData_IGESEntity)&     ent,
0083                                const Handle(IGESData_IGESReaderData)& IR,
0084                                const IGESData_DirPart&                DP,
0085                                Handle(Interface_Check)&               ach) const;
0086 
0087   //! Performs Reading of own Parameters for each IGESEntity
0088   //! Works with the ReaderLib loaded with ReadWriteModules for IGES
0089   //! In case of failure, tries UndefinedEntity from IGES
0090   Standard_EXPORT void ReadOwnParams(const Handle(IGESData_IGESEntity)&     ent,
0091                                      const Handle(IGESData_IGESReaderData)& IR,
0092                                      IGESData_ParamReader&                  PR) const;
0093 
0094   //! Reads Property List, if there is (if not, does nothing)
0095   //! criterium is : current parameter of PR remains inside params
0096   //! list, and Stage is "Own"
0097   //! Current parameter must be a positive integer, which value
0098   //! gives the length of the list; else, a Fail is produced (into
0099   //! Check of PR) and reading process is stopped
0100   Standard_EXPORT void ReadProps(const Handle(IGESData_IGESEntity)&     ent,
0101                                  const Handle(IGESData_IGESReaderData)& IR,
0102                                  IGESData_ParamReader&                  PR) const;
0103 
0104   //! Reads Associativity List, if there is (if not, does nothing)
0105   //! criterium is : current parameter of PR remains inside params
0106   //! list, and Stage is "Own"
0107   //! Same conditions as above; in addition, no parameter must be
0108   //! let after the list once read
0109   //! Note that "Associated" entities are not declared "Shared"
0110   Standard_EXPORT void ReadAssocs(const Handle(IGESData_IGESEntity)&     ent,
0111                                   const Handle(IGESData_IGESReaderData)& IR,
0112                                   IGESData_ParamReader&                  PR) const;
0113 
0114 protected:
0115 private:
0116   Handle(Interface_ParamList)     thelist;
0117   Handle(IGESData_FileRecognizer) thereco;
0118   Interface_GeneralLib            theglib;
0119   Interface_ReaderLib             therlib;
0120   Standard_Integer                thecnum;
0121   IGESData_IGESType               thectyp;
0122   IGESData_ReadStage              thestep;
0123   Handle(Interface_Check)         thechk;
0124   Standard_Integer                thegradweight;
0125   Standard_Real                   themaxweight;
0126   Standard_Real                   thedefweight;
0127 };
0128 
0129 #endif // _IGESData_IGESReaderTool_HeaderFile