1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-18 14:27:39 +03:00

0024002: Overall code and build procedure refactoring -- automatic

Automatic upgrade of OCCT code by command "occt_upgrade . -nocdl":
- WOK-generated header files from inc and sources from drv are moved to src
- CDL files removed
- All packages are converted to nocdlpack
This commit is contained in:
abv
2015-07-12 07:42:38 +03:00
parent 543a996496
commit 42cf5bc1ca
15354 changed files with 623957 additions and 509844 deletions

View File

@@ -1,10 +1,50 @@
MoniTool_AttrList.cxx
MoniTool_AttrList.hxx
MoniTool_CaseData.cxx
MoniTool_CaseData.hxx
MoniTool_DataInfo.cxx
MoniTool_DataInfo.hxx
MoniTool_DataMapIteratorOfDataMapOfShapeTransient.hxx
MoniTool_DataMapIteratorOfDataMapOfTimer.hxx
MoniTool_DataMapOfShapeTransient.hxx
MoniTool_DataMapOfTimer.hxx
MoniTool_Element.cxx
MoniTool_Element.hxx
MoniTool_ElemHasher.cxx
MoniTool_ElemHasher.hxx
MoniTool_HSequenceOfElement.hxx
MoniTool_IndexedDataMapOfShapeTransient.hxx
MoniTool_IntVal.cxx
MoniTool_IntVal.hxx
MoniTool_Macros.hxx
MoniTool_MTHasher.cxx
MoniTool_MTHasher.hxx
MoniTool_MTHasher.lxx
MoniTool_Option.cxx
MoniTool_Option.hxx
MoniTool_OptValue.cxx
MoniTool_OptValue.hxx
MoniTool_Profile.cxx
MoniTool_Profile.hxx
MoniTool_RealVal.cxx
MoniTool_RealVal.hxx
MoniTool_SequenceOfElement.hxx
MoniTool_SignShape.cxx
MoniTool_SignShape.hxx
MoniTool_SignText.cxx
MoniTool_SignText.hxx
MoniTool_Stat.cxx
MoniTool_Stat.hxx
MoniTool_Timer.cxx
MoniTool_Timer.hxx
MoniTool_Timer.lxx
MoniTool_TimerSentry.cxx
MoniTool_TimerSentry.hxx
MoniTool_TimerSentry.lxx
MoniTool_TransientElem.cxx
MoniTool_TransientElem.hxx
MoniTool_TypedValue.cxx
MoniTool_TypedValue.hxx
MoniTool_ValueInterpret.hxx
MoniTool_ValueSatisfies.hxx
MoniTool_Macros.hxx
MoniTool_DataMapOfShapeTransient.hxx
MoniTool_DataMapIteratorOfDataMapOfShapeTransient.hxx
MoniTool_IndexedDataMapOfShapeTransient.hxx
MoniTool_SequenceOfElement.hxx
MoniTool_HSequenceOfElement.hxx
MoniTool_DataMapOfTimer.hxx
MoniTool_DataMapIteratorOfDataMapOfTimer.hxx
MoniTool_ValueType.hxx

View File

@@ -1,82 +0,0 @@
-- Created on: 1998-04-01
-- Created by: Christian CAILLET
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
package MoniTool
---Purpose: This package provides basic tools to help monitoring of data
-- exchange and shapehealing process, such as:
-- - attaching messages to objects
-- - storing recorded objects with attached messages for further use
-- - timers for measuring the performance
uses Standard, MMgt, TCollection, TColStd, Dico,
gp, Geom, Geom2d,
TopoDS, TopTools,
Message, Dico, OSD
is
-- Element, generic Elem, and instance for Transient
class DataInfo; -- used in Elem : this one is for Transient
deferred class Element;
class TransientElem;
class ElemHasher;
class IntVal;
class RealVal;
class AttrList;
class TypedValue;
primitive ValueSatisfies;
-- (val : HAsciiString) returns Boolean, see Satisfies from TypedValue
primitive ValueInterpret;
-- (typval : TypedValue; hval : HAsciiString; native : Boolean)
-- returns HAsciiString, see Interpret from TypedValue
class CaseData;
deferred class SignText;
class SignShape;
class Stat;
class Option;
class Profile;
class OptValue;
enumeration ValueType is
ValueMisc, ValueInteger, ValueReal, ValueIdent, ValueVoid, ValueText,
ValueEnum, ValueLogical, ValueSub, ValueHexa, ValueBinary;
imported DataMapOfShapeTransient;
imported DataMapIteratorOfDataMapOfShapeTransient;
imported IndexedDataMapOfShapeTransient;
imported SequenceOfElement;
imported transient class HSequenceOfElement;
-- Timers
class Timer;
class TimerSentry;
class MTHasher;
imported DataMapOfTimer;
imported DataMapIteratorOfDataMapOfTimer;
end MoniTool;

View File

@@ -1,129 +0,0 @@
-- Created on: 1994-11-04
-- Created by: Christian CAILLET
-- Copyright (c) 1994-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class AttrList from MoniTool
---Purpose : a AttrList allows to record a list of attributes as Transients
-- which can be edited, changed ...
-- Each one is identified by a name
uses CString, Type, Transient,
DictionaryOfTransient from Dico, ValueType from MoniTool
is
Create returns AttrList;
---Purpose : Creates an AttrList, empty
Create (other : AttrList) returns AttrList;
---Purpose : Creates an AttrList from another one, definitions are shared
-- (calls SameAttributes)
-- -- Attributes
SetAttribute (me : in out; name : CString; val : Transient);
---Purpose : Adds an attribute with a given name (replaces the former one
-- with the same name if already exists)
RemoveAttribute (me : in out; name : CString) returns Boolean;
---Purpose : Removes an attribute
-- Returns True when done, False if this attribute did not exist
GetAttribute (me; name : CString; type : Type from Standard;
val : out Transient) returns Boolean;
---Purpose : Returns an attribute from its name, filtered by a type
-- If no attribute has this name, or if it is not kind of this
-- type, <val> is Null and returned value is False
-- Else, it is True
Attribute (me; name : CString) returns Transient;
---Purpose : Returns an attribute from its name. Null Handle if not
-- recorded (whatever Transient, Integer, Real ...)
-- Integer is recorded as IntVal
-- Real is recorded as RealVal
-- Text is recorded as HAsciiString
AttributeType (me; name : CString) returns ValueType from MoniTool;
---Purpose : Returns the type of an attribute :
-- ValueInt , ValueReal , ValueText (String) , ValueIdent (any)
-- or ValueVoid (not recorded)
SetIntegerAttribute (me : in out; name : CString; val : Integer);
---Purpose : Adds an integer value for an attribute
GetIntegerAttribute (me; name : CString; val : out Integer) returns Boolean;
---Purpose : Returns an attribute from its name, as integer
-- If no attribute has this name, or not an integer,
-- <val> is 0 and returned value is False
-- Else, it is True
IntegerAttribute (me; name : CString) returns Integer;
---Purpose : Returns an integer attribute from its name. 0 if not recorded
SetRealAttribute (me : in out; name : CString; val : Real);
---Purpose : Adds a real value for an attribute
GetRealAttribute (me; name : CString; val : out Real) returns Boolean;
---Purpose : Returns an attribute from its name, as real
-- If no attribute has this name, or not a real
-- <val> is 0.0 and returned value is False
-- Else, it is True
RealAttribute (me; name : CString) returns Real;
---Purpose : Returns a real attribute from its name. 0.0 if not recorded
SetStringAttribute (me : in out; name : CString; val : CString);
---Purpose : Adds a String value for an attribute
GetStringAttribute (me; name : CString; val : out CString) returns Boolean;
---Purpose : Returns an attribute from its name, as String
-- If no attribute has this name, or not a String
-- <val> is 0.0 and returned value is False
-- Else, it is True
StringAttribute (me; name : CString) returns CString;
---Purpose : Returns a String attribute from its name. "" if not recorded
AttrList (me) returns DictionaryOfTransient;
---Purpose : Returns the exhaustive list of attributes
SameAttributes (me : in out; other : AttrList);
---Purpose : Gets the list of attributes from <other>, as such, i.e.
-- not copied : attributes are shared, any attribute edited,
-- added, or removed in <other> is also in <me> and vice versa
-- The former list of attributes of <me> is dropped
GetAttributes (me : in out; other : AttrList;
fromname : CString = ""; copied : Boolean = Standard_True);
---Purpose : Gets the list of attributes from <other>, by copying it
-- By default, considers all the attributes from <other>
-- If <fromname> is given, considers only the attributes with
-- name beginning by <fromname>
--
-- For each attribute, if <copied> is True (D), its value is also
-- copied if it is a basic type (Integer,Real,String), else it
-- remains shared between <other> and <me>
--
-- These new attributes are added to the existing ones in <me>,
-- in case of same name, they replace the existing ones
fields
theattrib : DictionaryOfTransient;
end AttrList;

View File

@@ -11,11 +11,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_AttrList.ixx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <MoniTool_AttrList.hxx>
#include <MoniTool_IntVal.hxx>
#include <MoniTool_RealVal.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_HAsciiString.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
MoniTool_AttrList::MoniTool_AttrList () { }

View File

@@ -0,0 +1,159 @@
// Created on: 1994-11-04
// Created by: Christian CAILLET
// Copyright (c) 1994-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_AttrList_HeaderFile
#define _MoniTool_AttrList_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_CString.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Type.hxx>
#include <MoniTool_ValueType.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
class Dico_DictionaryOfTransient;
class Standard_Transient;
//! a AttrList allows to record a list of attributes as Transients
//! which can be edited, changed ...
//! Each one is identified by a name
class MoniTool_AttrList
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an AttrList, empty
Standard_EXPORT MoniTool_AttrList();
//! Creates an AttrList from another one, definitions are shared
//! (calls SameAttributes)
Standard_EXPORT MoniTool_AttrList(const MoniTool_AttrList& other);
//! Adds an attribute with a given name (replaces the former one
//! with the same name if already exists)
Standard_EXPORT void SetAttribute (const Standard_CString name, const Handle(Standard_Transient)& val);
//! Removes an attribute
//! Returns True when done, False if this attribute did not exist
Standard_EXPORT Standard_Boolean RemoveAttribute (const Standard_CString name);
//! Returns an attribute from its name, filtered by a type
//! If no attribute has this name, or if it is not kind of this
//! type, <val> is Null and returned value is False
//! Else, it is True
Standard_EXPORT Standard_Boolean GetAttribute (const Standard_CString name, const Handle(Standard_Type)& type, Handle(Standard_Transient)& val) const;
//! Returns an attribute from its name. Null Handle if not
//! recorded (whatever Transient, Integer, Real ...)
//! Integer is recorded as IntVal
//! Real is recorded as RealVal
//! Text is recorded as HAsciiString
Standard_EXPORT Handle(Standard_Transient) Attribute (const Standard_CString name) const;
//! Returns the type of an attribute :
//! ValueInt , ValueReal , ValueText (String) , ValueIdent (any)
//! or ValueVoid (not recorded)
Standard_EXPORT MoniTool_ValueType AttributeType (const Standard_CString name) const;
//! Adds an integer value for an attribute
Standard_EXPORT void SetIntegerAttribute (const Standard_CString name, const Standard_Integer val);
//! Returns an attribute from its name, as integer
//! If no attribute has this name, or not an integer,
//! <val> is 0 and returned value is False
//! Else, it is True
Standard_EXPORT Standard_Boolean GetIntegerAttribute (const Standard_CString name, Standard_Integer& val) const;
//! Returns an integer attribute from its name. 0 if not recorded
Standard_EXPORT Standard_Integer IntegerAttribute (const Standard_CString name) const;
//! Adds a real value for an attribute
Standard_EXPORT void SetRealAttribute (const Standard_CString name, const Standard_Real val);
//! Returns an attribute from its name, as real
//! If no attribute has this name, or not a real
//! <val> is 0.0 and returned value is False
//! Else, it is True
Standard_EXPORT Standard_Boolean GetRealAttribute (const Standard_CString name, Standard_Real& val) const;
//! Returns a real attribute from its name. 0.0 if not recorded
Standard_EXPORT Standard_Real RealAttribute (const Standard_CString name) const;
//! Adds a String value for an attribute
Standard_EXPORT void SetStringAttribute (const Standard_CString name, const Standard_CString val);
//! Returns an attribute from its name, as String
//! If no attribute has this name, or not a String
//! <val> is 0.0 and returned value is False
//! Else, it is True
Standard_EXPORT Standard_Boolean GetStringAttribute (const Standard_CString name, Standard_CString& val) const;
//! Returns a String attribute from its name. "" if not recorded
Standard_EXPORT Standard_CString StringAttribute (const Standard_CString name) const;
//! Returns the exhaustive list of attributes
Standard_EXPORT Handle(Dico_DictionaryOfTransient) AttrList() const;
//! Gets the list of attributes from <other>, as such, i.e.
//! not copied : attributes are shared, any attribute edited,
//! added, or removed in <other> is also in <me> and vice versa
//! The former list of attributes of <me> is dropped
Standard_EXPORT void SameAttributes (const MoniTool_AttrList& other);
//! Gets the list of attributes from <other>, by copying it
//! By default, considers all the attributes from <other>
//! If <fromname> is given, considers only the attributes with
//! name beginning by <fromname>
//!
//! For each attribute, if <copied> is True (D), its value is also
//! copied if it is a basic type (Integer,Real,String), else it
//! remains shared between <other> and <me>
//!
//! These new attributes are added to the existing ones in <me>,
//! in case of same name, they replace the existing ones
Standard_EXPORT void GetAttributes (const MoniTool_AttrList& other, const Standard_CString fromname = "", const Standard_Boolean copied = Standard_True);
protected:
private:
Handle(Dico_DictionaryOfTransient) theattrib;
};
#endif // _MoniTool_AttrList_HeaderFile

View File

