1 // Created on: 1992-04-06
2 // Created by: Christian CAILLET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _IGESData_IGESReaderTool_HeaderFile
18 #define _IGESData_IGESReaderTool_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Interface_GeneralLib.hxx>
25 #include <Interface_ReaderLib.hxx>
26 #include <Standard_Integer.hxx>
27 #include <IGESData_IGESType.hxx>
28 #include <IGESData_ReadStage.hxx>
29 #include <Standard_Real.hxx>
30 #include <Interface_FileReaderTool.hxx>
31 #include <Standard_Boolean.hxx>
32 class Interface_ParamList;
33 class IGESData_FileRecognizer;
34 class Interface_Check;
35 class IGESData_IGESReaderData;
36 class IGESData_Protocol;
37 class Standard_Transient;
38 class Interface_InterfaceModel;
39 class IGESData_IGESEntity;
40 class IGESData_DirPart;
41 class IGESData_ParamReader;
44 //! specific FileReaderTool for IGES
45 //! Parameters are accessed through specific objects, ParamReaders
46 class IGESData_IGESReaderTool : public Interface_FileReaderTool
53 //! creates IGESReaderTool to work with an IGESReaderData and an
55 //! Actually, no Lib is used
56 Standard_EXPORT IGESData_IGESReaderTool(const Handle(IGESData_IGESReaderData)& reader, const Handle(IGESData_Protocol)& protocol);
58 //! binds empty entities to records, works with the Protocol
59 //! (from IGESData) stored and later used
60 //! RQ : Actually, sets DNum into IGES Entities
61 //! Also loads the list of parameters for ParamReader
62 Standard_EXPORT void Prepare (const Handle(IGESData_FileRecognizer)& reco);
64 //! recognizes records by asking Protocol (on data of DirType)
65 Standard_EXPORT Standard_Boolean Recognize (const Standard_Integer num, Handle(Interface_Check)& ach, Handle(Standard_Transient)& ent) Standard_OVERRIDE;
67 //! fills model's header, that is, its GlobalSection
68 Standard_EXPORT void BeginRead (const Handle(Interface_InterfaceModel)& amodel) Standard_OVERRIDE;
70 //! fills an entity, given record no; works by calling ReadDirPart
71 //! then ReadParams (with help of a ParamReader), then if required
72 //! ReadProps and ReadAssocs, from IGESEntity
73 //! Returns True if no fail has been recorded
74 Standard_EXPORT Standard_Boolean AnalyseRecord (const Standard_Integer num, const Handle(Standard_Transient)& anent, Handle(Interface_Check)& acheck) Standard_OVERRIDE;
76 //! after reading entities, true line weights can be computed
77 Standard_EXPORT virtual void EndRead (const Handle(Interface_InterfaceModel)& amodel) Standard_OVERRIDE;
79 //! Reads directory part componants from file; DP is the litteral
80 //! directory part, IR detains entities referenced by DP
81 Standard_EXPORT void ReadDir (const Handle(IGESData_IGESEntity)& ent, const Handle(IGESData_IGESReaderData)& IR, const IGESData_DirPart& DP, Handle(Interface_Check)& ach) const;
83 //! Performs Reading of own Parameters for each IGESEntity
84 //! Works with the ReaderLib loaded with ReadWriteModules for IGES
85 //! In case of failure, tries UndefinedEntity from IGES
86 Standard_EXPORT void ReadOwnParams (const Handle(IGESData_IGESEntity)& ent, const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const;
88 //! Reads Property List, if there is (if not, does nothing)
89 //! criterium is : current parameter of PR remains inside params
90 //! list, and Stage is "Own"
91 //! Current parameter must be a positive integer, which value
92 //! gives the length of the list; else, a Fail is produced (into
93 //! Check of PR) and reading process is stopped
94 Standard_EXPORT void ReadProps (const Handle(IGESData_IGESEntity)& ent, const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const;
96 //! Reads Associativity List, if there is (if not, does nothing)
97 //! criterium is : current parameter of PR remains inside params
98 //! list, and Stage is "Own"
99 //! Same conditions as above; in addition, no parameter must be
100 //! let after the list once read
101 //! Note that "Associated" entities are not declared "Shared"
102 Standard_EXPORT void ReadAssocs (const Handle(IGESData_IGESEntity)& ent, const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const;
117 Handle(Interface_ParamList) thelist;
118 Handle(IGESData_FileRecognizer) thereco;
119 Interface_GeneralLib theglib;
120 Interface_ReaderLib therlib;
121 Standard_Integer thecnum;
122 IGESData_IGESType thectyp;
123 IGESData_ReadStage thestep;
124 Handle(Interface_Check) thechk;
125 Standard_Integer thegradweight;
126 Standard_Real themaxweight;
127 Standard_Real thedefweight;
138 #endif // _IGESData_IGESReaderTool_HeaderFile