Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-16 09:17:31

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 occ::handle<IGESData_IGESReaderData>& reader,
0052                                           const occ::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 occ::handle<IGESData_FileRecognizer>& reco);
0059 
0060   //! recognizes records by asking Protocol (on data of DirType)
0061   Standard_EXPORT bool Recognize(const int                        num,
0062                                  occ::handle<Interface_Check>&    ach,
0063                                  occ::handle<Standard_Transient>& ent) override;
0064 
0065   //! fills model's header, that is, its GlobalSection
0066   Standard_EXPORT void BeginRead(const occ::handle<Interface_InterfaceModel>& amodel) 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 bool AnalyseRecord(const int                              num,
0073                                      const occ::handle<Standard_Transient>& anent,
0074                                      occ::handle<Interface_Check>&          acheck) override;
0075 
0076   //! after reading entities, true line weights can be computed
0077   Standard_EXPORT void EndRead(const occ::handle<Interface_InterfaceModel>& amodel) override;
0078 
0079   //! Reads directory part components from file; DP is the literal
0080   //! directory part, IR detains entities referenced by DP
0081   Standard_EXPORT void ReadDir(const occ::handle<IGESData_IGESEntity>&     ent,
0082                                const occ::handle<IGESData_IGESReaderData>& IR,
0083                                const IGESData_DirPart&                     DP,
0084                                occ::handle<Interface_Check>&               ach) const;
0085 
0086   //! Performs Reading of own Parameters for each IGESEntity
0087   //! Works with the ReaderLib loaded with ReadWriteModules for IGES
0088   //! In case of failure, tries UndefinedEntity from IGES
0089   Standard_EXPORT void ReadOwnParams(const occ::handle<IGESData_IGESEntity>&     ent,
0090                                      const occ::handle<IGESData_IGESReaderData>& IR,
0091                                      IGESData_ParamReader&                       PR) const;
0092 
0093   //! Reads Property List, if there is (if not, does nothing)
0094   //! criterium is : current parameter of PR remains inside params
0095   //! list, and Stage is "Own"
0096   //! Current parameter must be a positive integer, which value
0097   //! gives the length of the list; else, a Fail is produced (into
0098   //! Check of PR) and reading process is stopped
0099   Standard_EXPORT void ReadProps(const occ::handle<IGESData_IGESEntity>&     ent,
0100                                  const occ::handle<IGESData_IGESReaderData>& IR,
0101                                  IGESData_ParamReader&                       PR) const;
0102 
0103   //! Reads Associativity List, if there is (if not, does nothing)
0104   //! criterium is : current parameter of PR remains inside params
0105   //! list, and Stage is "Own"
0106   //! Same conditions as above; in addition, no parameter must be
0107   //! let after the list once read
0108   //! Note that "Associated" entities are not declared "Shared"
0109   Standard_EXPORT void ReadAssocs(const occ::handle<IGESData_IGESEntity>&     ent,
0110                                   const occ::handle<IGESData_IGESReaderData>& IR,
0111                                   IGESData_ParamReader&                       PR) const;
0112 
0113 private:
0114   occ::handle<Interface_ParamList>     thelist;
0115   occ::handle<IGESData_FileRecognizer> thereco;
0116   Interface_GeneralLib                 theglib;
0117   Interface_ReaderLib                  therlib;
0118   int                                  thecnum;
0119   IGESData_IGESType                    thectyp;
0120   IGESData_ReadStage                   thestep;
0121   occ::handle<Interface_Check>         thechk;
0122   int                                  thegradweight;
0123   double                               themaxweight;
0124   double                               thedefweight;
0125 };
0126 
0127 #endif // _IGESData_IGESReaderTool_HeaderFile