0029915: Porting to VC 2017 : Regressions in Modeling Algorithms on VC 2017
[occt.git] / src / IFSelect / IFSelect_SessionDumper.hxx
1 // Created on: 1993-11-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 _IFSelect_SessionDumper_HeaderFile
18 #define _IFSelect_SessionDumper_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Transient.hxx>
24 #include <Standard_Boolean.hxx>
25 class IFSelect_SessionFile;
26 class Standard_Transient;
27 class TCollection_AsciiString;
28
29
30 class IFSelect_SessionDumper;
31 DEFINE_STANDARD_HANDLE(IFSelect_SessionDumper, Standard_Transient)
32
33 //! A SessionDumper is called by SessionFile. It takes into
34 //! account a set of classes (such as Selections, Dispatches ...).
35 //! SessionFile writes the Type (as defined by cdl) of each Item
36 //! and its general Parameters. It manages the names of the Items.
37 //!
38 //! A SessionDumper must be able to Write the Parameters which are
39 //! own of each Item it takes into account, given its Class, then
40 //! to Recognize the Type and Read its Own Parameters to create
41 //! an Item of this Type with these own Parameters.
42 //!
43 //! Then, there must be defined one sub-type of SessionDumper per
44 //! consistent set of classes (e.g. a package).
45 //!
46 //! By Own Parameters, understand Parameters given at Creation Time
47 //! if there are, or specific of a given class, apart from those
48 //! defined at superclass levels (e.g. Final Selection for a
49 //! Dispatch, Input Selection for a SelectExtract or SelectDeduct,
50 //! Direct Status for a SelectExtract, etc...).
51 //!
52 //! The Parameters are those stored in a WorkSession, they can be
53 //! of Types : IntParam, HAsciiString (for TextParam), Selection,
54 //! Dispatch.
55 //!
56 //! SessionDumpers are organized in a Library which is used by
57 //! SessionFile. They are put at Creation Time in this Library.
58 class IFSelect_SessionDumper : public Standard_Transient
59 {
60
61 public:
62
63   
64   //! Returns the First item of the Library of Dumper. The Next ones
65   //! are then obtained by Next on the returned items
66   Standard_EXPORT static Handle(IFSelect_SessionDumper) First();
67   
68   //! Returns the Next SesionDumper in the Library. Returns a Null
69   //! Handle at the End.
70   Standard_EXPORT Handle(IFSelect_SessionDumper) Next() const;
71   
72   //! Writes the Own Parameters of a given Item, if it forecast to
73   //! manage its Type.
74   //! Returns True if it has recognized the Type of the Item (in
75   //! this case, it is assumed to have written the Own Parameters if
76   //! there are some), False else : in that case, SessionFile will
77   //! try another SessionDumper in the Library.
78   //! WriteOwn can use these methods from SessionFile : SendVoid,
79   //! SendItem, SendText, and if necessary, WorkSession.
80   Standard_EXPORT virtual Standard_Boolean WriteOwn (IFSelect_SessionFile& file, const Handle(Standard_Transient)& item) const = 0;
81   
82   //! Recognizes a Type (given as <type>) then Creates an Item of
83   //! this Type with the Own Parameter, as required.
84   //! Returns True if it has recognized the Type (in this case, it
85   //! is assumed to have created the Item, returned as <item>),
86   //! False else : in that case, SessionFile will try another
87   //! SessionDumper in the Library.
88   //! ReadOwn can use these methods from SessionFile to access Own
89   //! Parameters : NbOwnParams, IsVoid, IsText, TextValue, ItemValue
90   Standard_EXPORT virtual Standard_Boolean ReadOwn (IFSelect_SessionFile& file, const TCollection_AsciiString& type, Handle(Standard_Transient)& item) const = 0;
91
92
93
94
95   DEFINE_STANDARD_RTTIEXT(IFSelect_SessionDumper,Standard_Transient)
96
97 protected:
98
99   
100   //! The Initialization puts a just created SessionDumper in the
101   //! Library of SessionDumper. Then, it suffices to create once
102   //! a SessionDumper to fill the Library with it
103   Standard_EXPORT IFSelect_SessionDumper();
104
105
106
107 private:
108
109
110   Handle(IFSelect_SessionDumper) thenext;
111
112
113 };
114
115
116
117
118
119
120
121 #endif // _IFSelect_SessionDumper_HeaderFile