1 // Created on: 1992-02-11
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 _StepData_StepReaderTool_HeaderFile
18 #define _StepData_StepReaderTool_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 <Interface_FileReaderTool.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Standard_Integer.hxx>
29 class StepData_FileRecognizer;
30 class StepData_StepReaderData;
31 class StepData_Protocol;
32 class Interface_Check;
33 class Standard_Transient;
34 class Interface_InterfaceModel;
37 //! Specific FileReaderTool for Step; works with FileReaderData
38 //! provides references evaluation, plus access to litteral data
39 //! and specific methods defined by FileReaderTool
40 //! Remarks : works with a ReaderLib to load Entities
41 class StepData_StepReaderTool : public Interface_FileReaderTool
48 //! creates StepReaderTool to work with a StepReaderData according
49 //! to a Step Protocol. Defines the ReaderLib at this time
50 Standard_EXPORT StepData_StepReaderTool(const Handle(StepData_StepReaderData)& reader, const Handle(StepData_Protocol)& protocol);
52 //! Bounds empty entities to records, uses default Recognition
53 //! provided by ReaderLib and ReaderModule. Also calls computation
54 //! of references (SetEntityNumbers from StepReaderData)
55 //! Works only on data entities (skips header)
56 //! <optimize> given False allows to test some internal algorithms
57 //! which are normally avoided (see also StepReaderData)
58 Standard_EXPORT void Prepare (const Standard_Boolean optimize = Standard_True);
60 //! Bounds empty entities to records, works with a specific
61 //! FileRecognizer, stored and later used in Recognize
62 //! Works only on data entities (skips header)
63 //! <optimize : same as above
64 Standard_EXPORT void Prepare (const Handle(StepData_FileRecognizer)& reco, const Standard_Boolean optimize = Standard_True);
66 //! recognizes records, by asking either ReaderLib (default) or
67 //! FileRecognizer (if defined) to do so. <ach> is to call
69 Standard_EXPORT Standard_Boolean Recognize (const Standard_Integer num, Handle(Interface_Check)& ach, Handle(Standard_Transient)& ent) Standard_OVERRIDE;
71 //! bounds empty entities and sub-lists to header records
72 //! works like Prepare + SetEntityNumbers, but for header
73 //! (N.B.: in Header, no Ident and no reference)
74 //! FileRecognizer is to specify Entities which are allowed to be
75 //! defined in the Header (not every type can be)
76 Standard_EXPORT void PrepareHeader (const Handle(StepData_FileRecognizer)& reco);
78 //! fills model's header; that is, gives to it Header entities
79 //! and commands their loading. Also fills StepModel's Global
80 //! Check from StepReaderData's GlobalCheck
81 Standard_EXPORT void BeginRead (const Handle(Interface_InterfaceModel)& amodel) Standard_OVERRIDE;
83 //! fills an entity, given record no; works by using a ReaderLib
84 //! to load each entity, which must be a Transient
85 //! Actually, returned value is True if no fail, False else
86 Standard_EXPORT Standard_Boolean AnalyseRecord (const Standard_Integer num, const Handle(Standard_Transient)& anent, Handle(Interface_Check)& acheck) Standard_OVERRIDE;
88 //! Ends file reading after reading all the entities
89 //! Here, it binds in the model, Idents to Entities (for checks)
90 Standard_EXPORT virtual void EndRead (const Handle(Interface_InterfaceModel)& amodel) Standard_OVERRIDE;
105 Handle(StepData_FileRecognizer) thereco;
106 Interface_GeneralLib theglib;
107 Interface_ReaderLib therlib;
118 #endif // _StepData_StepReaderTool_HeaderFile