File: MoniTool_CaseData.hxx

package info (click to toggle)
oce 0.18.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 301,548 kB
  • sloc: cpp: 1,190,609; ansic: 67,225; sh: 11,630; tcl: 7,954; cs: 5,221; python: 2,867; java: 1,522; makefile: 342; xml: 292; perl: 37
file content (305 lines) | stat: -rw-r--r-- 11,841 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _MoniTool_CaseData_HeaderFile
#define _MoniTool_CaseData_HeaderFile

#include <Standard.hxx>
#include <Standard_DefineHandle.hxx>
#include <Handle_MoniTool_CaseData.hxx>

#include <Standard_Integer.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_SequenceOfTransient.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_CString.hxx>
#include <Standard_Boolean.hxx>
#include <Handle_Standard_Transient.hxx>
#include <Standard_Real.hxx>
#include <Handle_Standard_Type.hxx>
class Standard_Transient;
class TopoDS_Shape;
class gp_XYZ;
class gp_XY;
class Standard_Type;
class TCollection_AsciiString;
class Message_Msg;


//! This class is intended to record data attached to a case to be
//! exploited.
//! Cases can be :
//! * internal, i.e. for immediate debug
//! for instance, on an abnormal exception, fill a CaseData
//! in a DB (see class DB) then look at its content by XSDRAW
//! * to record abnormal situation, which cause a warning or fail
//! message, for instance during a transfer
//! This will allow, firstly to build a more comprehensive
//! message (with associated data), secondly to help seeing
//! "what happened"
//! * to record data in order to fix a problem
//! If a CASE is well defined and its fix is well known too,
//! recording a CaseData which identifies the CASE will allow
//! to furstherly call the appropriate fix routine
//!
//! A CaseData is defined by
//! * an optional CASE identifier
//! If it is defined, this will allow systematic exploitation
//! such as calling a fix routine
//! * an optional Check Status, Warning or Fail, else it is Info
//! * a NAME : it just allows to identify where this CaseData was
//! created (help to debug)
//! * a LIST OF DATA
//!
//! Each Data has a type (integer, real etc...) and can have a name
//! Hence, each data may be identified by :
//! * its absolute rank (from 1 to NbData)
//! * its name if it has one (exact matching)
//! * else, an interpreted identifier, which gives the type and
//! the rank in the type (for instance, first integer; etc)
//! (See NameRank)
class MoniTool_CaseData : public MMgt_TShared
{

public:

  
  //! Creates a CaseData with a CaseId and a Name
  //! (by default not defined)
  Standard_EXPORT MoniTool_CaseData(const Standard_CString caseid = "", const Standard_CString name = "");
  
  //! Sets a CaseId
  Standard_EXPORT   void SetCaseId (const Standard_CString caseid) ;
  
  //! Sets a Name
  Standard_EXPORT   void SetName (const Standard_CString name) ;
  
  //! Returns the CaseId
  Standard_EXPORT   Standard_CString CaseId()  const;
  
  //! Returns the Name
  Standard_EXPORT   Standard_CString Name()  const;
  
  //! Tells if <me> is Check (Warning or Fail), else it is Info
  Standard_EXPORT   Standard_Boolean IsCheck()  const;
  
  //! Tells if <me> is Warning
  Standard_EXPORT   Standard_Boolean IsWarning()  const;
  
  //! Tells if <me> is Fail
  Standard_EXPORT   Standard_Boolean IsFail()  const;
  
  //! Resets Check Status, i.e. sets <me> as Info
  Standard_EXPORT   void ResetCheck() ;
  
  //! Sets <me> as Warning
  Standard_EXPORT   void SetWarning() ;
  
  //! Sets <me> as Fail
  Standard_EXPORT   void SetFail() ;
  
  //! Sets the next Add... not to add but to change the data item
  //! designated by its name.
  //! If next Add... is not called with a name, SetChange is ignored
  //! Reset by next Add... , whatever <num> is correct or not
  Standard_EXPORT   void SetChange() ;
  
  //! Sets the next Add... not to add but to replace the data item
  //! <num>, if <num> is between 1 and NbData.
  //! Reset by next Add... , whatever <num> is correct or not
  Standard_EXPORT   void SetReplace (const Standard_Integer num) ;
  