@@ -1,286 +0,0 @@
-- Created on: 1998-04-01
-- Created by: Christian CAILLET
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class CaseData from MoniTool inherits TShared from MMgt
---Purpose : 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)
uses CString, Transient, Type from Standard,
AsciiString from TCollection,
SequenceOfAsciiString from TColStd,
SequenceOfTransient from TColStd, SequenceOfInteger from TColStd,
Shape from TopoDS, XY from gp, XYZ from gp,
Msg from Message
is
Create (caseid : CString = ""; name : CString = "") returns CaseData;
---Purpose : Creates a CaseData with a CaseId and a Name
-- (by default not defined)
SetCaseId (me : mutable; caseid : CString);
---Purpose : Sets a CaseId
SetName (me : mutable; name : CString);
---Purpose : Sets a Name
CaseId (me) returns CString;
---Purpose : Returns the CaseId
Name (me) returns CString;
---Purpose : Returns the Name
IsCheck (me) returns Boolean;
---Purpose : Tells if <me> is Check (Warning or Fail), else it is Info
IsWarning (me) returns Boolean;
---Purpose : Tells if <me> is Warning
IsFail (me) returns Boolean;
---Purpose : Tells if <me> is Fail
ResetCheck (me : mutable);
---Purpose : Resets Check Status, i.e. sets <me> as Info
SetWarning (me : mutable);
---Purpose : Sets <me> as Warning
SetFail (me : mutable);
---Purpose : Sets <me> as Fail
-- Setting Data
SetChange (me : mutable);
---Purpose : 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
SetReplace (me : mutable; num : Integer);
---Purpose : 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
AddData (me : mutable; val : Transient; kind : Integer; name : CString = "");
---Purpose : Unitary adding a data; rather internal
AddRaised (me : mutable; name : CString = "");
---Purpose : Adds the currently caught exception
AddShape (me : mutable; sh : Shape from TopoDS; name : CString = "");
---Purpose : Adds a Shape (recorded as a HShape)
AddXYZ (me : mutable; aXYZ : XYZ from gp; name : CString = "");
---Purpose : Adds a XYZ
AddXY (me : mutable; aXY : XY from gp; name : CString = "");
---Purpose : Adds a XY
AddReal (me : mutable; val : Real; name : CString = "");
---Purpose : Adds a Real
AddReals (me : mutable; v1,v2 : Real; name : CString = "");
---Purpose : Adds two reals (for instance, two parameters)
AddCPU (me : mutable; lastCPU : Real; curCPU : Real = 0; name : CString = "");
---Purpose : 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
GetCPU (me) returns Real;
---Purpose : 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
LargeCPU (me; maxCPU, lastCPU : Real; curCPU : Real = 0) returns Boolean;
---Purpose : 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
AddGeom (me : mutable; geom : Transient; name : CString = "");
---Purpose : Adds a Geometric as a Transient (Curve, Surface ...)
AddEntity (me : mutable; ent : Transient; name : CString = "");
---Purpose : Adds a Transient, as an Entity from an InterfaceModel for
-- instance : it will then be printed with the help of a DBPE
AddText (me : mutable; text : CString; name : CString = "");
---Purpose : Adds a Text (as HAsciiString)
AddInteger(me : mutable; val : Integer; name : CString = "");
---Purpose : Adds an Integer
AddAny (me : mutable; val : Transient; name : CString = "");
---Purpose : Adds a Transient, with no more meaning
RemoveData (me : mutable; num : Integer);
---Purpose : Removes a Data from its rank. Does nothing if out of range
-- Querying Data
NbData (me) returns Integer;
---Purpose : Returns the count of data recorded to a set
Data (me; nd : Integer) returns Transient;
---Purpose : Returns a data item (n0 <nd> in the set <num>)
GetData (me; nd : Integer; type : Type from Standard; val : out Transient)
returns Boolean;
---Purpose : 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
Kind (me; nd : Integer) returns Integer;
---Purpose : 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
Name (me; nd : Integer) returns AsciiString;
---Purpose : Returns the name of a data. If it has no name, the string is
-- empty (length = 0)
---C++ : return const &
NameNum (me; name : CString) returns Integer;
---Purpose : 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
Shape (me; nd : Integer) returns Shape from TopoDS;
---Purpose : Returns a data as a shape, Null if not a shape
XYZ (me; nd : Integer; val : out XYZ from gp) returns Boolean;
---Purpose : Returns a data as a XYZ (i.e. Geom_CartesianPoint)
-- Returns False if not the good type
XY (me; nd : Integer; val : out XY from gp) returns Boolean;
---Purpose : Returns a data as a XY (i.e. Geom2d_CartesianPoint)
-- Returns False if not the good type
Reals (me; nd : Integer; v1,v2 : out Real) returns Boolean;
---Purpose : Returns a couple of reals (stored in Geom2d_CartesianPoint)
Real (me; nd : Integer; val : out Real) returns Boolean;
---Purpose : Returns a real or CPU amount (stored in Geom2d_CartesianPoint)
-- (allows an Integer converted to a Real)
Text (me; nd : Integer; text : out CString) returns Boolean;
---Purpose : Returns a text (stored in TCollection_HAsciiString)
Integer (me; nd : Integer; val : out Integer) returns Boolean;
---Purpose : Returns an Integer
-- Binding with messages and status
-- a CaseData may have a default check status according to its code
-- it can also have a default attached message
Msg (me) returns Msg from Message;
---Purpose : 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
SetDefWarning (myclass; acode : CString);
---Purpose : Sets a Code to give a Warning
SetDefFail (myclass; acode : CString);
---Purpose : Sets a Code to give a Fail
DefCheck (myclass; acode : CString) returns Integer;
---Purpose : 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)
SetDefMsg (myclass; casecode : CString; mesdef : CString);
---Purpose : 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)
DefMsg (myclass; casecode : CString) returns CString;
---Purpose : Returns the message definition for a case code
-- Empty if no message attached
fields
thecheck : Integer;
thesubst : Integer;
thecase : AsciiString;
thename : AsciiString;
thedata : SequenceOfTransient;
thekind : SequenceOfInteger;
thednam : SequenceOfAsciiString;
end CaseData;

View File

