Open CASCADE Technology 7.8.2.dev
MoniTool_CaseData Class Reference

This class is intended to record data attached to a case to be exploited. Cases can be : More...

#include <MoniTool_CaseData.hxx>

Inheritance diagram for MoniTool_CaseData:

Public Member Functions

 MoniTool_CaseData (const Standard_CString caseid="", const Standard_CString name="")
 Creates a CaseData with a CaseId and a Name (by default not defined)
 
void SetCaseId (const Standard_CString caseid)
 Sets a CaseId.
 
void SetName (const Standard_CString name)
 Sets a Name.
 
Standard_CString CaseId () const
 Returns the CaseId.
 
Standard_CString Name () const
 Returns the Name.
 
Standard_Boolean IsCheck () const
 Tells if <me> is Check (Warning or Fail), else it is Info.
 
Standard_Boolean IsWarning () const
 Tells if <me> is Warning.
 
Standard_Boolean IsFail () const
 Tells if <me> is Fail.
 
void ResetCheck ()
 Resets Check Status, i.e. sets <me> as Info.
 
void SetWarning ()
 Sets <me> as Warning.
 
void SetFail ()
 Sets <me> as Fail.
 
void SetChange ()
 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.
 
void SetReplace (const Standard_Integer num)
 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.
 
void AddData (const Handle< Standard_Transient > &val, const Standard_Integer kind, const Standard_CString name="")
 Unitary adding a data; rather internal.
 
void AddRaised (const Handle< Standard_Failure > &theException, const Standard_CString name="")
 Adds the currently caught exception.
 
void AddShape (const TopoDS_Shape &sh, const Standard_CString name="")
 Adds a Shape (recorded as a HShape)
 
void AddXYZ (const gp_XYZ &aXYZ, const Standard_CString name="")
 Adds a XYZ.
 
void AddXY (const gp_XY &aXY, const Standard_CString name="")
 Adds a XY.
 
void AddReal (const Standard_Real val, const Standard_CString name="")
 Adds a Real.
 
void AddReals (const Standard_Real v1, const Standard_Real v2, const Standard_CString name="")
 Adds two reals (for instance, two parameters)
 