  //! Unitary adding a data; rather internal
  Standard_EXPORT   void AddData (const Handle(Standard_Transient)& val, const Standard_Integer kind, const Standard_CString name = "") ;
  
  //! Adds the currently caught exception
  Standard_EXPORT   void AddRaised (const Standard_CString name = "") ;
  
  //! Adds a Shape (recorded as a HShape)
  Standard_EXPORT   void AddShape (const TopoDS_Shape& sh, const Standard_CString name = "") ;
  
  //! Adds a XYZ
  Standard_EXPORT   void AddXYZ (const gp_XYZ& aXYZ, const Standard_CString name = "") ;
  
  //! Adds a XY
  Standard_EXPORT   void AddXY (const gp_XY& aXY, const Standard_CString name = "") ;
  
  //! Adds a Real
  Standard_EXPORT   void AddReal (const Standard_Real val, const Standard_CString name = "") ;
  
  //! Adds two reals (for instance, two parameters)
  Standard_EXPORT   void AddReals (const Standard_Real v1, const Standard_Real v2, const Standard_CString name = "") ;
  
  //! Adds the CPU time between lastCPU and now
  //! if <curCPU> is given, the CPU amount is  curCPU-lastCPU
  //! else it is currently measured CPU - lastCPU
  //! lastCPU has been read by call to GetCPU
  //! See GetCPU to get amount, and LargeCPU to test large amount
  Standard_EXPORT   void AddCPU (const Standard_Real lastCPU, const Standard_Real curCPU = 0, const Standard_CString name = "") ;
  
  //! Returns the current amount of CPU
  //! This allows to laterly test and record CPU amount
  //! Its value has to be given to LargeCPU and AddCPU
  Standard_EXPORT   Standard_Real GetCPU()  const;
  
  //! Tells if a CPU time amount is large
  //! <maxCPU>  gives the amount over which an amount is large
  //! <lastCPU> gives the start CPU amount
  //! if <curCPU> is given, the tested CPU amount is curCPU-lastCPU
  //! else it is currently measured CPU - lastCPU
  Standard_EXPORT   Standard_Boolean LargeCPU (const Standard_Real maxCPU, const Standard_Real lastCPU, const Standard_Real curCPU = 0)  const;
  
  //! Adds a Geometric as a Transient (Curve, Surface ...)
  Standard_EXPORT   void AddGeom (const Handle(Standard_Transient)& geom, const Standard_CString name = "") ;
  
  //! Adds a Transient, as an Entity from an InterfaceModel for
  //! instance : it will then be printed with the help of a DBPE
  Standard_EXPORT   void AddEntity (const Handle(Standard_Transient)& ent, const Standard_CString name = "") ;
  
  //! Adds a Text (as HAsciiString)
  Standard_EXPORT   void AddText (const Standard_CString text, const Standard_CString name = "") ;
  
  //! Adds an Integer
  Standard_EXPORT   void AddInteger (const Standard_Integer val, const Standard_CString name = "") ;
  
  //! Adds a Transient, with no more meaning
  Standard_EXPORT   void AddAny (const Handle(Standard_Transient)& val, const Standard_CString name = "") ;
  
  //! Removes a Data from its rank. Does nothing if out of range
  Standard_EXPORT   void RemoveData (const Standard_Integer num) ;
  
  //! Returns the count of data recorded to a set
  Standard_EXPORT   Standard_Integer NbData()  const;
  
  //! Returns a data item (n0 <nd> in the set <num>)
  Standard_EXPORT   Handle(Standard_Transient) Data (const Standard_Integer nd)  const;
  
  //! Returns a data item, under control of a Type
  //! If the data item is kind of this type, it is returned in <val>
  //! and the returned value is True
  //! Else, <val> is unchanged and the returned value is False
  Standard_EXPORT   Standard_Boolean GetData (const Standard_Integer nd, const Handle(Standard_Type)& type, Handle(Standard_Transient)& val)  const;
  
  //! Returns the kind of a data :
  //! KIND TYPE      MEANING
  //! 0  ANY       any (not one of the followings)
  //! 1  EX        raised exception
  //! 2  EN        entity
  //! 3  G         geom
  //! 4  SH        shape
  //! 5  XYZ       XYZ
  //! 6  XY or UV  XY
  //! 7  RR        2 reals
  //! 8  R         1 real
  //! 9  CPU       CPU (1 real)
  //! 10 T         text
  //! 11 I         integer
  //!
  //! For NameNum, these codes for TYPE must be given exact
  //! i.e. SH for a Shape, not S nor SHAPE nor SOLID etc
  Standard_EXPORT   Standard_Integer Kind (const Standard_Integer nd)  const;
  