@@ -11,25 +11,30 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_CaseData.ixx>
#include <Standard_Failure.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopoDS_HShape.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom2d_CartesianPoint.hxx>
#include <TopAbs.hxx>
//#include <GeomTools.hxx>
#include <TCollection_HAsciiString.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <OSD_Timer.hxx>
// definitions
#include <Dico_DictionaryOfInteger.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Geom2d_CartesianPoint.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <gp_XY.hxx>
#include <gp_XYZ.hxx>
#include <Message_Msg.hxx>
#include <MoniTool_CaseData.hxx>
#include <OSD_Timer.hxx>
#include <Standard_Failure.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TopAbs.hxx>
#include <TopoDS_HShape.hxx>
#include <TopoDS_Shape.hxx>
//#include <GeomTools.hxx>
// definitions
static Handle(Dico_DictionaryOfInteger)& defchecks()
{
static Handle(Dico_DictionaryOfInteger) defch;

View File

@@ -0,0 +1,316 @@
// Created on: 1998-04-01
// Created by: Christian CAILLET
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_CaseData_HeaderFile
#define _MoniTool_CaseData_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.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 <Standard_Real.hxx>
#include <Standard_Type.hxx>
class Standard_Transient;
class TopoDS_Shape;
class gp_XYZ;
class gp_XY;
class TCollection_AsciiString;
class Message_Msg;
class MoniTool_CaseData;
DEFINE_STANDARD_HANDLE(MoniTool_CaseData, MMgt_TShared)
//! 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,MMgt_TShared)
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

View File

@@ -1,35 +0,0 @@
-- Created on: 1996-09-04
-- Created by: Christian CAILLET
-- Copyright (c) 1996-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class DataInfo from MoniTool
---Purpose : Gives informations on an object
-- Used as template to instantiate Elem, etc
-- This class is for Transient
uses CString, Transient, Type
is
Type (myclass; ent : Transient) returns Type;
---Purpose : Returns the Type attached to an object
-- Here, the Dynamic Type of a Transient. Null Type if unknown
TypeName (myclass; ent : Transient) returns CString;
---Purpose : Returns Type Name (string)
-- Allows to name type of non-handled objects
end DataInfo;

View File

@@ -11,7 +11,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_DataInfo.ixx>
#include <MoniTool_DataInfo.hxx>
#include <Standard_Transient.hxx>
Handle(Standard_Type) MoniTool_DataInfo::Type
(const Handle(Standard_Transient)& ent)

View File

@@ -0,0 +1,70 @@
// Created on: 1996-09-04
// Created by: Christian CAILLET
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_DataInfo_HeaderFile
#define _MoniTool_DataInfo_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Type.hxx>
#include <Standard_CString.hxx>
class Standard_Transient;
//! Gives informations on an object
//! Used as template to instantiate Elem, etc
//! This class is for Transient
class MoniTool_DataInfo
{
public:
DEFINE_STANDARD_ALLOC
//! Returns the Type attached to an object
//! Here, the Dynamic Type of a Transient. Null Type if unknown
Standard_EXPORT static Handle(Standard_Type) Type (const Handle(Standard_Transient)& ent);
//! Returns Type Name (string)
//! Allows to name type of non-handled objects
Standard_EXPORT static Standard_CString TypeName (const Handle(Standard_Transient)& ent);
protected:
private:
};
#endif // _MoniTool_DataInfo_HeaderFile

View File

@@ -1,40 +0,0 @@
-- Created on: 1994-11-04
-- Created by: Christian CAILLET
-- Copyright (c) 1994-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class ElemHasher from MoniTool
---Purpose : ElemHasher defines HashCode for Element, which is : ask a
-- Element its HashCode ! Because this is the Element itself
-- which brings the HashCode for its Key
--
-- This class complies to the template given in TCollection by
-- MapHasher itself
uses Element
is
HashCode (myclass; K : Element; Upper : Integer) returns Integer;
---Purpose : Returns a HashCode in the range <0,Upper> for a Element :
-- asks the Element its HashCode then transforms it to be in the
-- required range
IsEqual (myclass; K1, K2 : Element) returns Boolean;
---Purpose : Returns True if two keys are the same.
-- The test does not work on the Elements themselves but by
-- calling their methods Equates
end ElemHasher;

View File

@@ -11,8 +11,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_ElemHasher.ixx>
#include <MoniTool_Element.hxx>
#include <MoniTool_ElemHasher.hxx>
Standard_Integer MoniTool_ElemHasher::HashCode
(const Handle(MoniTool_Element)& K, const Standard_Integer Upper)

View File

@@ -0,0 +1,75 @@
// Created on: 1994-11-04
// Created by: Christian CAILLET
// Copyright (c) 1994-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_ElemHasher_HeaderFile
#define _MoniTool_ElemHasher_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class MoniTool_Element;
//! ElemHasher defines HashCode for Element, which is : ask a
//! Element its HashCode ! Because this is the Element itself
//! which brings the HashCode for its Key
//!
//! This class complies to the template given in TCollection by
//! MapHasher itself
class MoniTool_ElemHasher
{
public:
DEFINE_STANDARD_ALLOC
//! Returns a HashCode in the range <0,Upper> for a Element :
//! asks the Element its HashCode then transforms it to be in the
//! required range
Standard_EXPORT static Standard_Integer HashCode (const Handle(MoniTool_Element)& K, const Standard_Integer Upper);
//! Returns True if two keys are the same.
//! The test does not work on the Elements themselves but by
//! calling their methods Equates
Standard_EXPORT static Standard_Boolean IsEqual (const Handle(MoniTool_Element)& K1, const Handle(MoniTool_Element)& K2);
protected:
private:
};
#endif // _MoniTool_ElemHasher_HeaderFile

View File

@@ -1,66 +0,0 @@
-- Created on: 1994-11-04
-- Created by: Christian CAILLET
-- Copyright (c) 1994-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
deferred class Element from MoniTool inherits TShared
---Purpose : a Element allows to map any kind of object as a Key for a Map.
-- This works by defining, for a Hash Code, that of the real Key,
-- not of the Element which acts only as an intermediate.
-- When a Map asks for the HashCode of a Element, this one returns
-- the code it has determined at creation time
uses CString, Type, Transient, AttrList from MoniTool
is
SetHashCode (me : mutable; code : Integer) is static protected;
---Purpose : Stores the HashCode which corresponds to the Value given to
-- create the Mapper
GetHashCode (me) returns Integer is static;
---Purpose : Returns the HashCode which has been stored by SetHashCode
-- (remark that HashCode could be deferred then be defined by
-- sub-classes, the result is the same)
Equates (me; other : Element) returns Boolean is deferred;
---Purpose : Specific testof equallity : to be defined by each sub-class,
-- must be False if Elements have not the same true Type, else
-- their contents must be compared
ValueType (me) returns Type is virtual;
---Purpose : Returns the Type of the Value. By default, returns the
-- DynamicType of <me>, but can be redefined
ValueTypeName (me) returns CString is virtual;
---Purpose : Returns the name of the Type of the Value. Default is name
-- of ValueType, unless it is for a non-handled object
-- -- Attributes
ListAttr (me) returns AttrList;
---Purpose : Returns (readonly) the Attribute List
---C++ : return const &
ChangeAttr (me : mutable) returns AttrList;
---Purpose : Returns (modifiable) the Attribute List
---C++ : return &
fields
thecode : Integer;
theattrib : AttrList;
end Element;

View File

@@ -11,8 +11,10 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_Element.ixx>
#include <MoniTool_AttrList.hxx>
#include <MoniTool_Element.hxx>
#include <Standard_Type.hxx>
void MoniTool_Element::SetHashCode (const Standard_Integer code)
{ thecode = code; }

View File

@@ -0,0 +1,99 @@
// Created on: 1994-11-04
// Created by: Christian CAILLET
// Copyright (c) 1994-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_Element_HeaderFile
#define _MoniTool_Element_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Integer.hxx>
#include <MoniTool_AttrList.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Type.hxx>
#include <Standard_CString.hxx>
class MoniTool_AttrList;
class MoniTool_Element;
DEFINE_STANDARD_HANDLE(MoniTool_Element, MMgt_TShared)
//! a Element allows to map any kind of object as a Key for a Map.
//! This works by defining, for a Hash Code, that of the real Key,
//! not of the Element which acts only as an intermediate.
//! When a Map asks for the HashCode of a Element, this one returns
//! the code it has determined at creation time
class MoniTool_Element : public MMgt_TShared
{
public:
//! Returns the HashCode which has been stored by SetHashCode
//! (remark that HashCode could be deferred then be defined by
//! sub-classes, the result is the same)
Standard_EXPORT Standard_Integer GetHashCode() const;
//! Specific testof equallity : to be defined by each sub-class,
//! must be False if Elements have not the same true Type, else
//! their contents must be compared
Standard_EXPORT virtual Standard_Boolean Equates (const Handle(MoniTool_Element)& other) const = 0;
//! Returns the Type of the Value. By default, returns the
//! DynamicType of <me>, but can be redefined
Standard_EXPORT virtual Handle(Standard_Type) ValueType() const;
//! Returns the name of the Type of the Value. Default is name
//! of ValueType, unless it is for a non-handled object
Standard_EXPORT virtual Standard_CString ValueTypeName() const;
//! Returns (readonly) the Attribute List
Standard_EXPORT const MoniTool_AttrList& ListAttr() const;
//! Returns (modifiable) the Attribute List
Standard_EXPORT MoniTool_AttrList& ChangeAttr();
DEFINE_STANDARD_RTTI(MoniTool_Element,MMgt_TShared)
protected:
//! Stores the HashCode which corresponds to the Value given to
//! create the Mapper
Standard_EXPORT void SetHashCode (const Standard_Integer code);
private:
Standard_Integer thecode;
MoniTool_AttrList theattrib;
};
#endif // _MoniTool_Element_HeaderFile

View File

@@ -1,36 +0,0 @@
-- Created on: 1997-09-03
-- Created by: Christian CAILLET
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class IntVal from MoniTool inherits TShared from MMgt
---Purpose : An Integer through a Handle (i.e. managed as TShared)
uses Integer
is
Create (val : Integer = 0) returns IntVal;
Value (me) returns Integer;
CValue (me : mutable) returns Integer;
---C++ : return &
fields
theval : Integer;
end IntVal;

View File

@@ -11,7 +11,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_IntVal.ixx>
#include <MoniTool_IntVal.hxx>
#include <Standard_Type.hxx>
MoniTool_IntVal::MoniTool_IntVal (const Standard_Integer val) { theval = val; }

View File

@@ -0,0 +1,67 @@
// Created on: 1997-09-03
// Created by: Christian CAILLET
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_IntVal_HeaderFile
#define _MoniTool_IntVal_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx>
class MoniTool_IntVal;
DEFINE_STANDARD_HANDLE(MoniTool_IntVal, MMgt_TShared)
//! An Integer through a Handle (i.e. managed as TShared)
class MoniTool_IntVal : public MMgt_TShared
{
public:
Standard_EXPORT MoniTool_IntVal(const Standard_Integer val = 0);
Standard_EXPORT Standard_Integer Value() const;
Standard_EXPORT Standard_Integer& CValue();
DEFINE_STANDARD_RTTI(MoniTool_IntVal,MMgt_TShared)
protected:
private:
Standard_Integer theval;
};
#endif // _MoniTool_IntVal_HeaderFile

View File

@@ -1,36 +0,0 @@
-- Created on: 2001-12-19
-- Created by: Sergey KUUL
-- Copyright (c) 2001-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class MTHasher from MoniTool
---Purpose:
-- The auxiliary class provides hash code for mapping objects
is
HashCode(myclass; Str : CString; Upper : Integer) returns Integer;
---C++: inline
---Purpose: Returns a HasCode value for the CString <Str> in the
-- range 0..Upper.
-- Default ::HashCode(Str,Upper)
IsEqual(myclass; Str1, Str2 : CString) returns Boolean;
---C++: inline
---Purpose: Returns True when the two CString are the same. Two
-- same strings must have the same hashcode, the
-- contrary is not necessary.
-- Default Str1 == Str2
end MTHasher;

View File

@@ -0,0 +1,72 @@
// Created on: 2001-12-19
// Created by: Sergey KUUL
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_MTHasher_HeaderFile
#define _MoniTool_MTHasher_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_CString.hxx>
#include <Standard_Boolean.hxx>
//! The auxiliary class provides hash code for mapping objects
class MoniTool_MTHasher
{
public:
DEFINE_STANDARD_ALLOC
//! Returns a HasCode value for the CString <Str> in the
//! range 0..Upper.
//! Default ::HashCode(Str,Upper)
static Standard_Integer HashCode (const Standard_CString Str, const Standard_Integer Upper);
//! Returns True when the two CString are the same. Two
//! same strings must have the same hashcode, the
//! contrary is not necessary.
//! Default Str1 == Str2
static Standard_Boolean IsEqual (const Standard_CString Str1, const Standard_CString Str2);
protected:
private:
};
#include <MoniTool_MTHasher.lxx>
#endif // _MoniTool_MTHasher_HeaderFile

View File

@@ -1,109 +0,0 @@
-- Created on: 1999-12-17
-- Created by: Christian CAILLET
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class OptValue from MoniTool
---Purpose : This class allows two kinds of use
--
-- As an object, a OptValue can be put in any operator or
-- algorithm ... to use an Option of a Profile, by recording
-- its value, hence avoiding to query the Profile eachtime
--
-- This object brings a value which can be set as coming from a
-- Profile, with a configuration name and for an Option name
-- This value is evaluated then returned immediately
--
-- As a class, it can be redefined to work on a dedicated
-- Profile, provided by such or such specific way (as static
-- context for instance)
--
-- To change configuration, etc... can be done by querying and
-- editing the Profile
uses AsciiString from TCollection, Transient,
Profile from MoniTool
is
Create (opt : CString = "") returns OptValue;
---Purpose : Creates an OptValue on a given Option
-- This allows to use "shortcut" method to set the value
--
-- WARNING : loading is not done at creation time. It must be
-- done explicitly by call to Load
--
-- The reason comes from C++ : the Profile being virtual, and
-- intended to be redefined in sub-classes, must not be used in
-- the constructor. A separate method, called on the object
-- already created with its true type, must be called after
-- Methods to set an OptValue
-- Two kinds : basic methods (which require complete set of arguments)
-- and shortcuts (which allow to use pre-defined Profile and Option)
-- Basic Methods
Clear (me : in out);
---Purpose : Clears the Value of the OptValue
SetValue (me : in out; prof : Profile; opt : CString; fast : Boolean = Standard_True);
---Purpose : Sets the value as coming from the Profile, according to an
-- Option name. Access as Fast or regular
-- If no value is available, the former one remains : can be
-- cleared by call to Clear
-- Context
-- It is defined by the Option name given when creating the OptValue,
-- and the Profile, provided by a specific virtual method : Prof
Prof (me) returns Profile is virtual;
---Purpose : Returns the Profile which can be used by Short Cut methods
-- Defaults returns a Null Handle, can be redefined
-- For instance, to return a static used as dictionary or context
-- Short Cuts
-- They suppose that Profile is provided and that Option name has been
-- given when creating
Load (me : in out; fast : Boolean = Standard_True);
---Purpose : Sets the value from the Profile returned by method Prof,
-- and Option Name given at creation time.
-- FastValue by default, else Value
--
-- Does not check if already loaded : reloads anyway
-- IsLoaded allows to test
-- Returned Value
IsLoaded (me) returns Boolean;
---Purpose : Says if the OptValue is already loaded (i.e. Value defined)
Value (me; val : out Transient);
---Purpose : Returns the Value set by, either SetConf or SetValue
-- Can be Null ... (if not set or not properly set)
--
-- Returned as Argument, hence avoiding DownCast
-- Warning : type is not controlled
Delete (me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~MoniTool_OptValue() { Delete(); }"
fields
theopt : AsciiString;
theval : Transient;
end OptValue;

View File

@@ -11,7 +11,10 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_OptValue.ixx>
#include <MoniTool_OptValue.hxx>
#include <MoniTool_Profile.hxx>
#include <Standard_Transient.hxx>
MoniTool_OptValue::MoniTool_OptValue (const Standard_CString opt)
: theopt (opt)

View File

@@ -0,0 +1,126 @@
// Created on: 1999-12-17
// Created by: Christian CAILLET
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_OptValue_HeaderFile
#define _MoniTool_OptValue_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_CString.hxx>
#include <Standard_Boolean.hxx>
class Standard_Transient;
class MoniTool_Profile;
//! This class allows two kinds of use
//!
//! As an object, a OptValue can be put in any operator or
//! algorithm ... to use an Option of a Profile, by recording
//! its value, hence avoiding to query the Profile eachtime
//!
//! This object brings a value which can be set as coming from a
//! Profile, with a configuration name and for an Option name
//! This value is evaluated then returned immediately
//!
//! As a class, it can be redefined to work on a dedicated
//! Profile, provided by such or such specific way (as static
//! context for instance)
//!
//! To change configuration, etc... can be done by querying and
//! editing the Profile
class MoniTool_OptValue
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an OptValue on a given Option
//! This allows to use "shortcut" method to set the value
//!
//! WARNING : loading is not done at creation time. It must be
//! done explicitly by call to Load
//!
//! The reason comes from C++ : the Profile being virtual, and
//! intended to be redefined in sub-classes, must not be used in
//! the constructor. A separate method, called on the object
//! already created with its true type, must be called after
Standard_EXPORT MoniTool_OptValue(const Standard_CString opt = "");
//! Clears the Value of the OptValue
Standard_EXPORT void Clear();
//! Sets the value as coming from the Profile, according to an
//! Option name. Access as Fast or regular
//! If no value is available, the former one remains : can be
//! cleared by call to Clear
Standard_EXPORT void SetValue (const Handle(MoniTool_Profile)& prof, const Standard_CString opt, const Standard_Boolean fast = Standard_True);
//! Returns the Profile which can be used by Short Cut methods
//! Defaults returns a Null Handle, can be redefined
//! For instance, to return a static used as dictionary or context
Standard_EXPORT virtual Handle(MoniTool_Profile) Prof() const;
//! Sets the value from the Profile returned by method Prof,
//! and Option Name given at creation time.
//! FastValue by default, else Value
//!
//! Does not check if already loaded : reloads anyway
//! IsLoaded allows to test
Standard_EXPORT void Load (const Standard_Boolean fast = Standard_True);
//! Says if the OptValue is already loaded (i.e. Value defined)
Standard_EXPORT Standard_Boolean IsLoaded() const;
//! Returns the Value set by, either SetConf or SetValue
//! Can be Null ... (if not set or not properly set)
//!
//! Returned as Argument, hence avoiding DownCast
//! Warning : type is not controlled
Standard_EXPORT void Value (Handle(Standard_Transient)& val) const;
Standard_EXPORT virtual void Delete();
Standard_EXPORT virtual ~MoniTool_OptValue() { Delete(); }
protected:
private:
TCollection_AsciiString theopt;
Handle(Standard_Transient) theval;
};
#endif // _MoniTool_OptValue_HeaderFile

View File

@@ -1,144 +0,0 @@
-- Created on: 1998-12-14
-- Created by: Christian CAILLET
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Option from MoniTool inherits TShared from MMgt
---Purpose : An Option gives a way of recording an enumerated list of
-- instances of a given class, each instance being identified
-- by a case name.
--
-- Also, an Option allows to manage basic types through a Typed
-- Value (which also applies to Static Parameter). It may record
-- an enumerated list of values for a TypedValue or Static
-- Parameter, each of them is recorded as a string (HAsciiString)
--
-- An Option is defined by the type of the class to be optioned,
-- or (mutually exclusive) the TypedValue/Static of which values
-- are to be optioned, a specific name, a list of named values.
-- It brings a current case with its name and value
-- It may also have a default case (the first recorded one if not
-- precised)
--
-- An Option may be created from another one, by sharing its Type
-- and its list of Items (one per case), with the same name or
-- another one. It may then be duplicated to break this sharing.
uses CString, Transient, Type from Standard,
AsciiString from TCollection, HSequenceOfAsciiString from TColStd,
DictionaryOfTransient from Dico, TypedValue from MoniTool
is
Create (atype : Type; aname : CString) returns Option;
---Purpose : Creates an Option from scratch, with a Type and a Name
Create (aval : TypedValue; aname : CString = "") returns Option;
---Purpose : Creates an Option for a TypedValue (for basic, non-cdl-typed,
-- value : integer, real, string ...)
-- If <name> is not given, the name of the TypedValue is taken
-- Remark that Type is then enforced to TCollection_HAsciiString
Create (other : Option; aname : CString = "") returns Option;
---Purpose : Creates an Option from another one, the name can be redefined
-- The Type remains the same. The list of Items, too, it can also
-- be later duplicated by call to Duplicate
Add (me : mutable; name : CString; val : Transient) returns Boolean;
---Purpose : Adds an item : value and name (replaces it if name is already
-- recorded)
-- Returns True when done, False if <val> is not Kind of the
-- definition Type
-- For a TypedValue, val must be a HAsciiString, its content must
-- satisfy the definition of the TypedValue
AddBasic (me : mutable; name : CString; val : CString = "") returns Boolean;
---Purpose : Short-cut to add an item for a TypedValue (basic type) : name
-- is the name of the case, val is its value as a CString
-- If val is not provided, val = name is assumed
-- Returns True when done, False if this Option is not for a
-- TypedValue or if the new value does not satisfy the definition
-- of the TypedValue
Duplicate (me : mutable);
---Purpose : Duplicates the list of items
-- It starts with the same definitions as before Duplicate, but
-- it is not longer shared with other options
Name (me) returns AsciiString;
---Purpose : Returns the Name of the Option
---C++ : return const &
Type (me) returns Type;
---Purpose : Returns the Type of the Option
TypedValue (me) returns TypedValue;
---Purpose : Returns the TypedValue of the Option, or a Null Handle
Items (me) returns DictionaryOfTransient is private;
---Purpose : Returns the list of items, to be shared (to copy an option)
Item (me; name : CString; val : out Transient) returns Boolean;
---Purpose : Gives the value bound with a name, in val
-- Returns True if <name> is found, False else
-- This way of returning a Transient, bound with the Type Control
-- avoids DownCast and ensures the value is directly usable
ItemList (me) returns HSequenceOfAsciiString;
---Purpose : Returns the list of available item names
Aliases (me; name : CString; exact : Boolean = Standard_True)
returns HSequenceOfAsciiString;
---Purpose : Returns the list of cases, other than <name>, which bring the
-- same value as <name>
-- Empty list (not a Null Handle) if no alias, or <name> unknown
-- if <exact> is True (D), exact name is required, no completion
-- if <exact> is False and <name> is not complete, but addresses
-- only one item, completion is done and the list includes the
-- complete name
-- Switch actions
Switch (me : mutable; name : CString) returns Boolean;
---Purpose : Commands the Option to switch on an item name
-- Returns True when done, False if <name> is not recorded
-- (in that case, former switch remains unchanged)
-- If no switch has been called, it is active on the last added
-- items
CaseName (me) returns AsciiString from TCollection;
---Purpose : Returns the Name of the currently switched item (Case)
---C++ : return const &
CaseValue (me) returns Transient;
---Purpose : Returns the Value of the currently switch item
-- To be down-casted as needed before use
Value (me; val : out Transient);
---Purpose : Returns the Value of the currently switch item
-- This way of returning a Transient, bound with the Type Control
-- avoids DownCast and ensures the value is directly usable
-- For a TypedValue, returns the corresponding HAsciiString
fields
thename : AsciiString;
thetype : Type;
thevalue : TypedValue;
theitems : DictionaryOfTransient;
thecase : AsciiString;
theval : Transient;
end Option;

View File

@@ -11,10 +11,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_Option.ixx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <TCollection_HAsciiString.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <MoniTool_Option.hxx>
#include <MoniTool_TypedValue.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
MoniTool_Option::MoniTool_Option
(const Handle(Standard_Type)& atype, const Standard_CString aname)

View File

@@ -0,0 +1,177 @@
// Created on: 1998-12-14
// Created by: Christian CAILLET
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_Option_HeaderFile
#define _MoniTool_Option_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_Type.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_CString.hxx>
#include <Standard_Boolean.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
class MoniTool_TypedValue;
class Dico_DictionaryOfTransient;
class Standard_Transient;
class TCollection_AsciiString;
class MoniTool_Option;
DEFINE_STANDARD_HANDLE(MoniTool_Option, MMgt_TShared)
//! An Option gives a way of recording an enumerated list of
//! instances of a given class, each instance being identified
//! by a case name.
//!
//! Also, an Option allows to manage basic types through a Typed
//! Value (which also applies to Static Parameter). It may record
//! an enumerated list of values for a TypedValue or Static
//! Parameter, each of them is recorded as a string (HAsciiString)
//!
//! An Option is defined by the type of the class to be optioned,
//! or (mutually exclusive) the TypedValue/Static of which values
//! are to be optioned, a specific name, a list of named values.
//! It brings a current case with its name and value
//! It may also have a default case (the first recorded one if not
//! precised)
//!
//! An Option may be created from another one, by sharing its Type
//! and its list of Items (one per case), with the same name or
//! another one. It may then be duplicated to break this sharing.
class MoniTool_Option : public MMgt_TShared
{
public:
//! Creates an Option from scratch, with a Type and a Name
Standard_EXPORT MoniTool_Option(const Handle(Standard_Type)& atype, const Standard_CString aname);
//! Creates an Option for a TypedValue (for basic, non-cdl-typed,
//! value : integer, real, string ...)
//! If <name> is not given, the name of the TypedValue is taken
//! Remark that Type is then enforced to TCollection_HAsciiString
Standard_EXPORT MoniTool_Option(const Handle(MoniTool_TypedValue)& aval, const Standard_CString aname = "");
//! Creates an Option from another one, the name can be redefined
//! The Type remains the same. The list of Items, too, it can also
//! be later duplicated by call to Duplicate
Standard_EXPORT MoniTool_Option(const Handle(MoniTool_Option)& other, const Standard_CString aname = "");
//! Adds an item : value and name (replaces it if name is already
//! recorded)
//! Returns True when done, False if <val> is not Kind of the
//! definition Type
//! For a TypedValue, val must be a HAsciiString, its content must
//! satisfy the definition of the TypedValue
Standard_EXPORT Standard_Boolean Add (const Standard_CString name, const Handle(Standard_Transient)& val);
//! Short-cut to add an item for a TypedValue (basic type) : name
//! is the name of the case, val is its value as a CString
//! If val is not provided, val = name is assumed
//! Returns True when done, False if this Option is not for a
//! TypedValue or if the new value does not satisfy the definition
//! of the TypedValue
Standard_EXPORT Standard_Boolean AddBasic (const Standard_CString name, const Standard_CString val = "");
//! Duplicates the list of items
//! It starts with the same definitions as before Duplicate, but
//! it is not longer shared with other options
Standard_EXPORT void Duplicate();
//! Returns the Name of the Option
Standard_EXPORT const TCollection_AsciiString& Name() const;
//! Returns the Type of the Option
Standard_EXPORT Handle(Standard_Type) Type() const;
//! Returns the TypedValue of the Option, or a Null Handle
Standard_EXPORT Handle(MoniTool_TypedValue) TypedValue() const;
//! Gives the value bound with a name, in val
//! Returns True if <name> is found, False else
//! This way of returning a Transient, bound with the Type Control
//! avoids DownCast and ensures the value is directly usable
Standard_EXPORT Standard_Boolean Item (const Standard_CString name, Handle(Standard_Transient)& val) const;
//! Returns the list of available item names
Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) ItemList() const;
//! Returns the list of cases, other than <name>, which bring the
//! same value as <name>
//! Empty list (not a Null Handle) if no alias, or <name> unknown
//! if <exact> is True (D), exact name is required, no completion
//! if <exact> is False and <name> is not complete, but addresses
//! only one item, completion is done and the list includes the
//! complete name
Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) Aliases (const Standard_CString name, const Standard_Boolean exact = Standard_True) const;
//! Commands the Option to switch on an item name
//! Returns True when done, False if <name> is not recorded
//! (in that case, former switch remains unchanged)
//! If no switch has been called, it is active on the last added
//! items
Standard_EXPORT Standard_Boolean Switch (const Standard_CString name);
//! Returns the Name of the currently switched item (Case)
Standard_EXPORT const TCollection_AsciiString& CaseName() const;
//! Returns the Value of the currently switch item
//! To be down-casted as needed before use
Standard_EXPORT Handle(Standard_Transient) CaseValue() const;
//! Returns the Value of the currently switch item
//! This way of returning a Transient, bound with the Type Control
//! avoids DownCast and ensures the value is directly usable
//! For a TypedValue, returns the corresponding HAsciiString
Standard_EXPORT void Value (Handle(Standard_Transient)& val) const;
DEFINE_STANDARD_RTTI(MoniTool_Option,MMgt_TShared)
protected:
private:
//! Returns the list of items, to be shared (to copy an option)
Standard_EXPORT Handle(Dico_DictionaryOfTransient) Items() const;
TCollection_AsciiString thename;
Handle(Standard_Type) thetype;
Handle(MoniTool_TypedValue) thevalue;
Handle(Dico_DictionaryOfTransient) theitems;
TCollection_AsciiString thecase;
Handle(Standard_Transient) theval;
};
#endif // _MoniTool_Option_HeaderFile

View File

@@ -1,214 +0,0 @@
-- Created on: 1998-12-14
-- Created by: Christian CAILLET
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Profile from MoniTool inherits TShared from MMgt
---Purpose : A Profile gives access to a set of options :
-- - it defines and gives access to options, by names specific
-- to this Profile, defaulted to basic names of the Options
-- - it records one or more Configurations, each of one is
-- identified by a name, and commands for each option a switch
-- value
-- - a Configuration may be partial, i.e. concern only a subset
-- of the complete list of options
-- - Values are accessed through a Current Configuration, which
-- name is fixed as ".", which can cumulate several
-- configurations (especially when they are partial)
--
-- It may also bring a "fast" access to values, which has been
-- formerly computed from current configuration or another given
-- one. But its up-to-date status regarding existing
-- configurations is not checked : it may be recomputed or
-- cleared at any time. If not set, the current configuration
-- is then taken
uses CString, Transient, AsciiString from TCollection,
HSequenceOfAsciiString from TColStd,
DictionaryOfTransient from Dico,
Option
is
Create returns Profile;
---Purpose : Creates an empty Profile, with an empty Current Configuration
-- (named ".")
-- Declaration of the Options
AddOption (me : mutable; option : Option; name : CString = "");
---Purpose : Adds an Option, with a Name, by default takes the Name of the
-- Option
Option (me; name : CString) returns Option;
---Purpose : Returns an Option from its Name. Null Handle if unknown
OptionList (me) returns HSequenceOfAsciiString;
---Purpose : Returns the list of Option Names
TypedValueList (me) returns HSequenceOfAsciiString;
---Purpose : Returns the list of Option Names which are defined on a
-- TypedValue/Static, i.e. for Basic Type
-- Declaration of the Configurations
NewConf (me : mutable; confname : CString);
---Purpose : Adds a new Configuration, yet empty, then filled by AddSwitch
-- If <confname> already existed, it is replaced from scratch
-- While AddConf creates new Conf only if it does not yet exist
--
-- Remark : the Current Configuration "." may not be changed
AddConf (me : mutable; confname : CString);
---Purpose : Adds a new Configuration, yet empty, then filled by AddSwitch
-- If <confname> already existed, it is kept as it is
-- While NewConf restrts from scratch anyway
--
-- Remark : the Current Configuration "." may not be changed
HasConf (me; confname : CString) returns Boolean;
---Purpose : Tells if <confname> is known as a Configuration
ConfList (me) returns HSequenceOfAsciiString;
---Purpose : Returns the list of Configuration Names, including Current "."
Conf (me; confname : CString) returns DictionaryOfTransient is private;
---Purpose : Internal
ClearConf (me : mutable; confname : CString) returns Boolean;
---Purpose : Clears a configuration (does not remove it)
-- A cleared configuration has no effect, it can be reloaded
AddFromOtherConf (me : mutable; confname, otherconf : CString) returns Boolean;
---Purpose : Adds the definitions from the configuration <otherconf> to
-- those of <confname>
-- Returns True if done, False if confname or otherconf are unknown
SetFromCurrent (me : mutable; confname : CString) returns Boolean;
---Purpose : Sets the definitions of a configuration from the actual state
-- (current configuration plus current state of options for those
-- which are not recorded in current conf)
AddSwitch (me : mutable; confname, optname : CString; casename : CString = "") returns Boolean;
---Purpose : Adds to the Configuration <confname>, for the option <optname>
-- the command to switch it to <casename>
-- If <casename> is not given, records the actual current
-- CaseName of this Option
-- Returns True if done, False if <confname> or <optname> is
-- unknown, or <casename> not allowed for <optname>
RemoveSwitch (me : mutable; confname, optname : CString) returns Boolean;
---Purpose : Removes from the Configuration <confname>, the switch for the
-- option <optname>. Hence, it will consider the basic default
-- switch for this option
-- Returns True if done or switch was not recorded, False if
-- <confname> or <optname> is unknown
SwitchList (me; confname : CString;
optlist, caselist : out HSequenceOfAsciiString);
---Purpose : Returns the list of switches properly concerned by a config :
-- two lists in parallel, <optlist> lists the names of options
-- and for each one, <caselist> gives the case for this config
-- Access to the state (Configuration)
SetCurrent (me : mutable; confname : CString) returns Boolean;
---Purpose : Copies (Cumulates) the definition of <confname> to current
-- Records the current name as the last current setting
--
-- Returns True if done, False (and does nothing> if <confname>
-- is not recorded as a Configuration
-- If no SetCurrent has been called, the last added one is taken
--
-- Remark : SetCurrent is for the Profile : the individual
-- options are not switched themselves, they are only queried
-- To switch the options themselves, see below RecordCurrent
--
-- Remark : for Options which are listed in the Profile but not
-- in the current Configuration, their current switch is taken
RecordCurrent (me : mutable);
---Purpose : Records the switches of current configuration in the options
-- themselves
Current (me) returns AsciiString;
---Purpose : Returns the name of last current configuration
---C++ : return const &
CaseName (me; optname : CString; proper : Boolean = Standard_False)
returns AsciiString;
---Purpose : Returns the selected case name of option <optname> in current
-- configuration
-- Empty String if <optname> unknown
--
-- If <proper> is False (D), if <optname> is not recorded in the
-- current configuration, the own current name of the option
-- itself is taken
-- Else, an empty string is returned
CaseValue (me; optname : CString) returns Transient;
---Purpose : Returns the Value of the switch selected for option <optname>
-- in current configuration
-- Null Handle if <optname> unknown
-- To be down-casted as needed before use
Value (me; optname : CString; val : out Transient) returns Boolean;
---Purpose : Returns the Value of the switch selected for option <optname>
-- in current configuration
-- Returns True if done, False + Null Handle if <optname> unknown
-- This way of returning a Transient, bound with the Type Control
-- avoids DownCast and ensures the value is directly usable
SetTypedValues (me; proper : Boolean = Standard_False; name : CString = "");
---Purpose : For the Options which are defined with a TypedValue/Static,
-- takes the value defined in current configuration, and sets
-- the TypedValue with it
--
-- If <proper> is False (D), takes the current value, whatever
-- it is properly recorded in current configuration or not
-- If <proper> is True, sets the value only if it is properly
-- recorded in the current configuration
--
-- By default, considers all the Options with a TypedValue
-- If <name> is given, considers the Options of which the name
-- begins by <name>
-- Fast Access
SetFast (me : mutable; confname : CString = "");
---Purpose : Recomputes fast access from the definition of a configuration
-- By default, the current one
-- Else, a configuration identified by its name
ClearFast (me : mutable);
---Purpose : Clears definitions of fast access
FastValue (me; optname : CString; val : out Transient) returns Boolean;
---Purpose : Gets the value corresponding to Option <optname>, as fast
-- If not defined as fast, check "normal" access by calling Value
-- Returns True if OK (either Fast or normal), False if not found
-- (if not found, <val> is returned Null Handle)
fields
theopts : DictionaryOfTransient;
theconfs : DictionaryOfTransient;
-- each conf is itself a DictionaryOfTransient which brings strings
thecurname : AsciiString;
thecurconf : DictionaryOfTransient;
thefastval : DictionaryOfTransient;
end Profile;

View File

@@ -11,12 +11,16 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_Profile.ixx>
#include <TCollection_HAsciiString.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <MoniTool_TypedValue.hxx>
#include <MoniTool_Option.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <MoniTool_Option.hxx>
#include <MoniTool_Profile.hxx>
#include <MoniTool_TypedValue.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
static Standard_Boolean IsCurrent (const Standard_CString name)
{ return (name[0] == '.' && name[1] == '\0'); }

View File

@@ -0,0 +1,237 @@
// Created on: 1998-12-14
// Created by: Christian CAILLET
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_Profile_HeaderFile
#define _MoniTool_Profile_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_CString.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
#include <Standard_Boolean.hxx>
class Dico_DictionaryOfTransient;
class MoniTool_Option;
class TCollection_AsciiString;
class Standard_Transient;
class MoniTool_Profile;
DEFINE_STANDARD_HANDLE(MoniTool_Profile, MMgt_TShared)
//! A Profile gives access to a set of options :
//! - it defines and gives access to options, by names specific
//! to this Profile, defaulted to basic names of the Options
//! - it records one or more Configurations, each of one is
//! identified by a name, and commands for each option a switch
//! value
//! - a Configuration may be partial, i.e. concern only a subset
//! of the complete list of options
//! - Values are accessed through a Current Configuration, which
//! name is fixed as ".", which can cumulate several
//! configurations (especially when they are partial)
//!
//! It may also bring a "fast" access to values, which has been
//! formerly computed from current configuration or another given
//! one. But its up-to-date status regarding existing
//! configurations is not checked : it may be recomputed or
//! cleared at any time. If not set, the current configuration
//! is then taken
class MoniTool_Profile : public MMgt_TShared
{
public:
//! Creates an empty Profile, with an empty Current Configuration
//! (named ".")
Standard_EXPORT MoniTool_Profile();
//! Adds an Option, with a Name, by default takes the Name of the
//! Option
Standard_EXPORT void AddOption (const Handle(MoniTool_Option)& option, const Standard_CString name = "");
//! Returns an Option from its Name. Null Handle if unknown
Standard_EXPORT Handle(MoniTool_Option) Option (const Standard_CString name) const;
//! Returns the list of Option Names
Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) OptionList() const;
//! Returns the list of Option Names which are defined on a
//! TypedValue/Static, i.e. for Basic Type
Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) TypedValueList() const;
//! Adds a new Configuration, yet empty, then filled by AddSwitch
//! If <confname> already existed, it is replaced from scratch
//! While AddConf creates new Conf only if it does not yet exist
//!
//! Remark : the Current Configuration "." may not be changed
Standard_EXPORT void NewConf (const Standard_CString confname);
//! Adds a new Configuration, yet empty, then filled by AddSwitch
//! If <confname> already existed, it is kept as it is
//! While NewConf restrts from scratch anyway
//!
//! Remark : the Current Configuration "." may not be changed
Standard_EXPORT void AddConf (const Standard_CString confname);
//! Tells if <confname> is known as a Configuration
Standard_EXPORT Standard_Boolean HasConf (const Standard_CString confname) const;
//! Returns the list of Configuration Names, including Current "."
Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) ConfList() const;
//! Clears a configuration (does not remove it)
//! A cleared configuration has no effect, it can be reloaded
Standard_EXPORT Standard_Boolean ClearConf (const Standard_CString confname);
//! Adds the definitions from the configuration <otherconf> to
//! those of <confname>
//! Returns True if done, False if confname or otherconf are unknown
Standard_EXPORT Standard_Boolean AddFromOtherConf (const Standard_CString confname, const Standard_CString otherconf);
//! Sets the definitions of a configuration from the actual state
//! (current configuration plus current state of options for those
//! which are not recorded in current conf)
Standard_EXPORT Standard_Boolean SetFromCurrent (const Standard_CString confname);
//! Adds to the Configuration <confname>, for the option <optname>
//! the command to switch it to <casename>
//! If <casename> is not given, records the actual current
//! CaseName of this Option
//! Returns True if done, False if <confname> or <optname> is
//! unknown, or <casename> not allowed for <optname>
Standard_EXPORT Standard_Boolean AddSwitch (const Standard_CString confname, const Standard_CString optname, const Standard_CString casename = "");
//! Removes from the Configuration <confname>, the switch for the
//! option <optname>. Hence, it will consider the basic default
//! switch for this option
//! Returns True if done or switch was not recorded, False if
//! <confname> or <optname> is unknown
Standard_EXPORT Standard_Boolean RemoveSwitch (const Standard_CString confname, const Standard_CString optname);
//! Returns the list of switches properly concerned by a config :
//! two lists in parallel, <optlist> lists the names of options
//! and for each one, <caselist> gives the case for this config
Standard_EXPORT void SwitchList (const Standard_CString confname, Handle(TColStd_HSequenceOfAsciiString)& optlist, Handle(TColStd_HSequenceOfAsciiString)& caselist) const;
//! Copies (Cumulates) the definition of <confname> to current
//! Records the current name as the last current setting
//!
//! Returns True if done, False (and does nothing> if <confname>
//! is not recorded as a Configuration
//! If no SetCurrent has been called, the last added one is taken
//!
//! Remark : SetCurrent is for the Profile : the individual
//! options are not switched themselves, they are only queried
//! To switch the options themselves, see below RecordCurrent
//!
//! Remark : for Options which are listed in the Profile but not
//! in the current Configuration, their current switch is taken
Standard_EXPORT Standard_Boolean SetCurrent (const Standard_CString confname);
//! Records the switches of current configuration in the options
//! themselves
Standard_EXPORT void RecordCurrent();
//! Returns the name of last current configuration
Standard_EXPORT const TCollection_AsciiString& Current() const;
//! Returns the selected case name of option <optname> in current
//! configuration
//! Empty String if <optname> unknown
//!
//! If <proper> is False (D), if <optname> is not recorded in the
//! current configuration, the own current name of the option
//! itself is taken
//! Else, an empty string is returned
Standard_EXPORT TCollection_AsciiString CaseName (const Standard_CString optname, const Standard_Boolean proper = Standard_False) const;
//! Returns the Value of the switch selected for option <optname>
//! in current configuration
//! Null Handle if <optname> unknown
//! To be down-casted as needed before use
Standard_EXPORT Handle(Standard_Transient) CaseValue (const Standard_CString optname) const;
//! Returns the Value of the switch selected for option <optname>
//! in current configuration
//! Returns True if done, False + Null Handle if <optname> unknown
//! This way of returning a Transient, bound with the Type Control
//! avoids DownCast and ensures the value is directly usable
Standard_EXPORT Standard_Boolean Value (const Standard_CString optname, Handle(Standard_Transient)& val) const;
//! For the Options which are defined with a TypedValue/Static,
//! takes the value defined in current configuration, and sets
//! the TypedValue with it
//!
//! If <proper> is False (D), takes the current value, whatever
//! it is properly recorded in current configuration or not
//! If <proper> is True, sets the value only if it is properly
//! recorded in the current configuration
//!
//! By default, considers all the Options with a TypedValue
//! If <name> is given, considers the Options of which the name
//! begins by <name>
Standard_EXPORT void SetTypedValues (const Standard_Boolean proper = Standard_False, const Standard_CString name = "") const;
//! Recomputes fast access from the definition of a configuration
//! By default, the current one
//! Else, a configuration identified by its name
Standard_EXPORT void SetFast (const Standard_CString confname = "");
//! Clears definitions of fast access
Standard_EXPORT void ClearFast();
//! Gets the value corresponding to Option <optname>, as fast
//! If not defined as fast, check "normal" access by calling Value
//! Returns True if OK (either Fast or normal), False if not found
//! (if not found, <val> is returned Null Handle)
Standard_EXPORT Standard_Boolean FastValue (const Standard_CString optname, Handle(Standard_Transient)& val) const;
DEFINE_STANDARD_RTTI(MoniTool_Profile,MMgt_TShared)
protected:
private:
//! Internal
Standard_EXPORT Handle(Dico_DictionaryOfTransient) Conf (const Standard_CString confname) const;
Handle(Dico_DictionaryOfTransient) theopts;
Handle(Dico_DictionaryOfTransient) theconfs;
TCollection_AsciiString thecurname;
Handle(Dico_DictionaryOfTransient) thecurconf;
Handle(Dico_DictionaryOfTransient) thefastval;
};
#endif // _MoniTool_Profile_HeaderFile

View File

@@ -1,36 +0,0 @@
-- Created on: 1997-09-03
-- Created by: Christian CAILLET
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class RealVal from MoniTool inherits TShared from MMgt
---Purpose : A Real through a Handle (i.e. managed as TShared)
uses Real
is
Create (val : Real = 0.0) returns RealVal;
Value (me) returns Real;
CValue (me : mutable) returns Real;
---C++ : return &
fields
theval : Real;
end RealVal;

View File

@@ -11,7 +11,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_RealVal.ixx>
#include <MoniTool_RealVal.hxx>
#include <Standard_Type.hxx>
MoniTool_RealVal::MoniTool_RealVal (const Standard_Real val) { theval = val; }

View File

@@ -0,0 +1,67 @@
// Created on: 1997-09-03
// Created by: Christian CAILLET
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_RealVal_HeaderFile
#define _MoniTool_RealVal_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Real.hxx>
#include <MMgt_TShared.hxx>
class MoniTool_RealVal;
DEFINE_STANDARD_HANDLE(MoniTool_RealVal, MMgt_TShared)
//! A Real through a Handle (i.e. managed as TShared)
class MoniTool_RealVal : public MMgt_TShared
{
public:
Standard_EXPORT MoniTool_RealVal(const Standard_Real val = 0.0);
Standard_EXPORT Standard_Real Value() const;
Standard_EXPORT Standard_Real& CValue();
DEFINE_STANDARD_RTTI(MoniTool_RealVal,MMgt_TShared)
protected:
private:
Standard_Real theval;
};
#endif // _MoniTool_RealVal_HeaderFile

View File

@@ -1,36 +0,0 @@
-- Created on: 1998-02-04
-- Created by: Christian CAILLET
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class SignShape from MoniTool inherits SignText from MoniTool
---Purpose : Signs HShape according to its real content (type of Shape)
-- Context is not used
uses CString, Transient, AsciiString
is
Create returns SignShape;
Name (me) returns CString;
---Purpose : Returns "SHAPE"
Text (me; ent : any Transient; context : any Transient)
returns AsciiString from TCollection;
---Purpose : Returns for a HShape, the string of its ShapeEnum
-- The Model is absolutely useless (may be null)
end SignShape;

View File

@@ -11,10 +11,13 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_SignShape.ixx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_HShape.hxx>
#include <MoniTool_SignShape.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopoDS_HShape.hxx>
#include <TopoDS_Shape.hxx>
MoniTool_SignShape::MoniTool_SignShape () { }

View File

@@ -0,0 +1,72 @@
// Created on: 1998-02-04
// Created by: Christian CAILLET
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_SignShape_HeaderFile
#define _MoniTool_SignShape_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <MoniTool_SignText.hxx>
#include <Standard_CString.hxx>
class TCollection_AsciiString;
class Standard_Transient;
class MoniTool_SignShape;
DEFINE_STANDARD_HANDLE(MoniTool_SignShape, MoniTool_SignText)
//! Signs HShape according to its real content (type of Shape)
//! Context is not used
class MoniTool_SignShape : public MoniTool_SignText
{
public:
Standard_EXPORT MoniTool_SignShape();
//! Returns "SHAPE"
Standard_EXPORT Standard_CString Name() const;
//! Returns for a HShape, the string of its ShapeEnum
//! The Model is absolutely useless (may be null)
Standard_EXPORT TCollection_AsciiString Text (const Handle(Standard_Transient)& ent, const Handle(Standard_Transient)& context) const;
DEFINE_STANDARD_RTTI(MoniTool_SignShape,MoniTool_SignText)
protected:
private:
};
#endif // _MoniTool_SignShape_HeaderFile

View File

@@ -1,47 +0,0 @@
-- Created on: 1998-05-20
-- Created by: Christian CAILLET
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
deferred class SignText from MoniTool inherits TShared
---Purpose : Provides the basic service to get a text which identifies
-- an object in a context
-- It can be used for other classes (general signatures ...)
-- It can also be used to build a message in which an object
-- is to be identified
uses CString, Transient, AsciiString from TCollection
is
Name (me) returns CString is deferred;
---Purpose : Returns an identification of the Signature (a word), given at
-- initialization time
TextAlone (me; ent : any Transient)
returns AsciiString from TCollection is virtual;
---Purpose : Gives a text as a signature for a transient object alone, i.e.
-- without defined context.
-- By default, calls Text with undefined context (Null Handle) and
-- if empty, then returns DynamicType
Text (me; ent : any Transient; context : any Transient)
returns AsciiString from TCollection is deferred;
---Purpose : Gives a text as a signature for a transient object in a context
-- If the context is senseless, it can be given as Null Handle
-- empty result if nothing to give (at least the DynamicType could
-- be sent ?)
end SignText;

View File

@@ -11,7 +11,11 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_SignText.ixx>
#include <MoniTool_SignText.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
TCollection_AsciiString MoniTool_SignText::TextAlone
(const Handle(Standard_Transient)& ent) const

View File

@@ -0,0 +1,82 @@
// Created on: 1998-05-20
// Created by: Christian CAILLET
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_SignText_HeaderFile
#define _MoniTool_SignText_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_CString.hxx>
class TCollection_AsciiString;
class Standard_Transient;
class MoniTool_SignText;
DEFINE_STANDARD_HANDLE(MoniTool_SignText, MMgt_TShared)
//! Provides the basic service to get a text which identifies
//! an object in a context
//! It can be used for other classes (general signatures ...)
//! It can also be used to build a message in which an object
//! is to be identified
class MoniTool_SignText : public MMgt_TShared
{
public:
//! Returns an identification of the Signature (a word), given at
//! initialization time
Standard_EXPORT virtual Standard_CString Name() const = 0;
//! Gives a text as a signature for a transient object alone, i.e.
//! without defined context.
//! By default, calls Text with undefined context (Null Handle) and
//! if empty, then returns DynamicType
Standard_EXPORT virtual TCollection_AsciiString TextAlone (const Handle(Standard_Transient)& ent) const;
//! Gives a text as a signature for a transient object in a context
//! If the context is senseless, it can be given as Null Handle
//! empty result if nothing to give (at least the DynamicType could
//! be sent ?)
Standard_EXPORT virtual TCollection_AsciiString Text (const Handle(Standard_Transient)& ent, const Handle(Standard_Transient)& context) const = 0;
DEFINE_STANDARD_RTTI(MoniTool_SignText,MMgt_TShared)
protected:
private:
};
#endif // _MoniTool_SignText_HeaderFile

View File

@@ -1,104 +0,0 @@
-- Created on: 1996-02-15
-- Created by: Christian CAILLET
-- Copyright (c) 1996-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Stat from MoniTool
---Purpose : This class manages Statistics to be queried asynchronously.
--
-- It is organized as a stack of counters, identified by their
-- levels, from one to ... . Each one has a total account of
-- items to be counted, a count of already passed items, plus a
-- count of "current items". The counters of higher level play on
-- these current items.
-- For instance, if a counter has been opened for 100 items, 40
-- already passed, 20 current, its own percent is 40, but there
-- is the contribution of higher level counters, rated for 20 %
-- of this counter.
--
-- Hence, a counter is opened, items are added. Also items can be
-- add for sub-counter (of higher level), they will be added
-- definitively when the sub-counter will be closed. When the
-- count has ended, this counter is closed, the counter of
-- lower level cumulates it and goes on. As follows :
--
-- Way of use :
-- Open(nbitems);
-- Add(..) : direct adding
-- Add(..)
-- AddSub (nsub) : for sub-counter
-- Open (nbsubs) : nbsubs for this sub-counter
-- Add (..)
-- Close : the sub-counter
-- AddEnd()
-- etc...
-- Close : the starting counter
--
-- This means that a counter can be opened in a Stat, regardless
-- to the already opened ones :: this will be cumulated
--
-- A Current Stat is available, but it is possible to have others
uses Integer, Real, HArray1OfInteger,
CString, HAsciiString
is
-- -- Description of a Stat form -- --
Create (title : CString = "") returns Stat;
---Purpose : Creates a Stat form. At start, one default phase is defined,
-- with one default step. Then, it suffises to start with a
-- count of items (and cycles if several) then record items,
-- to have a queryable report.
Create (other : Stat) returns Stat;
---Purpose : used when starting
Current (myclass) returns Stat;
---C++ : return &
Open (me : in out; nb : Integer = 100) returns Integer;
---Purpose : Opens a new counter with a starting count of items
OpenMore (me : in out; id : Integer; nb : Integer);
---Purpose : Adds more items to be counted by Add... on current level
Add (me : in out; nb : Integer = 1);
---Purpose : Directly addes items
AddSub (me : in out; nb : Integer = 1);
---Purpose : Declares a count of items to be added later. If a sub-counter
-- is opened, its percentage multiplies this sub-count to compute
-- the percent of current level
AddEnd (me : in out);
---Purpose : Ends the AddSub and cumulates the sub-count to current level
Close (me : in out; id : Integer);
Level (me) returns Integer;
Percent (me; fromlev : Integer = 0) returns Real;
fields
thetit : HAsciiString from TCollection;
thelev : Integer;
thetot : HArray1OfInteger;
thedone : HArray1OfInteger;
thecurr : HArray1OfInteger;
end Stat;

View File

