0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / IGESData / IGESData_ReadWriteModule.hxx
1 // Created on: 1993-09-06
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 _IGESData_ReadWriteModule_HeaderFile
18 #define _IGESData_ReadWriteModule_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Interface_ReaderModule.hxx>
24 #include <Standard_Integer.hxx>
25 class Standard_DomainError;
26 class Interface_FileReaderData;
27 class Interface_Check;
28 class Standard_Transient;
29 class IGESData_IGESEntity;
30 class IGESData_IGESReaderData;
31 class IGESData_ParamReader;
32 class IGESData_IGESWriter;
33
34
35 class IGESData_ReadWriteModule;
36 DEFINE_STANDARD_HANDLE(IGESData_ReadWriteModule, Interface_ReaderModule)
37
38 //! Defines basic File Access Module, under the control of
39 //! IGESReaderTool for Reading and IGESWriter for Writing :
40 //! Specific actions concern : Read and Write Own Parameters of
41 //! an IGESEntity.
42 //! The common parts (Directory Entry, Lists of Associativities
43 //! and Properties) are processed by IGESReaderTool & IGESWriter
44 //!
45 //! Each sub-class of ReadWriteModule is used in conjunction with
46 //! a sub-class of Protocol from IGESData and processes several
47 //! types of IGESEntity (typically, them of a package) :
48 //! The Protocol gives a unique positive integer Case Number for
49 //! each type of IGESEntity it recognizes, the corresponding
50 //! ReadWriteModule processes an Entity by using the Case Number
51 //! to known what is to do
52 //! On Reading, the general service NewVoid is used to create an
53 //! IGES Entity the first time
54 //!
55 //! Warning : Works with an IGESReaderData which stores "DE parts" of Items
56 class IGESData_ReadWriteModule : public Interface_ReaderModule
57 {
58
59 public:
60
61   
62   //! Translates the Type of record <num> in <data> to a positive
63   //! Case Number, or 0 if failed.
64   //! Works with IGESReaderData which provides Type & Form Numbers,
65   //! and calls CaseIGES (see below)
66   Standard_EXPORT Standard_Integer CaseNum (const Handle(Interface_FileReaderData)& data, const Standard_Integer num) const Standard_OVERRIDE;
67   
68   //! Defines Case Numbers corresponding to the Entity Types taken
69   //! into account by a sub-class of ReadWriteModule (hence, each
70   //! sub-class of ReadWriteModule has to redefine this method)
71   //! Called by CaseNum. Its result will then be used to call
72   //! Read, etc ...
73   Standard_EXPORT virtual Standard_Integer CaseIGES (const Standard_Integer typenum, const Standard_Integer formnum) const = 0;
74   
75   //! General Read Function. See IGESReaderTool for more info
76   Standard_EXPORT void Read (const Standard_Integer CN, const Handle(Interface_FileReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
77   
78   //! Reads own parameters from file for an Entity; <PR> gives
79   //! access to them, <IR> detains parameter types and values
80   //! For each class, there must be a specific action provided
81   //! Note that Properties and Associativities Lists are Read by
82   //! specific methods (see below), they are called under control
83   //! of reading process (only one call) according Stage recorded
84   //! in ParamReader
85   Standard_EXPORT virtual void ReadOwnParams (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const = 0;
86   
87   //! Writes own parameters to IGESWriter; defined for each class
88   //! (to be redefined for other IGES ReadWriteModules)
89   //! Warning : Properties and Associativities are directly managed by
90   //! WriteIGES, must not be sent by this method
91   Standard_EXPORT virtual void WriteOwnParams (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, IGESData_IGESWriter& IW) const = 0;
92
93
94
95
96   DEFINE_STANDARD_RTTIEXT(IGESData_ReadWriteModule,Interface_ReaderModule)
97
98 protected:
99
100
101
102
103 private:
104
105
106
107
108 };
109
110
111
112
113
114
115
116 #endif // _IGESData_ReadWriteModule_HeaderFile