  //! Returns the name of a data. If it has no name, the string is
  //! empty (length = 0)
  Standard_EXPORT  const  TCollection_AsciiString& Name (const Standard_Integer nd)  const;
  
  //! Returns the first suitable data rank for a given name
  //! Exact maching (exact case, no completion) is required
  //! Firstly checks the recorded names
  //! If not found, considers the name as follows :
  //! Name = "TYPE" : search for the first item with this TYPE
  //! Name = "TYPE:nn" : search for the nn.th item with this TYPE
  //! See allowed values in method Kind
  Standard_EXPORT   Standard_Integer NameNum (const Standard_CString name)  const;
  
  //! Returns a data as a shape, Null if not a shape
  Standard_EXPORT   TopoDS_Shape Shape (const Standard_Integer nd)  const;
  
  //! Returns a data as a XYZ (i.e. Geom_CartesianPoint)
  //! Returns False if not the good type
  Standard_EXPORT   Standard_Boolean XYZ (const Standard_Integer nd, gp_XYZ& val)  const;
  
  //! Returns a data as a XY  (i.e. Geom2d_CartesianPoint)
  //! Returns False if not the good type
  Standard_EXPORT   Standard_Boolean XY (const Standard_Integer nd, gp_XY& val)  const;
  
  //! Returns a couple of reals  (stored in Geom2d_CartesianPoint)
  Standard_EXPORT   Standard_Boolean Reals (const Standard_Integer nd, Standard_Real& v1, Standard_Real& v2)  const;
  
  //! Returns a real or CPU amount (stored in Geom2d_CartesianPoint)
  //! (allows an Integer converted to a Real)
  Standard_EXPORT   Standard_Boolean Real (const Standard_Integer nd, Standard_Real& val)  const;
  
  //! Returns a text (stored in TCollection_HAsciiString)
  Standard_EXPORT   Standard_Boolean Text (const Standard_Integer nd, Standard_CString& text)  const;
  
  //! Returns an Integer
  Standard_EXPORT   Standard_Boolean Integer (const Standard_Integer nd, Standard_Integer& val)  const;
  
  //! Returns a Msg from a CaseData : it is build from DefMsg, which
  //! gives the message code plus the designation of items of the
  //! CaseData to be added to the Msg
  //! Empty if no message attached
  //!
  //! Remains to be implemented
  Standard_EXPORT   Message_Msg Msg()  const;
  
  //! Sets a Code to give a Warning
  Standard_EXPORT static   void SetDefWarning (const Standard_CString acode) ;
  
  //! Sets a Code to give a Fail
  Standard_EXPORT static   void SetDefFail (const Standard_CString acode) ;
  
  //! Returns Check Status for a Code : 0 non/info (default),
  //! 1 warning, 2 fail
  //!
  //! Remark : DefCheck is used to set the check status of a
  //! CaseData when it is attached to a case code, it can be changed
  //! later (by SetFail, SetWarning, ResetCheck)
  Standard_EXPORT static   Standard_Integer DefCheck (const Standard_CString acode) ;
  
  //! Attaches a message definition to a case code
  //! This definition includes the message code plus designation of
  //! items of the CaseData to be added to the message (this part
  //! not yet implemented)
  Standard_EXPORT static   void SetDefMsg (const Standard_CString casecode, const Standard_CString mesdef) ;
  
  //! Returns the message definition for a case code
  //! Empty if no message attached
  Standard_EXPORT static   Standard_CString DefMsg (const Standard_CString casecode) ;




  DEFINE_STANDARD_RTTI(MoniTool_CaseData)

protected:




private: 


  Standard_Integer thecheck;
  Standard_Integer thesubst;
  TCollection_AsciiString thecase;
  TCollection_AsciiString thename;
  TColStd_SequenceOfTransient thedata;
  TColStd_SequenceOfInteger thekind;
  TColStd_SequenceOfAsciiString thednam;


};







#endif // _MoniTool_CaseData_HeaderFile