@@ -11,16 +11,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_Stat.ixx>
#include <MoniTool_Stat.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
//static MoniTool_Stat Statvoid("");
//static MoniTool_Stat Statact ("");
//not Used
//static Standard_CString voidname = "";
MoniTool_Stat::MoniTool_Stat (const Standard_CString title)
{
thetit = new TCollection_HAsciiString(title);

View File

@@ -0,0 +1,134 @@
// Created on: 1996-02-15
// Created by: Christian CAILLET
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_Stat_HeaderFile
#define _MoniTool_Stat_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <Standard_CString.hxx>
#include <Standard_Real.hxx>
class TCollection_HAsciiString;
//! This class manages Statistics to be queried asynchronously.
//!
//! It is organized as a stack of counters, identified by their
//! levels, from one to ... . Each one has a total account of
//! items to be counted, a count of already passed items, plus a
//! count of "current items". The counters of higher level play on
//! these current items.
//! For instance, if a counter has been opened for 100 items, 40
//! already passed, 20 current, its own percent is 40, but there
//! is the contribution of higher level counters, rated for 20 %
//! of this counter.
//!
//! Hence, a counter is opened, items are added. Also items can be
//! add for sub-counter (of higher level), they will be added
//! definitively when the sub-counter will be closed. When the
//! count has ended, this counter is closed, the counter of
//! lower level cumulates it and goes on. As follows :
//!
//! Way of use :
//! Open(nbitems);
//! Add(..) : direct adding
//! Add(..)
//! AddSub (nsub) : for sub-counter
//! Open (nbsubs) : nbsubs for this sub-counter
//! Add (..)
//! Close : the sub-counter
//! AddEnd()
//! etc...
//! Close : the starting counter
//!
//! This means that a counter can be opened in a Stat, regardless
//! to the already opened ones :: this will be cumulated
//!
//! A Current Stat is available, but it is possible to have others
class MoniTool_Stat
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a Stat form. At start, one default phase is defined,
//! with one default step. Then, it suffises to start with a
//! count of items (and cycles if several) then record items,
//! to have a queryable report.
Standard_EXPORT MoniTool_Stat(const Standard_CString title = "");
//! used when starting
Standard_EXPORT MoniTool_Stat(const MoniTool_Stat& other);
Standard_EXPORT static MoniTool_Stat& Current();
//! Opens a new counter with a starting count of items
Standard_EXPORT Standard_Integer Open (const Standard_Integer nb = 100);
//! Adds more items to be counted by Add... on current level
Standard_EXPORT void OpenMore (const Standard_Integer id, const Standard_Integer nb);
//! Directly addes items
Standard_EXPORT void Add (const Standard_Integer nb = 1);
//! Declares a count of items to be added later. If a sub-counter
//! is opened, its percentage multiplies this sub-count to compute
//! the percent of current level
Standard_EXPORT void AddSub (const Standard_Integer nb = 1);
//! Ends the AddSub and cumulates the sub-count to current level
Standard_EXPORT void AddEnd();
Standard_EXPORT void Close (const Standard_Integer id);
Standard_EXPORT Standard_Integer Level() const;
Standard_EXPORT Standard_Real Percent (const Standard_Integer fromlev = 0) const;
protected:
private:
Handle(TCollection_HAsciiString) thetit;
Standard_Integer thelev;
Handle(TColStd_HArray1OfInteger) thetot;
Handle(TColStd_HArray1OfInteger) thedone;
Handle(TColStd_HArray1OfInteger) thecurr;
};
#endif // _MoniTool_Stat_HeaderFile

View File

@@ -1,125 +0,0 @@
-- Created on: 2001-12-13
-- Created by: Sergey KUUl
-- Copyright (c) 2001-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Timer from MoniTool inherits TShared from MMgt
---Purpose: Provides convenient service on global timers
-- accessed by string name, mostly aimed for debugging purposes
--
-- As an instance, envelopes the OSD_Timer to have it as Handle
--
-- As a tool, supports static dictionary of timers
-- and provides static methods to easily access them
uses
Timer from OSD,
DataMapOfTimer from MoniTool
is
---Section: Instance methods
Create returns Timer from MoniTool;
---C++: inline
---Purpose: Create timer in empty state
Timer (me) returns Timer from OSD;
---C++: inline
---C++: return const &
Timer (me: mutable) returns Timer from OSD;
---C++: inline
---C++: return &
---Purpose: Return reference to embedded OSD_Timer
Start (me: mutable);
---C++: inline
Stop (me: mutable);
---C++: inline
Reset (me: mutable);
---C++: inline
---Purpose: Start, Stop and reset the timer
-- In addition to doing that to embedded OSD_Timer,
-- manage also counter of hits
Count (me) returns Integer;
---C++: inline
---Purpose: Return value of hits counter (count of Start/Stop pairs)
IsRunning (me) returns Integer;
---C++: inline
---Purpose: Returns value of nesting counter
CPU (me: mutable) returns Real;
---C++: inline
---Purpose: Return value of CPU time minus accumulated amendment
Amend (me) returns Real;
---C++: inline
---Purpose: Return value of accumulated amendment on CPU time
Dump (me: mutable; ostr: in out OStream);
---Purpose: Dumps current state of a timer shortly (one-line output)
---Section: Static methods
Timer (myclass; name: CString from Standard) returns Timer from MoniTool;
---Purpose: Returns a timer from a dictionary by its name
-- If timer not existed, creates a new one
Start (myclass; name: CString from Standard);
---C++: inline
Stop (myclass; name: CString from Standard);
---C++: inline
---Purpose: Inline methods to conveniently start/stop timer by name
-- Shortcut to Timer(name)->Start/Stop()
Dictionary (myclass) returns DataMapOfTimer from MoniTool;
---Purpose: Returns map of timers
---C++: return&
ClearTimers (myclass);
---Purpose: Clears map of timers
DumpTimers (myclass; ostr: in out OStream);
---Purpose: Dumps contents of the whole dictionary
ComputeAmendments (myclass);
---Purpose: Computes and remembers amendments for times to
-- access, start, and stop of timer, and estimates
-- second-order error measured by 10 nested timers
GetAmendments (myclass; Access, Internal, External, Error10: out Real);
---Purpose: The computed amendmens are returned (for information only)
AmendAccess (myclass) is private;
AmendStart (me: mutable) is private;
AmendStop (me: mutable) is private;
---Purpose: Internal functions to amend other timers to avoid
-- side effects of operations with current one
fields
myTimer : Timer from OSD;
myCount : Integer;
myNesting: Integer;
myAmend : Real;
myPrev, myNext: Timer from MoniTool; -- chained active timers
end Timer;

View File

@@ -11,20 +11,19 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_Timer.ixx>
#include <MoniTool_DataMapOfTimer.hxx>
#include <MoniTool_DataMapIteratorOfDataMapOfTimer.hxx>
#include <OSD_Timer.hxx>
#include <MoniTool_DataMapOfTimer.hxx>
#include <MoniTool_Timer.hxx>
#include <MoniTool_TimerSentry.hxx>
#include <OSD_Timer.hxx>
#include <Standard_Type.hxx>
#include <stdio.h>
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void MoniTool_Timer::Dump(Standard_OStream &ostr)
{
Standard_Integer hours, minutes;

View File

@@ -0,0 +1,145 @@
// Created on: 2001-12-13
// Created by: Sergey KUUl
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_Timer_HeaderFile
#define _MoniTool_Timer_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <OSD_Timer.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_OStream.hxx>
#include <Standard_CString.hxx>
#include <MoniTool_DataMapOfTimer.hxx>
class OSD_Timer;
class MoniTool_Timer;
DEFINE_STANDARD_HANDLE(MoniTool_Timer, MMgt_TShared)
//! Provides convenient service on global timers
//! accessed by string name, mostly aimed for debugging purposes
//!
//! As an instance, envelopes the OSD_Timer to have it as Handle
//!
//! As a tool, supports static dictionary of timers
//! and provides static methods to easily access them
class MoniTool_Timer : public MMgt_TShared
{
public:
//! Create timer in empty state
MoniTool_Timer();
const OSD_Timer& Timer() const;
//! Return reference to embedded OSD_Timer
OSD_Timer& Timer();
void Start();
void Stop();
//! Start, Stop and reset the timer
//! In addition to doing that to embedded OSD_Timer,
//! manage also counter of hits
void Reset();
//! Return value of hits counter (count of Start/Stop pairs)
Standard_Integer Count() const;
//! Returns value of nesting counter
Standard_Integer IsRunning() const;
//! Return value of CPU time minus accumulated amendment
Standard_Real CPU();
//! Return value of accumulated amendment on CPU time
Standard_Real Amend() const;
//! Dumps current state of a timer shortly (one-line output)
Standard_EXPORT void Dump (Standard_OStream& ostr);
//! Returns a timer from a dictionary by its name
//! If timer not existed, creates a new one
Standard_EXPORT static Handle(MoniTool_Timer) Timer (const Standard_CString name);
static void Start (const Standard_CString name);
//! Inline methods to conveniently start/stop timer by name
//! Shortcut to Timer(name)->Start/Stop()
static void Stop (const Standard_CString name);
//! Returns map of timers
Standard_EXPORT static MoniTool_DataMapOfTimer& Dictionary();
//! Clears map of timers
Standard_EXPORT static void ClearTimers();
//! Dumps contents of the whole dictionary
Standard_EXPORT static void DumpTimers (Standard_OStream& ostr);
//! Computes and remembers amendments for times to
//! access, start, and stop of timer, and estimates
//! second-order error measured by 10 nested timers
Standard_EXPORT static void ComputeAmendments();
//! The computed amendmens are returned (for information only)
Standard_EXPORT static void GetAmendments (Standard_Real& Access, Standard_Real& Internal, Standard_Real& External, Standard_Real& Error10);
DEFINE_STANDARD_RTTI(MoniTool_Timer,MMgt_TShared)
protected:
private:
Standard_EXPORT static void AmendAccess();
Standard_EXPORT void AmendStart();
//! Internal functions to amend other timers to avoid
//! side effects of operations with current one
Standard_EXPORT void AmendStop();
OSD_Timer myTimer;
Standard_Integer myCount;
Standard_Integer myNesting;
Standard_Real myAmend;
Handle(MoniTool_Timer) myPrev;
Handle(MoniTool_Timer) myNext;
};
#include <MoniTool_Timer.lxx>
#endif // _MoniTool_Timer_HeaderFile

View File

@@ -1,56 +0,0 @@
-- Created on: 2001-12-13
-- Created by: Sergey KUUl
-- Copyright (c) 2001-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class TimerSentry from MoniTool
---Purpose: A tool to facilitate using MoniTool_Timer functionality
-- by automatically ensuring consistency of start/stop actions
--
-- When instance of TimerSentry is created, a timer
-- with corresponding name is started
-- When instance is deleted, timer stops
uses
Timer from MoniTool
is
Create (cname: CString from Standard)
returns TimerSentry from MoniTool;
---C++: inline
---Purpose: Constructor creates an instance and runs the corresponding timer
Create (timer: Timer from MoniTool)
returns TimerSentry from MoniTool;
---C++: inline
---Purpose: Constructor creates an instance and runs the corresponding timer
Destroy(me: in out);
---C++: inline
---Purpose: Destructor stops the associated timer
---C++: alias "Standard_EXPORT ~MoniTool_TimerSentry () { Destroy(); }"
Timer (me) returns Timer from MoniTool;
---C++: inline
Stop (me: in out);
---C++: inline
---Purpose: Manually stops the timer
fields
myTimer: Timer from MoniTool;
end TimerSentry;

View File

@@ -0,0 +1,80 @@
// Created on: 2001-12-13
// Created by: Sergey KUUl
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_TimerSentry_HeaderFile
#define _MoniTool_TimerSentry_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_CString.hxx>
class MoniTool_Timer;
//! A tool to facilitate using MoniTool_Timer functionality
//! by automatically ensuring consistency of start/stop actions
//!
//! When instance of TimerSentry is created, a timer
//! with corresponding name is started
//! When instance is deleted, timer stops
class MoniTool_TimerSentry
{
public:
DEFINE_STANDARD_ALLOC
//! Constructor creates an instance and runs the corresponding timer
MoniTool_TimerSentry(const Standard_CString cname);
//! Constructor creates an instance and runs the corresponding timer
MoniTool_TimerSentry(const Handle(MoniTool_Timer)& timer);
//! Destructor stops the associated timer
void Destroy();
Standard_EXPORT ~MoniTool_TimerSentry () { Destroy(); }
Handle(MoniTool_Timer) Timer() const;
//! Manually stops the timer
void Stop();
protected:
private:
Handle(MoniTool_Timer) myTimer;
};
#include <MoniTool_TimerSentry.lxx>
#endif // _MoniTool_TimerSentry_HeaderFile

View File

@@ -1,61 +0,0 @@
-- Created on: 1994-11-04
-- Created by: Christian CAILLET
-- Copyright (c) 1994-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class TransientElem from MoniTool inherits Element
---Purpose : an TransientElem defines an Element for a specific input class
-- its definition includes the value of the Key to be mapped,
-- and the HashCoder associated to the class of the Key
--
-- Transient from Standard defines the class to be keyed
-- MapTransientHasher from TColStd is the associated Hasher
-- DataInfo from MoniTool is an additionnal class which helps to provide
-- informations on the value (template : see DataInfo)
uses CString,
Transient from Standard,
MapTransientHasher from TColStd,
DataInfo from MoniTool
is
Create (akey : any Transient from Standard) returns TransientElem;
---Purpose : Creates a TransientElem with a Value. This Value can then not be
-- changed. It is used by the Hasher to compute the HashCode,
-- which will then be stored for an immediate reading.
Value (me) returns any Transient from Standard is static;
---Purpose : Returns the contained value
---C++ : return const &
Equates (me; other : Element) returns Boolean;
---Purpose : Specific testof equallity : defined as False if <other> has
-- not the same true Type, else contents are compared (by
-- C++ operator ==)
ValueType (me) returns Type is redefined;
---Purpose : Returns the Type of the Value. By default, returns the
-- DynamicType of <me>, but can be redefined
ValueTypeName (me) returns CString is redefined;
---Purpose : Returns the name of the Type of the Value. Default is name
-- of ValueType, unless it is for a non-handled object
fields
theval : Transient from Standard;
end TransientElem;

View File

@@ -11,13 +11,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_TransientElem.ixx>
#include <MoniTool_DataInfo.hxx>
#include <MoniTool_Element.hxx>
#include <MoniTool_TransientElem.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TColStd_MapTransientHasher.hxx>
#include <MoniTool_DataInfo.hxx>
MoniTool_TransientElem::MoniTool_TransientElem (const Handle(Standard_Transient)& akey)
: theval (akey)

View File

@@ -0,0 +1,93 @@
// Created on: 1994-11-04
// Created by: Christian CAILLET
// Copyright (c) 1994-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_TransientElem_HeaderFile
#define _MoniTool_TransientElem_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <MoniTool_Element.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Type.hxx>
#include <Standard_CString.hxx>
class Standard_Transient;
class MoniTool_Element;
class MoniTool_TransientElem;
DEFINE_STANDARD_HANDLE(MoniTool_TransientElem, MoniTool_Element)
//! an TransientElem defines an Element for a specific input class
//! its definition includes the value of the Key to be mapped,
//! and the HashCoder associated to the class of the Key
//!
//! Transient from Standard defines the class to be keyed
//! MapTransientHasher from TColStd is the associated Hasher
//! DataInfo from MoniTool is an additionnal class which helps to provide
//! informations on the value (template : see DataInfo)
class MoniTool_TransientElem : public MoniTool_Element
{
public:
//! Creates a TransientElem with a Value. This Value can then not be
//! changed. It is used by the Hasher to compute the HashCode,
//! which will then be stored for an immediate reading.
Standard_EXPORT MoniTool_TransientElem(const Handle(Standard_Transient)& akey);
//! Returns the contained value
Standard_EXPORT const Handle(Standard_Transient)& Value() const;
//! Specific testof equallity : defined as False if <other> has
//! not the same true Type, else contents are compared (by
//! C++ operator ==)
Standard_EXPORT Standard_Boolean Equates (const Handle(MoniTool_Element)& other) const;
//! Returns the Type of the Value. By default, returns the
//! DynamicType of <me>, but can be redefined
Standard_EXPORT virtual Handle(Standard_Type) ValueType() const Standard_OVERRIDE;
//! Returns the name of the Type of the Value. Default is name
//! of ValueType, unless it is for a non-handled object
Standard_EXPORT virtual Standard_CString ValueTypeName() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTI(MoniTool_TransientElem,MoniTool_Element)
protected:
private:
Handle(Standard_Transient) theval;
};
#endif // _MoniTool_TransientElem_HeaderFile

View File

@@ -1,369 +0,0 @@
-- Created on: 1998-02-23
-- Created by: Christian CAILLET
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class TypedValue from MoniTool inherits TShared
---Purpose : This class allows to dynamically manage .. typed values, i.e.
-- values which have an alphanumeric expression, but with
-- controls. Such as "must be an Integer" or "Enumerative Text"
-- etc
--
-- Hence, a TypedValue brings a specification (type + constraints
-- if any) and a value. Its basic form is a string, it can be
-- specified as integer or real or enumerative string, then
-- queried as such.
-- Its string content, which is a Handle(HAsciiString) can be
-- shared by other data structures, hence gives a direct on line
-- access to its value.
uses CString, Type from Standard,
Messenger from Message,
AsciiString from TCollection, HAsciiString from TCollection,
HArray1OfAsciiString from TColStd, HSequenceOfAsciiString from TColStd,
DictionaryOfInteger from Dico, DictionaryOfTransient from Dico,
ValueType from MoniTool,
ValueSatisfies from MoniTool, ValueInterpret from MoniTool
raises ConstructionError
is
Create (name : CString;
type : ValueType from MoniTool = MoniTool_ValueText;
init : CString = "") returns TypedValue;
---Purpose : Creates a TypedValue, with a name
--
-- type gives the type of the parameter, default is free text
-- Also available : Integer, Real, Enum, Entity (i.e. Object)
-- More precise specifications, titles, can be given to the
-- TypedValue once created
--
-- init gives an initial value. If it is not given, the
-- TypedValue begins as "not set", its value is empty
Create (other : TypedValue) returns TypedValue;
---Purpose : Creates a TypedValue from another one, by duplication
Internals (me; interp : out ValueInterpret; satisf : out ValueSatisfies;
satisname : out CString; enums : out DictionaryOfInteger);
---Purpose : Access to internal data which have no other access
Name (me) returns CString;
---Purpose : Returns the name
ValueType (me) returns ValueType from MoniTool;
---Purpose : Returns the type of the value
Definition (me) returns AsciiString from TCollection;
---Purpose : Returns the Definition
-- By priority, the enforced one, else an automatic one, computed
-- from the specification
SetDefinition (me : mutable; deftext : CString);
---Purpose : Enforces a Definition
Print (me; S : Messenger from Message) is virtual;
---Purpose : Prints definition, specification, and actual status and value
PrintValue (me; S : Messenger from Message);
---Purpose : Prints only the Value
-- -- Additional definitions -- --
AddDef (me : mutable; initext : CString) returns Boolean;
---Purpose : Completes the definition of a TypedValue by command <initext>,
-- once created with its type
-- Returns True if done, False if could not be interpreted
-- <initext> may be :
-- imin ival : minimum value for an integer
-- imax ival : maximum value for an integer
-- rmin rval : minimum value for a real
-- rmax rval : maximum value for a real
-- unit name : name of unit
-- ematch i : enum from integer value i, match required
-- enum i : enum from integer value i, match not required
-- eval text : add an enumerative value (increments max by 1)
-- eval ?? : add a non-authorised enum value (to be skipped)
-- tmax l : maximum length for a text
SetLabel (me : mutable; label : CString);
---Purpose : Sets a label, which can then be displayed
Label (me) returns CString;
---Purpose : Returns the label, if set; else returns an empty string
SetMaxLength (me : mutable; max : Integer);
---Purpose : Sets a maximum length for a text (active only for a free text)
MaxLength (me) returns Integer;
---Purpose : Returns the maximum length, 0 if not set
SetIntegerLimit (me : mutable; max : Boolean; val : Integer)
---Purpose : Sets an Integer limit (included) to <val>, the upper limit
-- if <max> is True, the lower limit if <max> is False
raises ConstructionError;
-- Error for a TypedValue not an Integer
IntegerLimit (me; max : Boolean; val : out Integer) returns Boolean;
---Purpose : Gives an Integer Limit (upper if <max> True, lower if <max>
-- False). Returns True if this limit is defined, False else
-- (in that case, gives the natural limit for Integer)
SetRealLimit (me : mutable; max : Boolean; val : Real)
---Purpose : Sets a Real limit (included) to <val>, the upper limit
-- if <max> is True, the lower limit if <max> is False
raises ConstructionError;
-- Error for a TypedValue not a Real
RealLimit (me; max : Boolean; val : out Real) returns Boolean;
---Purpose : Gives an Real Limit (upper if <max> True, lower if <max>
-- False). Returns True if this limit is defined, False else
-- (in that case, gives the natural limit for Real)
SetUnitDef (me : mutable; def : CString)
---Purpose : Sets (Clears if <def> empty) a unit definition, as an equation
-- of dimensions. TypedValue just records this definition, does
-- not exploit it, to be done as required by user applications
raises ConstructionError;
-- Error for a TypedValue not a Real
UnitDef (me) returns CString;
---Purpose : Returns the recorded unit definition, empty if not set
StartEnum (me : mutable;
start : Integer = 0; match : Boolean = Standard_True)
---Purpose : For an enumeration, precises the starting value (default 0)
-- and the match condition : if True (D), the string value must
-- match the definition, else it may take another value : in that
-- case, the Integer Value will be Start - 1.
-- (empty value remains allowed)
raises ConstructionError;
-- Error for a TypedValue not an Enum
AddEnum (me : mutable; v1,v2,v3,v4,v5,v6,v7,v8,v9,v10 : CString = "")
---Purpose : Adds enumerative definitions. For more than 10, several calls
raises ConstructionError;
-- Error for a TypedValue not an Enum
AddEnumValue (me : mutable; val : CString; num : Integer)
---Purpose : Adds an enumeration definition, by its string and numeric
-- values. If it is the first setting for this value, it is
-- recorded as main value. Else, it is recognized as alternate
-- string for this numeric value
raises ConstructionError;
-- Error for a TypedValue not an Enum
EnumDef (me; startcase, endcase : out Integer; match : out Boolean)
returns Boolean;
---Purpose : Gives the Enum definitions : start value, end value, match
-- status. Returns True for an Enum, False else.
EnumVal (me; num : Integer) returns CString;
---Purpose : Returns the value of an enumerative definition, from its rank
-- Empty string if out of range or not an Enum
EnumCase (me; val : CString) returns Integer;
---Purpose : Returns the case number which cooresponds to a string value
-- Works with main and additionnal values
-- Returns (StartEnum - 1) if not OK, -1 if not an Enum
SetObjectType (me : mutable; typ : Type)
---Purpose : Sets type of which an Object TypedValue must be kind of
raises ConstructionError;
---Purpose: Error for a TypedValue not an Object (Entity)
ObjectType (me) returns Type;
---Purpose : Returns the type of which an Object TypedValue must be kind of
-- Default is Standard_Transient
-- Null for a TypedValue not an Object
SetInterpret (me : mutable; func : ValueInterpret);
---Purpose : Sets a specific Interpret function
HasInterpret (me) returns Boolean is virtual;
---Purpose : Tells if a TypedValue has an Interpret
SetSatisfies (me : mutable; func : ValueSatisfies; name : CString);
---Purpose : Sets a specific Satisfies function : it is added to the
-- already defined criteria
-- It must match the form :
-- statisfies (val : HAsciiString) returns Boolean
SatisfiesName (me) returns CString;
---Purpose : Returns name of specific satisfy, empty string if none
-- -- Value -- --
IsSetValue (me) returns Boolean;
---Purpose : Returns True if the value is set (not empty/not null object)
CStringValue (me) returns CString;
---Purpose : Returns the value, as a cstring. Empty if not set.
HStringValue (me) returns HAsciiString;
---Purpose : Returns the value, as a Handle (can then be shared)
-- Null if not defined
Interpret (me; hval : HAsciiString; native : Boolean)
returns HAsciiString is virtual;
---Purpose : Interprets a value.
-- <native> True : returns a native value
-- <native> False : returns a coded value
-- If the Interpret function is set, calls it
-- Else, for an Enum, Native returns the Text, Coded returns
-- the number
-- STANDARD RETURNS : = hval means no specific interpretation
-- Null means senseless
-- Can also be redefined
Satisfies (me; hval : HAsciiString) returns Boolean is virtual;
---Purpose : Returns True if a value statifies the specification
-- (remark : does not apply to Entity : see ObjectType, for this
-- type, the string is just a comment)
ClearValue (me : mutable);
---Purpose : Clears the recorded Value : it is now unset
SetCStringValue (me : mutable; val : CString)
---Purpose : Changes the value. The new one must satisfy the specification
returns Boolean is virtual;
---Purpose: Returns False (and did not set) if the new value
-- does not satisfy the specification
-- Can be redefined to be managed (in a subclass)
SetHStringValue (me : mutable; hval : HAsciiString)
---Purpose : Forces a new Handle for the Value
-- It can be empty, else (if Type is not free Text), it must
-- satisfy the specification.
-- Not only the value is changed, but also the way it is shared
-- Remark : for Type=Object, this value is not controlled, it can
-- be set as a comment
returns Boolean is virtual;
---Purpose: Returns False (and did not set) if the new value
-- does not satisfy the specification
-- Can be redefined to be managed (in a subclass)
IntegerValue (me) returns Integer;
---Purpose : Returns the value as integer, i.e. :
-- For type = Integer, the integer itself; 0 if not set
-- For type = Enum, the designated rank (see Enum definition)
-- StartEnum - 1 if not set or not in the definition
-- Else, returns 0
SetIntegerValue (me : mutable; ival : Integer)
---Purpose : Changes the value as an integer, only for Integer or Enum
returns Boolean is virtual;
-- Returns False (and did not set) if type is neither Integer
-- nor Enum, or if ival is out of range (if a range is specified)
-- Can be redefined to be managed (in a subclass)
RealValue (me) returns Real;
---Purpose : Returns the value as real, for a Real type TypedValue
-- Else, returns 0.
SetRealValue (me : mutable; rval : Real)
---Purpose : Changes the value as a real, only for Real
returns Boolean is virtual;
-- Returns False (and did not set) if type is not Real or
-- out of range (if a range is specified)
-- Can be redefined to be managed (in a subclass)
ObjectValue (me) returns any Transient;
---Purpose : Returns the value as Transient Object, only for Object/Entity
-- Remark that the "HString value" is IGNORED here
-- Null if not set; remains to be casted
GetObjectValue (me; val : out Transient);
---Purpose : Same as ObjectValue, but avoids DownCast : the receiving
-- variable is directly loaded. It is assumed that it complies
-- with the definition of ObjectType ! Otherwise, big trouble
SetObjectValue (me : mutable; obj : any Transient)
returns Boolean is virtual;
---Purpose : Changes the value as Transient Object, only for Object/Entity
-- Returns False if DynamicType does not satisfy ObjectType
-- Can be redefined to be managed (in a subclass)
ObjectTypeName (me) returns CString;
---Purpose : Returns the type name of the ObjectValue, or an empty string
-- if not set
-- -- Library of TypedValue as Type Definitions, -- --
-- accessed by definition name
-- It starts with 3 basic types : "Integer" "Real" "Text"
AddLib (myclass; tv : TypedValue; def : CString = "") returns Boolean;
---Purpose : Adds a TypedValue in the library.
-- It is recorded then will be accessed by its Name
-- Its Definition may be imposed, else it is computed as usual
-- By default it will be accessed by its Definition (string)
-- Returns True if done, False if tv is Null or brings no
-- Definition or <def> not defined
--
-- If a TypedValue was already recorded under this name, it is
-- replaced
Lib (myclass; def : CString) returns TypedValue;
---Purpose : Returns the TypedValue bound with a given Name
-- Null Handle if none recorded
-- Warning : it is the original, not duplicated
FromLib (myclass; def : CString) returns TypedValue;
---Purpose : Returns a COPY of the TypedValue bound with a given Name
-- Null Handle if none recorded
LibList (myclass) returns HSequenceOfAsciiString;
---Purpose : Returns the list of names of items of the Library of Types
-- -- Library of TypedValue as Valued Parameters, -- --
-- accessed by parameter name
-- for use by management of Static Parameters
Stats (myclass) returns DictionaryOfTransient is protected;
---Purpose : Gives the internal library of static values
StaticValue (myclass; name : CString) returns TypedValue;
---Purpose : Returns a static value from its name, null if unknown
fields
thename : AsciiString;
thedef : AsciiString;
thelabel : AsciiString;
thetype : ValueType from MoniTool;
theotyp : Type from Standard; -- for object
thelims : Integer; -- status for integer/enum/real limits
themaxlen : Integer;
theintlow : Integer;
theintup : Integer;
therealow : Real;
therealup : Real;
theunidef : AsciiString;
theenums : HArray1OfAsciiString from TColStd;
theeadds : DictionaryOfInteger;
theinterp : ValueInterpret;
thesatisf : ValueSatisfies;
thesatisn : AsciiString;
theival : Integer;
thehval : HAsciiString from TCollection;
theoval : Transient;
end TypedValue;

View File

@@ -11,24 +11,24 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MoniTool_TypedValue.ixx>
#include <Dico_DictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Dico_DictionaryOfTransient.hxx>
#include <Dico_IteratorOfDictionaryOfInteger.hxx>
#include <Dico_IteratorOfDictionaryOfTransient.hxx>
#include <MoniTool_Element.hxx>
#include <Message_Messenger.hxx>
#include <MoniTool_Element.hxx>
#include <MoniTool_TypedValue.hxx>
#include <OSD_Path.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
#include <stdio.h>
// Not Used :
//static char defmess[30];
static Handle(Dico_DictionaryOfTransient) libtv()
{
static Handle(Dico_DictionaryOfTransient) thelibtv;

View File

@@ -0,0 +1,366 @@
// Created on: 1998-02-23
// Created by: Christian CAILLET
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_TypedValue_HeaderFile
#define _MoniTool_TypedValue_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <MoniTool_ValueType.hxx>
#include <Standard_Type.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <TColStd_HArray1OfAsciiString.hxx>
#include <MoniTool_ValueInterpret.hxx>
#include <MoniTool_ValueSatisfies.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_CString.hxx>
#include <Standard_Boolean.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
class Dico_DictionaryOfInteger;
class TCollection_HAsciiString;
class Standard_Transient;
class Standard_ConstructionError;
class TCollection_AsciiString;
class Message_Messenger;
class Dico_DictionaryOfTransient;
class MoniTool_TypedValue;
DEFINE_STANDARD_HANDLE(MoniTool_TypedValue, MMgt_TShared)
//! This class allows to dynamically manage .. typed values, i.e.
//! values which have an alphanumeric expression, but with
//! controls. Such as "must be an Integer" or "Enumerative Text"
//! etc
//!
//! Hence, a TypedValue brings a specification (type + constraints
//! if any) and a value. Its basic form is a string, it can be
//! specified as integer or real or enumerative string, then
//! queried as such.
//! Its string content, which is a Handle(HAsciiString) can be
//! shared by other data structures, hence gives a direct on line
//! access to its value.
class MoniTool_TypedValue : public MMgt_TShared
{
public:
//! Creates a TypedValue, with a name
//!
//! type gives the type of the parameter, default is free text
//! Also available : Integer, Real, Enum, Entity (i.e. Object)
//! More precise specifications, titles, can be given to the
//! TypedValue once created
//!
//! init gives an initial value. If it is not given, the
//! TypedValue begins as "not set", its value is empty
Standard_EXPORT MoniTool_TypedValue(const Standard_CString name, const MoniTool_ValueType type = MoniTool_ValueText, const Standard_CString init = "");
//! Creates a TypedValue from another one, by duplication
Standard_EXPORT MoniTool_TypedValue(const Handle(MoniTool_TypedValue)& other);
//! Access to internal data which have no other access
Standard_EXPORT void Internals (MoniTool_ValueInterpret& interp, MoniTool_ValueSatisfies& satisf, Standard_CString& satisname, Handle(Dico_DictionaryOfInteger)& enums) const;
//! Returns the name
Standard_EXPORT Standard_CString Name() const;
//! Returns the type of the value
Standard_EXPORT MoniTool_ValueType ValueType() const;
//! Returns the Definition
//! By priority, the enforced one, else an automatic one, computed
//! from the specification
Standard_EXPORT TCollection_AsciiString Definition() const;
//! Enforces a Definition
Standard_EXPORT void SetDefinition (const Standard_CString deftext);
//! Prints definition, specification, and actual status and value
Standard_EXPORT virtual void Print (const Handle(Message_Messenger)& S) const;
//! Prints only the Value
Standard_EXPORT void PrintValue (const Handle(Message_Messenger)& S) const;
//! Completes the definition of a TypedValue by command <initext>,
//! once created with its type
//! Returns True if done, False if could not be interpreted
//! <initext> may be :
//! imin ival : minimum value for an integer
//! imax ival : maximum value for an integer
//! rmin rval : minimum value for a real
//! rmax rval : maximum value for a real
//! unit name : name of unit
//! ematch i : enum from integer value i, match required
//! enum i : enum from integer value i, match not required
//! eval text : add an enumerative value (increments max by 1)
//! eval ?? : add a non-authorised enum value (to be skipped)
//! tmax l : maximum length for a text
Standard_EXPORT Standard_Boolean AddDef (const Standard_CString initext);
//! Sets a label, which can then be displayed
Standard_EXPORT void SetLabel (const Standard_CString label);
//! Returns the label, if set; else returns an empty string
Standard_EXPORT Standard_CString Label() const;
//! Sets a maximum length for a text (active only for a free text)
Standard_EXPORT void SetMaxLength (const Standard_Integer max);
//! Returns the maximum length, 0 if not set
Standard_EXPORT Standard_Integer MaxLength() const;
//! Sets an Integer limit (included) to <val>, the upper limit
//! if <max> is True, the lower limit if <max> is False
Standard_EXPORT void SetIntegerLimit (const Standard_Boolean max, const Standard_Integer val);
//! Gives an Integer Limit (upper if <max> True, lower if <max>
//! False). Returns True if this limit is defined, False else
//! (in that case, gives the natural limit for Integer)
Standard_EXPORT Standard_Boolean IntegerLimit (const Standard_Boolean max, Standard_Integer& val) const;
//! Sets a Real limit (included) to <val>, the upper limit
//! if <max> is True, the lower limit if <max> is False
Standard_EXPORT void SetRealLimit (const Standard_Boolean max, const Standard_Real val);
//! Gives an Real Limit (upper if <max> True, lower if <max>
//! False). Returns True if this limit is defined, False else
//! (in that case, gives the natural limit for Real)
Standard_EXPORT Standard_Boolean RealLimit (const Standard_Boolean max, Standard_Real& val) const;
//! Sets (Clears if <def> empty) a unit definition, as an equation
//! of dimensions. TypedValue just records this definition, does
//! not exploit it, to be done as required by user applications
Standard_EXPORT void SetUnitDef (const Standard_CString def);
//! Returns the recorded unit definition, empty if not set
Standard_EXPORT Standard_CString UnitDef() const;
//! For an enumeration, precises the starting value (default 0)
//! and the match condition : if True (D), the string value must
//! match the definition, else it may take another value : in that
//! case, the Integer Value will be Start - 1.
//! (empty value remains allowed)
Standard_EXPORT void StartEnum (const Standard_Integer start = 0, const Standard_Boolean match = Standard_True);
//! Adds enumerative definitions. For more than 10, several calls
Standard_EXPORT void AddEnum (const Standard_CString v1 = "", const Standard_CString v2 = "", const Standard_CString v3 = "", const Standard_CString v4 = "", const Standard_CString v5 = "", const Standard_CString v6 = "", const Standard_CString v7 = "", const Standard_CString v8 = "", const Standard_CString v9 = "", const Standard_CString v10 = "");
//! Adds an enumeration definition, by its string and numeric
//! values. If it is the first setting for this value, it is
//! recorded as main value. Else, it is recognized as alternate
//! string for this numeric value
Standard_EXPORT void AddEnumValue (const Standard_CString val, const Standard_Integer num);
//! Gives the Enum definitions : start value, end value, match
//! status. Returns True for an Enum, False else.
Standard_EXPORT Standard_Boolean EnumDef (Standard_Integer& startcase, Standard_Integer& endcase, Standard_Boolean& match) const;
//! Returns the value of an enumerative definition, from its rank
//! Empty string if out of range or not an Enum
Standard_EXPORT Standard_CString EnumVal (const Standard_Integer num) const;
//! Returns the case number which cooresponds to a string value
//! Works with main and additionnal values
//! Returns (StartEnum - 1) if not OK, -1 if not an Enum
Standard_EXPORT Standard_Integer EnumCase (const Standard_CString val) const;
//! Sets type of which an Object TypedValue must be kind of
//! Error for a TypedValue not an Object (Entity)
Standard_EXPORT void SetObjectType (const Handle(Standard_Type)& typ);
//! Returns the type of which an Object TypedValue must be kind of
//! Default is Standard_Transient
//! Null for a TypedValue not an Object
Standard_EXPORT Handle(Standard_Type) ObjectType() const;
//! Sets a specific Interpret function
Standard_EXPORT void SetInterpret (const MoniTool_ValueInterpret func);
//! Tells if a TypedValue has an Interpret
Standard_EXPORT virtual Standard_Boolean HasInterpret() const;
//! Sets a specific Satisfies function : it is added to the
//! already defined criteria
//! It must match the form :
//! statisfies (val : HAsciiString) returns Boolean
Standard_EXPORT void SetSatisfies (const MoniTool_ValueSatisfies func, const Standard_CString name);
//! Returns name of specific satisfy, empty string if none
Standard_EXPORT Standard_CString SatisfiesName() const;
//! Returns True if the value is set (not empty/not null object)
Standard_EXPORT Standard_Boolean IsSetValue() const;
//! Returns the value, as a cstring. Empty if not set.
Standard_EXPORT Standard_CString CStringValue() const;
//! Returns the value, as a Handle (can then be shared)
//! Null if not defined
Standard_EXPORT Handle(TCollection_HAsciiString) HStringValue() const;
//! Interprets a value.
//! <native> True : returns a native value
//! <native> False : returns a coded value
//! If the Interpret function is set, calls it
//! Else, for an Enum, Native returns the Text, Coded returns
//! the number
//! STANDARD RETURNS : = hval means no specific interpretation
//! Null means senseless
//! Can also be redefined
Standard_EXPORT virtual Handle(TCollection_HAsciiString) Interpret (const Handle(TCollection_HAsciiString)& hval, const Standard_Boolean native) const;
//! Returns True if a value statifies the specification
//! (remark : does not apply to Entity : see ObjectType, for this
//! type, the string is just a comment)
Standard_EXPORT virtual Standard_Boolean Satisfies (const Handle(TCollection_HAsciiString)& hval) const;
//! Clears the recorded Value : it is now unset
Standard_EXPORT void ClearValue();
//! Changes the value. The new one must satisfy the specification
//! Returns False (and did not set) if the new value
//! does not satisfy the specification
//! Can be redefined to be managed (in a subclass)
Standard_EXPORT virtual Standard_Boolean SetCStringValue (const Standard_CString val);
//! Forces a new Handle for the Value
//! It can be empty, else (if Type is not free Text), it must
//! satisfy the specification.
//! Not only the value is changed, but also the way it is shared
//! Remark : for Type=Object, this value is not controlled, it can
//! be set as a comment
//! Returns False (and did not set) if the new value
//! does not satisfy the specification
//! Can be redefined to be managed (in a subclass)
Standard_EXPORT virtual Standard_Boolean SetHStringValue (const Handle(TCollection_HAsciiString)& hval);
//! Returns the value as integer, i.e. :
//! For type = Integer, the integer itself; 0 if not set
//! For type = Enum, the designated rank (see Enum definition)
//! StartEnum - 1 if not set or not in the definition
//! Else, returns 0
Standard_EXPORT Standard_Integer IntegerValue() const;
//! Changes the value as an integer, only for Integer or Enum
Standard_EXPORT virtual Standard_Boolean SetIntegerValue (const Standard_Integer ival);
//! Returns the value as real, for a Real type TypedValue
//! Else, returns 0.
Standard_EXPORT Standard_Real RealValue() const;
//! Changes the value as a real, only for Real
Standard_EXPORT virtual Standard_Boolean SetRealValue (const Standard_Real rval);
//! Returns the value as Transient Object, only for Object/Entity
//! Remark that the "HString value" is IGNORED here
//! Null if not set; remains to be casted
Standard_EXPORT Handle(Standard_Transient) ObjectValue() const;
//! Same as ObjectValue, but avoids DownCast : the receiving
//! variable is directly loaded. It is assumed that it complies
//! with the definition of ObjectType ! Otherwise, big trouble
Standard_EXPORT void GetObjectValue (Handle(Standard_Transient)& val) const;
//! Changes the value as Transient Object, only for Object/Entity
//! Returns False if DynamicType does not satisfy ObjectType
//! Can be redefined to be managed (in a subclass)
Standard_EXPORT virtual Standard_Boolean SetObjectValue (const Handle(Standard_Transient)& obj);
//! Returns the type name of the ObjectValue, or an empty string
//! if not set
Standard_EXPORT Standard_CString ObjectTypeName() const;
//! Adds a TypedValue in the library.
//! It is recorded then will be accessed by its Name
//! Its Definition may be imposed, else it is computed as usual
//! By default it will be accessed by its Definition (string)
//! Returns True if done, False if tv is Null or brings no
//! Definition or <def> not defined
//!
//! If a TypedValue was already recorded under this name, it is
//! replaced
Standard_EXPORT static Standard_Boolean AddLib (const Handle(MoniTool_TypedValue)& tv, const Standard_CString def = "");
//! Returns the TypedValue bound with a given Name
//! Null Handle if none recorded
//! Warning : it is the original, not duplicated
Standard_EXPORT static Handle(MoniTool_TypedValue) Lib (const Standard_CString def);
//! Returns a COPY of the TypedValue bound with a given Name
//! Null Handle if none recorded
Standard_EXPORT static Handle(MoniTool_TypedValue) FromLib (const Standard_CString def);
//! Returns the list of names of items of the Library of Types
//! -- Library of TypedValue as Valued Parameters, -- --
//! accessed by parameter name
//! for use by management of Static Parameters
Standard_EXPORT static Handle(TColStd_HSequenceOfAsciiString) LibList();
//! Returns a static value from its name, null if unknown
Standard_EXPORT static Handle(MoniTool_TypedValue) StaticValue (const Standard_CString name);
DEFINE_STANDARD_RTTI(MoniTool_TypedValue,MMgt_TShared)
protected:
//! Gives the internal library of static values
Standard_EXPORT static Handle(Dico_DictionaryOfTransient) Stats();
private:
TCollection_AsciiString thename;
TCollection_AsciiString thedef;
TCollection_AsciiString thelabel;
MoniTool_ValueType thetype;
Handle(Standard_Type) theotyp;
Standard_Integer thelims;
Standard_Integer themaxlen;
Standard_Integer theintlow;
Standard_Integer theintup;
Standard_Real therealow;
Standard_Real therealup;
TCollection_AsciiString theunidef;
Handle(TColStd_HArray1OfAsciiString) theenums;
Handle(Dico_DictionaryOfInteger) theeadds;
MoniTool_ValueInterpret theinterp;
MoniTool_ValueSatisfies thesatisf;
TCollection_AsciiString thesatisn;
Standard_Integer theival;
Handle(TCollection_HAsciiString) thehval;
Handle(Standard_Transient) theoval;
};
#endif // _MoniTool_TypedValue_HeaderFile

View File

@@ -0,0 +1,36 @@
// Created on: 1998-04-01
// Created by: Christian CAILLET
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _MoniTool_ValueType_HeaderFile
#define _MoniTool_ValueType_HeaderFile
enum MoniTool_ValueType
{
MoniTool_ValueMisc,
MoniTool_ValueInteger,
MoniTool_ValueReal,
MoniTool_ValueIdent,
MoniTool_ValueVoid,
MoniTool_ValueText,
MoniTool_ValueEnum,
MoniTool_ValueLogical,
MoniTool_ValueSub,
MoniTool_ValueHexa,
MoniTool_ValueBinary
};
#endif // _MoniTool_ValueType_HeaderFile