Warnings on vc14 were eliminated
[occt.git] / src / IFSelect / IFSelect_WorkLibrary.hxx
1 // Created on: 1993-01-08
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_WorkLibrary_HeaderFile
18 #define _IFSelect_WorkLibrary_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Integer.hxx>
24 #include <Interface_HArray1OfHAsciiString.hxx>
25 #include <Standard_Transient.hxx>
26 #include <Standard_CString.hxx>
27 #include <Standard_Boolean.hxx>
28 class Interface_InterfaceModel;
29 class Interface_Protocol;
30 class IFSelect_ContextWrite;
31 class Interface_EntityIterator;
32 class Interface_CopyTool;
33 class Standard_Transient;
34 class Message_Messenger;
35
36
37 class IFSelect_WorkLibrary;
38 DEFINE_STANDARD_HANDLE(IFSelect_WorkLibrary, Standard_Transient)
39
40 //! This class defines the (empty) frame which can be used to
41 //! enrich a XSTEP set with new capabilities
42 //! In particular, a specific WorkLibrary must give the way for
43 //! Reading a File into a Model, and Writing a Model to a File
44 //! Thus, it is possible to define several Work Libraries for each
45 //! norm, but recommanded to define one general class for each one :
46 //! this general class will define the Read and Write methods.
47 //!
48 //! Also a Dump service is provided, it can produce, according the
49 //! norm, either a parcel of a file for an entity, or any other
50 //! kind of informations relevant for the norm,
51 class IFSelect_WorkLibrary : public Standard_Transient
52 {
53
54 public:
55
56   
57   //! Gives the way to Read a File and transfer it to a Model
58   //! <mod> is the resulting Model, which has to be created by this
59   //! method. In case of error, <mod> must be returned Null
60   //! Return value is a status with free values.
61   //! Simply, 0 is for "Execution OK"
62   //! The Protocol can be used to work (e.g. create the Model, read
63   //! and recognize the Entities)
64   Standard_EXPORT virtual Standard_Integer ReadFile (const Standard_CString name, Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol) const = 0;
65   
66   //! Gives the way to Write a File from a Model.
67   //! <ctx> contains all necessary informations : the model, the
68   //! protocol, the file name, and the list of File Modifiers to be
69   //! applied, also with restricted list of selected entities for
70   //! each one, if required.
71   //! In return, it brings the produced check-list
72   //!
73   //! The WorkLibrary has to query <applied> to get then run the
74   //! ContextWrite by looping like this (example) :
75   //! for (numap = 1; numap <= ctx.NbModifiers(); numap ++) {
76   //! ctx.SetModifier (numap);
77   //! cast ctx.FileModifier()  to specific type -> variable filemod
78   //! if (!filemod.IsNull()) filemod->Perform (ctx,writer);
79   //! filemod then works with ctx. It can, either act on the
80   //! model itself (for instance on its header), or iterate
81   //! on selected entities (Start/Next/More/Value)
82   //! it can call AddFail or AddWarning, as necessary
83   //! }
84   Standard_EXPORT virtual Standard_Boolean WriteFile (IFSelect_ContextWrite& ctx) const = 0;
85   
86   //! Performs the copy of entities from an original model to a new
87   //! one. It must also copy headers if any. Returns True when done.
88   //! The provided default works by copying the individual entities
89   //! designated in the list, by using the general service class
90   //! CopyTool.
91   //! It can be redefined for a norm which, either implements Copy
92   //! by another way (do not forget to Bind each copied result with
93   //! its original entity in TC) and returns True, or does not know
94   //! how to copy and returns False
95   Standard_EXPORT virtual Standard_Boolean CopyModel (const Handle(Interface_InterfaceModel)& original, const Handle(Interface_InterfaceModel)& newmodel, const Interface_EntityIterator& list, Interface_CopyTool& TC) const;
96   
97   //! Gives the way of dumping an entity under a form comprehensive
98   //! for each norm. <model> helps to identify, number ... entities.
99   //! <level> is to be interpreted for each norm (because of the
100   //! formats which can be very different)
101   Standard_EXPORT virtual void DumpEntity (const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol, const Handle(Standard_Transient)& entity, const Handle(Message_Messenger)& S, const Standard_Integer level) const = 0;
102   
103   //! Calls deferred DumpEntity with the recorded default level
104   Standard_EXPORT void DumpEntity (const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol, const Handle(Standard_Transient)& entity, const Handle(Message_Messenger)& S) const;
105   
106   //! Records a default level and a maximum value for level
107   //! level for DumpEntity can go between 0 and <max>
108   //! default value will be <def>
109   Standard_EXPORT void SetDumpLevels (const Standard_Integer def, const Standard_Integer max);
110   
111   //! Returns the recorded default and maximum dump levels
112   //! If none was recorded, max is returned negative, def as zero
113   Standard_EXPORT void DumpLevels (Standard_Integer& def, Standard_Integer& max) const;
114   
115   //! Records a short line of help for a level (0 - max)
116   Standard_EXPORT void SetDumpHelp (const Standard_Integer level, const Standard_CString help);
117   
118   //! Returns the help line recorded for <level>, or an empty string
119   Standard_EXPORT Standard_CString DumpHelp (const Standard_Integer level) const;
120
121
122
123
124   DEFINE_STANDARD_RTTIEXT(IFSelect_WorkLibrary,Standard_Transient)
125
126 protected:
127
128   
129   //! Required to initialise fields
130   Standard_EXPORT IFSelect_WorkLibrary();
131
132
133
134 private:
135
136
137   Standard_Integer thelevdef;
138   Handle(Interface_HArray1OfHAsciiString) thelevhlp;
139
140
141 };
142
143
144
145
146
147
148
149 #endif // _IFSelect_WorkLibrary_HeaderFile