0030686: Visualization, SelectMgr_ViewerSelector - sorting issues of transformation...
[occt.git] / src / Interface / Interface_ReaderModule.hxx
1 // Created on: 1993-02-04
2 // Created by: Christian CAILLET
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Interface_ReaderModule_HeaderFile
18 #define _Interface_ReaderModule_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Transient.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 class Standard_DomainError;
27 class Interface_FileReaderData;
28 class Interface_Check;
29 class Standard_Transient;
30
31
32 class Interface_ReaderModule;
33 DEFINE_STANDARD_HANDLE(Interface_ReaderModule, Standard_Transient)
34
35 //! Defines unitary operations required to read an Entity from a
36 //! File (see FileReaderData, FileReaderTool), under control of
37 //! a FileReaderTool. The initial creation is performed by a
38 //! GeneralModule (set in GeneralLib). Then, which remains is
39 //! Loading data from the FileReaderData to the Entity
40 //!
41 //! To work, a GeneralModule has formerly recognized the Type read
42 //! from FileReaderData as a positive Case Number, then the
43 //! ReaderModule reads it according to this Case Number
44 class Interface_ReaderModule : public Standard_Transient
45 {
46
47 public:
48
49   
50   //! Translates the type of record <num> in <data> to a positive
51   //! Case Number. If Recognition fails, must return 0
52   Standard_EXPORT virtual Standard_Integer CaseNum (const Handle(Interface_FileReaderData)& data, const Standard_Integer num) const = 0;
53   
54   //! Performs the effective loading from <data>, record <num>,
55   //! to the Entity <ent> formerly created
56   //! In case of Error or Warning, fills <ach> with messages
57   //! Remark that the Case Number comes from translating a record
58   Standard_EXPORT virtual void Read (const Standard_Integer casenum, const Handle(Interface_FileReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(Standard_Transient)& ent) const = 0;
59   
60   //! Specific operator (create+read) defaulted to do nothing.
61   //! It can be redefined when it is not possible to work in two
62   //! steps (NewVoid then Read). This occurs when no default
63   //! constructor is defined : hence the result <ent> must be
64   //! created with an effective definition from the reader.
65   //! Remark : if NewRead is defined, Copy has nothing to do.
66   //!
67   //! Returns True if it has produced something, false else.
68   //! If nothing was produced, <ach> should be filled : it will be
69   //! treated as "Unrecognized case" by reader tool.
70   Standard_EXPORT virtual Standard_Boolean NewRead (const Standard_Integer casenum, const Handle(Interface_FileReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, Handle(Standard_Transient)& ent) const;
71
72
73
74
75   DEFINE_STANDARD_RTTIEXT(Interface_ReaderModule,Standard_Transient)
76
77 protected:
78
79
80
81
82 private:
83
84
85
86
87 };
88
89
90
91
92
93
94
95 #endif // _Interface_ReaderModule_HeaderFile