Warnings on vc14 were eliminated
[occt.git] / src / Transfer / Transfer_ResultFromModel.hxx
1 // Created on: 1995-11-16
2 // Created by: Christian CAILLET
3 // Copyright (c) 1995-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 _Transfer_ResultFromModel_HeaderFile
18 #define _Transfer_ResultFromModel_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <TCollection_AsciiString.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Interface_CheckStatus.hxx>
26 #include <MMgt_TShared.hxx>
27 #include <Standard_CString.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <TColStd_HSequenceOfTransient.hxx>
30 class Interface_InterfaceModel;
31 class Transfer_ResultFromTransient;
32 class Transfer_TransientProcess;
33 class Standard_Transient;
34 class Interface_CheckIterator;
35
36
37 class Transfer_ResultFromModel;
38 DEFINE_STANDARD_HANDLE(Transfer_ResultFromModel, MMgt_TShared)
39
40 //! ResultFromModel is used to store a final result stored in a
41 //! TransientProcess, respectfully to its structuration in scopes
42 //! by using a set of ResultFromTransient
43 //! Hence, it can be regarded as a passive equivalent of the
44 //! stored data in the TransientProcess, while an Iterator gives
45 //! a flat view of it.
46 //!
47 //! A ResultFromModel is intended to be attached to the transfer
48 //! of one entity (typically root entity but it is not mandatory)
49 //!
50 //! It is then possible to :
51 //! - Create and fill a ResultFromModel from a TransientProcess,
52 //! by designating a starting entity
53 //! - Fill back the TransientProcess from a ResultFromModel, as it
54 //! were filled by the operation which filled it the first time
55 class Transfer_ResultFromModel : public MMgt_TShared
56 {
57
58 public:
59
60   
61   //! Creates a ResultFromModel, empty
62   Standard_EXPORT Transfer_ResultFromModel();
63   
64   //! Sets starting Model
65   Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
66   
67   //! Sets starting File Name
68   Standard_EXPORT void SetFileName (const Standard_CString filename);
69   
70   //! Returns starting Model (null if not set)
71   Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
72   
73   //! Returns starting File Name (empty if not set)
74   Standard_EXPORT Standard_CString FileName() const;
75   
76   //! Fills from a TransientProcess, with the result attached to
77   //! a starting entity. Considers its Model if it is set.
78   //! This action produces a structured set of ResultFromTransient,
79   //! considering scopes, starting by that of <ent>.
80   //! If <ent> has no recorded result, it remains empty
81   //! Returns True if a result is recorded, False else
82   Standard_EXPORT Standard_Boolean Fill (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& ent);
83   
84   //! Clears some data attached to binders used by TransientProcess,
85   //! which become useless once the transfer has been done,
86   //! by calling Strip on its ResultFromTransient
87   //!
88   //! mode = 0 : minimum, clears data remaining from TransferProcess
89   //! mode = 10 : just keeps file name, label, check status ...,
90   //! and MainResult but only the result (Binder)
91   //! mode = 11 : also clears MainResult (status and names remain)
92   Standard_EXPORT void Strip (const Standard_Integer mode);
93   
94   //! Fills back a TransientProcess from the structured set of
95   //! binders. Also sets the Model.
96   Standard_EXPORT void FillBack (const Handle(Transfer_TransientProcess)& TP) const;
97   
98   //! Returns True if a Result is recorded
99   Standard_EXPORT Standard_Boolean HasResult() const;
100   
101   //! Returns the main recorded ResultFromTransient, or a null
102   Standard_EXPORT Handle(Transfer_ResultFromTransient) MainResult() const;
103   
104   //! Sets a new value for the main recorded ResultFromTransient
105   Standard_EXPORT void SetMainResult (const Handle(Transfer_ResultFromTransient)& amain);
106   
107   //! Returns the label in starting model attached to main entity
108   //! (updated by Fill or SetMainResult, if Model is known)
109   Standard_EXPORT Standard_CString MainLabel() const;
110   
111   //! Returns the label in starting model attached to main entity
112   Standard_EXPORT Standard_Integer MainNumber() const;
113   
114   //! Searches for a key (starting entity) and returns its result
115   //! Returns a null handle if not found
116   Standard_EXPORT Handle(Transfer_ResultFromTransient) ResultFromKey (const Handle(Standard_Transient)& start) const;
117   
118   //! Internal method which returns the list of ResultFromTransient,
119   //! according level (2:complete; 1:sub-level 1; 0:main only)
120   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Results (const Standard_Integer level) const;
121   
122   //! Returns the list of recorded starting entities, ending by the
123   //! root. Entities with check but no transfer result are ignored
124   //! <level> = 2 (D), considers the complete list
125   //! <level> = 1      considers the main result plus immediate subs
126   //! <level> = 0      just the main result
127   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) TransferredList (const Standard_Integer level = 2) const;
128   
129   //! Returns the list of starting entities to which a check status
130   //! is attached.
131   //! <check> = -2 , all entities whatever the check (see result)
132   //! <check> = -1 , entities with no fail (warning allowed)
133   //! <check> =  0 , entities with no check at all
134   //! <check> =  1 , entities with warning but no fail
135   //! <check> =  2 , entities with fail
136   //! <result> : if True, only entities with an attached result
137   //! Remark : result True and check=0 will give an empty list
138   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) CheckedList (const Interface_CheckStatus check, const Standard_Boolean result) const;
139   
140   //! Returns the check-list of this set of results
141   //! <erronly> true : only fails are considered
142   //! <level> = 0 : considers only main binder
143   //! <level> = 1 : considers main binder plus immediate subs
144   //! <level> = 2 (D) : considers all checks
145   Standard_EXPORT Interface_CheckIterator CheckList (const Standard_Boolean erronly, const Standard_Integer level = 2) const;
146   
147   //! Returns the check status with corresponds to the content
148   //! of this ResultFromModel; considers all levels of transfer
149   //! (worst status). Returns CheckAny if not yet computed
150   //! Reads it from recorded status if already computed, else
151   //! recomputes one
152   Standard_EXPORT Interface_CheckStatus CheckStatus() const;
153   
154   //! Computes and records check status (see CheckStatus)
155   //! Does not computes it if already done and <enforce> False
156   Standard_EXPORT Interface_CheckStatus ComputeCheckStatus (const Standard_Boolean enforce);
157
158
159
160
161   DEFINE_STANDARD_RTTIEXT(Transfer_ResultFromModel,MMgt_TShared)
162
163 protected:
164
165
166
167
168 private:
169
170
171   Handle(Interface_InterfaceModel) themodel;
172   TCollection_AsciiString thename;
173   Handle(Transfer_ResultFromTransient) themain;
174   TCollection_AsciiString themlab;
175   Standard_Integer themnum;
176   Interface_CheckStatus themchk;
177
178
179 };
180
181
182
183
184
185
186
187 #endif // _Transfer_ResultFromModel_HeaderFile