void AddCPU (const Standard_Real lastCPU, const Standard_Real curCPU=0, 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_Real GetCPU () const
 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_Boolean LargeCPU (const Standard_Real maxCPU, const Standard_Real lastCPU, const Standard_Real curCPU=0) 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.
 
void AddGeom (const Handle< Standard_Transient > &geom, const Standard_CString name="")
 Adds a Geometric as a Transient (Curve, Surface ...)
 
void AddEntity (const Handle< Standard_Transient > &ent, 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.
 
void AddText (const Standard_CString text, const Standard_CString name="")
 Adds a Text (as HAsciiString)
 
void AddInteger (const Standard_Integer val, const Standard_CString name="")
 Adds an Integer.
 
void AddAny (const Handle< Standard_Transient > &val, const Standard_CString name="")
 Adds a Transient, with no more meaning.
 
void RemoveData (const Standard_Integer num)
 Removes a Data from its rank. Does nothing if out of range.
 
Standard_Integer NbData () const
 Returns the count of data recorded to a set.
 
Handle< Standard_TransientData (const Standard_Integer nd) const
 Returns a data item (n0 <nd> in the set <num>)
 
Standard_Boolean GetData (const Standard_Integer nd, const Handle< Standard_Type > &type, Handle< Standard_Transient > &val) 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_Integer Kind (const Standard_Integer nd) const
 Returns the kind of a data : KIND TYPE MEANING 0 ANY any (not one of the following) 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.
 
const TCollection_AsciiStringName (const Standard_Integer nd) const
 Returns the name of a data. If it has no name, the string is empty (length = 0)
 
Standard_Integer NameNum (const Standard_CString name) const
 Returns the first suitable data rank for a given name Exact matching (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.
 
TopoDS_Shape Shape (const Standard_Integer nd) const
 Returns a data as a shape, Null if not a shape.
 
Standard_Boolean XYZ (const Standard_Integer nd, gp_XYZ &val) const
 Returns a data as a XYZ (i.e. Geom_CartesianPoint) Returns False if not the good type.
 
Standard_Boolean XY (const Standard_Integer nd, gp_XY &val) const
 Returns a data as a XY (i.e. Geom2d_CartesianPoint) Returns False if not the good type.
 
Standard_Boolean Reals (const Standard_Integer nd, Standard_Real &v1, Standard_Real &v2) const
 Returns a couple of reals (stored in Geom2d_CartesianPoint)
 
Standard_Boolean Real (const Standard_Integer nd, Standard_Real &val) const
 Returns a real or CPU amount (stored in Geom2d_CartesianPoint) (allows an Integer converted to a Real)
 
Standard_Boolean Text (const Standard_Integer nd, Standard_CString &text) const
 Returns a text (stored in TCollection_HAsciiString)
 
Standard_Boolean Integer (const Standard_Integer nd, Standard_Integer &val) const
 Returns an Integer.
 
Message_Msg Msg () 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.
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
Standard_Integer GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object.
 
Standard_Integer DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Static Public Member Functions

static void SetDefWarning (const Standard_CString acode)
 Sets a Code to give a Warning.
 
static void SetDefFail (const Standard_CString acode)
 Sets a Code to give a Fail.
 
static Standard_Integer DefCheck (const Standard_CString acode)
 Returns Check Status for a Code : 0 non/info (default), 1 warning, 2 fail.
 
static void SetDefMsg (const Standard_CString casecode, const Standard_CString mesdef)
 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)
 
static Standard_CString DefMsg (const Standard_CString casecode)
 Returns the message definition for a case code Empty if no message attached.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const char * get_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 

Detailed Description

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)

Constructor & Destructor Documentation

◆ MoniTool_CaseData()

MoniTool_CaseData::MoniTool_CaseData ( const Standard_CString caseid = "",
const Standard_CString name = "" )

Creates a CaseData with a CaseId and a Name (by default not defined)

Member Function Documentation

◆ AddAny()

void MoniTool_CaseData::AddAny ( const Handle< Standard_Transient > & val,
const Standard_CString name = "" )

Adds a Transient, with no more meaning.

◆ AddCPU()

void MoniTool_CaseData::AddCPU ( const Standard_Real lastCPU,
const Standard_Real curCPU = 0,
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.

◆ AddData()

void MoniTool_CaseData::AddData ( const Handle< Standard_Transient > & val,
const Standard_Integer kind,
const Standard_CString name = "" )

Unitary adding a data; rather internal.

◆ AddEntity()

void MoniTool_CaseData::AddEntity ( const Handle< Standard_Transient > & ent,
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.

◆ AddGeom()

void MoniTool_CaseData::AddGeom ( const Handle< Standard_Transient > & geom,
const Standard_CString name = "" )

Adds a Geometric as a Transient (Curve, Surface ...)

◆ AddInteger()

void MoniTool_CaseData::AddInteger ( const Standard_Integer val,
const Standard_CString name = "" )

Adds an Integer.

◆ AddRaised()

void MoniTool_CaseData::AddRaised ( const Handle< Standard_Failure > & theException,
const Standard_CString name = "" )

Adds the currently caught exception.

◆ AddReal()

void MoniTool_CaseData::AddReal ( const Standard_Real val,
const Standard_CString name = "" )

Adds a Real.

◆ AddReals()

void MoniTool_CaseData::AddReals ( const Standard_Real v1,
const Standard_Real v2,
const Standard_CString name = "" )

Adds two reals (for instance, two parameters)

◆ AddShape()

void MoniTool_CaseData::AddShape ( const TopoDS_Shape & sh,
const Standard_CString name = "" )

Adds a Shape (recorded as a HShape)

◆ AddText()

void MoniTool_CaseData::AddText ( const Standard_CString text,
const Standard_CString name = "" )

Adds a Text (as HAsciiString)

◆ AddXY()

void MoniTool_CaseData::AddXY ( const gp_XY & aXY,
const Standard_CString name = "" )

Adds a XY.

◆ AddXYZ()

void MoniTool_CaseData::AddXYZ ( const gp_XYZ & aXYZ,
const Standard_CString name = "" )

Adds a XYZ.

◆ CaseId()

Standard_CString MoniTool_CaseData::CaseId ( ) const

Returns the CaseId.

◆ Data()

Handle< Standard_Transient > MoniTool_CaseData::Data ( const Standard_Integer nd) const

Returns a data item (n0 <nd> in the set <num>)

◆ DefCheck()

static Standard_Integer MoniTool_CaseData::DefCheck ( const Standard_CString acode)
static

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)

◆ DefMsg()

static Standard_CString MoniTool_CaseData::DefMsg ( const Standard_CString casecode)
static

Returns the message definition for a case code Empty if no message attached.

◆ GetCPU()

Standard_Real MoniTool_CaseData::GetCPU ( ) const

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.

◆ GetData()

Standard_Boolean MoniTool_CaseData::GetData ( const Standard_Integer nd,
const Handle< Standard_Type > & type,
Handle< Standard_Transient > & val ) 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.

◆ Integer()

Standard_Boolean MoniTool_CaseData::Integer ( const Standard_Integer nd,
Standard_Integer & val ) const

Returns an Integer.

◆ IsCheck()

Standard_Boolean MoniTool_CaseData::IsCheck ( ) const

Tells if <me> is Check (Warning or Fail), else it is Info.

◆ IsFail()

Standard_Boolean MoniTool_CaseData::IsFail ( ) const

Tells if <me> is Fail.

◆ IsWarning()

Standard_Boolean MoniTool_CaseData::IsWarning ( ) const

Tells if <me> is Warning.

◆ Kind()

Standard_Integer MoniTool_CaseData::Kind ( const Standard_Integer nd) const

Returns the kind of a data : KIND TYPE MEANING 0 ANY any (not one of the following) 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

◆ LargeCPU()

Standard_Boolean MoniTool_CaseData::LargeCPU ( const Standard_Real maxCPU,
const Standard_Real lastCPU,
const Standard_Real curCPU = 0 ) 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.

◆ Msg()

Message_Msg MoniTool_CaseData::Msg ( ) 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

◆ Name() [1/2]

Standard_CString MoniTool_CaseData::Name ( ) const

Returns the Name.

◆ Name() [2/2]

const TCollection_AsciiString & MoniTool_CaseData::Name ( const Standard_Integer nd) const

Returns the name of a data. If it has no name, the string is empty (length = 0)

◆ NameNum()

Standard_Integer MoniTool_CaseData::NameNum ( const Standard_CString name) const

Returns the first suitable data rank for a given name Exact matching (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.

◆ NbData()

Standard_Integer MoniTool_CaseData::NbData ( ) const

Returns the count of data recorded to a set.

◆ Real()

Standard_Boolean MoniTool_CaseData::Real ( const Standard_Integer nd,
Standard_Real & val ) const

Returns a real or CPU amount (stored in Geom2d_CartesianPoint) (allows an Integer converted to a Real)

◆ Reals()

Standard_Boolean MoniTool_CaseData::Reals ( const Standard_Integer nd,
Standard_Real & v1,
Standard_Real & v2 ) const

Returns a couple of reals (stored in Geom2d_CartesianPoint)

◆ RemoveData()

void MoniTool_CaseData::RemoveData ( const Standard_Integer num)

Removes a Data from its rank. Does nothing if out of range.

◆ ResetCheck()

void MoniTool_CaseData::ResetCheck ( )

Resets Check Status, i.e. sets <me> as Info.

◆ SetCaseId()

void MoniTool_CaseData::SetCaseId ( const Standard_CString caseid)

Sets a CaseId.

◆ SetChange()

void MoniTool_CaseData::SetChange ( )

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.

◆ SetDefFail()

static void MoniTool_CaseData::SetDefFail ( const Standard_CString acode)
static

Sets a Code to give a Fail.

◆ SetDefMsg()

static void MoniTool_CaseData::SetDefMsg ( const Standard_CString casecode,
const Standard_CString mesdef )
static

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)

◆ SetDefWarning()

static void MoniTool_CaseData::SetDefWarning ( const Standard_CString acode)
static

Sets a Code to give a Warning.

◆ SetFail()

void MoniTool_CaseData::SetFail ( )

Sets <me> as Fail.

◆ SetName()

void MoniTool_CaseData::SetName ( const Standard_CString name)

Sets a Name.

◆ SetReplace()

void MoniTool_CaseData::SetReplace ( const Standard_Integer num)

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.

◆ SetWarning()

void MoniTool_CaseData::SetWarning ( )

Sets <me> as Warning.

◆ Shape()

TopoDS_Shape MoniTool_CaseData::Shape ( const Standard_Integer nd) const

Returns a data as a shape, Null if not a shape.

◆ Text()

Standard_Boolean MoniTool_CaseData::Text ( const Standard_Integer nd,
Standard_CString & text ) const

Returns a text (stored in TCollection_HAsciiString)

◆ XY()

Standard_Boolean MoniTool_CaseData::XY ( const Standard_Integer nd,
gp_XY & val ) const

Returns a data as a XY (i.e. Geom2d_CartesianPoint) Returns False if not the good type.

◆ XYZ()

Standard_Boolean MoniTool_CaseData::XYZ ( const Standard_Integer nd,
gp_XYZ & val ) const

Returns a data as a XYZ (i.e. Geom_CartesianPoint) Returns False if not the good type.


The documentation for this class was generated from the following file: