This class gives a way to manage meaningful static variables, used as "global" parameters in various procedures.
More...
|
| | Interface_Static (const char *const family, const char *const namename, const Interface_ParamType typetype=Interface_ParamText, const char *const init="") |
| | Creates and records a Static, with a family and a name family can report to a name of resource or to a system or internal definition. The name must be unique.
|
| | Interface_Static (const char *const family, const char *const namename, const occ::handle< Interface_Static > &other) |
| | Creates a new Static with same definition as another one (value is copied, except for Entity : it remains null).
|
| void | PrintStatic (Standard_OStream &S) const |
| | Writes the properties of a parameter in the diagnostic file. These include:
|
| const char * | Family () const |
| | Returns the family. It can be : a resource name for applis, an internal name between : $e (environment variables), $l (other, purely local).
|
| void | SetWild (const occ::handle< Interface_Static > &wildcard) |
| | Sets a "wild-card" static : its value will be considered if <me> is not properly set. (reset by set a null one).
|
| occ::handle< Interface_Static > | Wild () const |
| | Returns the wildcard static, which can be (is most often) null.
|
| void | SetUptodate () |
| | Records a Static has "uptodate", i.e. its value has been taken into account by a reinitialisation procedure This flag is reset at each successful SetValue.
|
| bool | UpdatedStatus () const |
| | Returns the status "uptodate".
|
| | Interface_TypedValue (const char *const namename, const Interface_ParamType typetype=Interface_ParamText, const char *const init="") |
| | Creates a TypedValue, with a name.
|
| Interface_ParamType | Type () const |
| | Returns the type I.E. calls ValueType then makes correspondence between ParamType from Interface (which remains for compatibility reasons) and ValueType from MoniTool.
|
| | MoniTool_TypedValue (const char *const namename, const MoniTool_ValueType typetype=MoniTool_ValueText, const char *const init="") |
| | Creates a TypedValue, with a name.
|
| | MoniTool_TypedValue (const occ::handle< MoniTool_TypedValue > &other) |
| | Creates a TypedValue from another one, by duplication.
|
| void | Internals (MoniTool_ValueInterpret &interpinterp, MoniTool_ValueSatisfies &satisf, const char *&satisname, NCollection_DataMap< TCollection_AsciiString, int > &enums) const |
| | Access to internal data which have no other access.
|
| const char * | Name () const |
| | Returns the name.
|
| MoniTool_ValueType | ValueType () const |
| | Returns the type of the value.
|
| TCollection_AsciiString | Definition () const |
| | Returns the Definition By priority, the enforced one, else an automatic one, computed from the specification.
|
| void | SetDefinition (const char *const deftext) |
| | Enforces a Definition.
|
| virtual void | Print (Standard_OStream &S) const |
| | Prints definition, specification, and actual status and value.
|
| void | PrintValue (Standard_OStream &S) const |
| | Prints only the Value.
|
| bool | AddDef (const char *const initext) |
| | 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.
|
| void | SetLabel (const char *const labellabel) |
| | Sets a label, which can then be displayed.
|
| const char * | Label () const |
| | Returns the label, if set; else returns an empty string.
|
| void | SetMaxLength (const int max) |
| | Sets a maximum length for a text (active only for a free text).
|
| int | MaxLength () const |
| | Returns the maximum length, 0 if not set.
|
| void | SetIntegerLimit (const bool max, const int valval) |
| | Sets an Integer limit (included) to <val>, the upper limit if <max> is True, the lower limit if <max> is False.
|
| bool | IntegerLimit (const bool max, int &valval) const |
| | 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).
|
| void | SetRealLimit (const bool max, const double valval) |
| | Sets a Real limit (included) to <val>, the upper limit if <max> is True, the lower limit if <max> is False.
|
| bool | RealLimit (const bool max, double &valval) const |
| | 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).
|
| void | SetUnitDef (const char *const def) |
| | 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.
|
| const char * | UnitDef () const |
| | Returns the recorded unit definition, empty if not set.
|
| void | StartEnum (const int startstart=0, const bool match=true) |
| | 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).
|
| void | AddEnum (const char *const v1v1="", const char *const v2v2="", const char *const v3v3="", const char *const v4="", const char *const v5="", const char *const v6="", const char *const v7="", const char *const v8="", const char *const v9="", const char *const v10="") |
| | Adds enumerative definitions. For more than 10, several calls.
|
| void | AddEnumValue (const char *const valval, const int numnum) |
| | 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.
|
| bool | EnumDef (int &startcase, int &endcase, bool &match) const |
| | Gives the Enum definitions : start value, end value, match status. Returns True for an Enum, False else.
|
| const char * | EnumVal (const int numnum) const |
| | Returns the value of an enumerative definition, from its rank Empty string if out of range or not an Enum.
|
| int | EnumCase (const char *const valval) const |
| | Returns the case number which corresponds to a string value Works with main and additional values Returns (StartEnum - 1) if not OK, -1 if not an Enum.
|
| void | SetObjectType (const occ::handle< Standard_Type > &typ) |
| | Sets type of which an Object TypedValue must be kind of Error for a TypedValue not an Object (Entity).
|
| occ::handle< Standard_Type > | ObjectType () const |
| | Returns the type of which an Object TypedValue must be kind of Default is Standard_Transient Null for a TypedValue not an Object.
|
| void | SetInterpret (const MoniTool_ValueInterpret funcfunc) |
| | Sets a specific Interpret function.
|
| virtual bool | HasInterpret () const |
| | Tells if a TypedValue has an Interpret.
|
| void | SetSatisfies (const MoniTool_ValueSatisfies funcfunc, const char *const namename) |
| | Sets a specific Satisfies function : it is added to the already defined criteria It must match the form : satisfies (val : HAsciiString) returns Boolean.
|
| const char * | SatisfiesName () const |
| | Returns name of specific satisfy, empty string if none.
|
| bool | IsSetValue () const |
| | Returns True if the value is set (not empty/not null object).
|
| const char * | CStringValue () const |
| | Returns the value, as a cstring. Empty if not set.
|
| occ::handle< TCollection_HAsciiString > | HStringValue () const |
| | Returns the value, as a Handle (can then be shared) Null if not defined.
|
| virtual occ::handle< TCollection_HAsciiString > | Interpret (const occ::handle< TCollection_HAsciiString > &hval, const bool native) 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.
|
| virtual bool | Satisfies (const occ::handle< TCollection_HAsciiString > &hval) 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).
|
| void | ClearValue () |
| | Clears the recorded Value : it is now unset.
|
| virtual bool | SetCStringValue (const char *const valval) |
| | 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).
|
| virtual bool | SetHStringValue (const occ::handle< TCollection_HAsciiString > &hval) |
| | 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).
|
| int | IntegerValue () const |
| | 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.
|
| virtual bool | SetIntegerValue (const int ival) |
| | Changes the value as an integer, only for Integer or Enum.
|
| double | RealValue () const |
| | Returns the value as real, for a Real type TypedValue Else, returns 0.
|
| virtual bool | SetRealValue (const double rval) |
| | Changes the value as a real, only for Real.
|
| occ::handle< Standard_Transient > | ObjectValue () const |
| | 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.
|
| void | GetObjectValue (occ::handle< Standard_Transient > &valval) 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.
|
| virtual bool | SetObjectValue (const occ::handle< Standard_Transient > &objobj) |
| | 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).
|
| const char * | ObjectTypeName () const |
| | Returns the type name of the ObjectValue, or an empty string if not set.
|
| Public Member Functions inherited from Standard_Transient |
| | Standard_Transient () |
| | Empty constructor.
|
| | Standard_Transient (const Standard_Transient &) |
| | Copy constructor – does nothing.
|
| Standard_Transient & | operator= (const Standard_Transient &) |
| | Assignment operator, needed to avoid copying reference counter.
|
| virtual | ~Standard_Transient ()=default |
| | Destructor must be virtual.
|
| virtual const opencascade::handle< Standard_Type > & | DynamicType () const |
| | Returns a type descriptor about this object.
|
| bool | IsInstance (const opencascade::handle< Standard_Type > &theType) const |
| | Returns a true value if this is an instance of Type.
|
| bool | IsInstance (const char *const theTypeName) const |
| | Returns a true value if this is an instance of TypeName.
|
| bool | IsKind (const opencascade::handle< Standard_Type > &theType) const |
| | Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
|
| bool | IsKind (const char *const theTypeName) const |
| | Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
|
| Standard_Transient * | This () const |
| | Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
|
| int | GetRefCount () const noexcept |
| | Get the reference counter of this object.
|
| void | IncrementRefCounter () noexcept |
| | Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
|
| int | DecrementRefCounter () noexcept |
| | Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
|
| virtual void | Delete () const |
| | Memory deallocator for transient classes.
|
|
| static bool | Init (const char *const family, const char *const namename, const Interface_ParamType typetype, const char *const init="") |
| | Declares a new Static (by calling its constructor) If this name is already taken, does nothing and returns False Else, creates it and returns True For additional definitions, get the Static then edit it.
|
| static bool | Init (const char *const family, const char *const namename, const char typetype, const char *const init="") |
| | As Init with ParamType, but type is given as a character This allows a simpler call Types : 'i' Integer, 'r' Real, 't' Text, 'e' Enum, 'o' Object '=' for same definition as, <init> gives the initial Static Returns False if <type> does not match this list.
|
| static occ::handle< Interface_Static > | Static (const char *const namename) |
| | Returns a Static from its name. Null Handle if not present.
|
| static bool | IsPresent (const char *const namename) |
| | Returns True if a Static named <name> is present, False else.
|
| static const char * | CDef (const char *const namename, const char *const part) |
| | Returns a part of the definition of a Static, as a CString The part is designated by its name, as a CString If the required value is not a string, it is converted to a CString then returned If <name> is not present, or <part> not defined for <name>, this function returns an empty string.
|
| static int | IDef (const char *const namename, const char *const part) |
| | Returns a part of the definition of a Static, as an Integer The part is designated by its name, as a CString If the required value is not a string, returns zero For a Boolean, 0 for false, 1 for true If <name> is not present, or <part> not defined for <name>, this function returns zero.
|
| static bool | IsSet (const char *const namename, const bool proper=true) |
| | Returns True if <name> is present AND set <proper> True (D) : considers this item only <proper> False : if not set and attached to a wild-card, considers this wild-card.
|
| static const char * | CVal (const char *const namename) |
| | Returns the value of the parameter identified by the string name. If the specified parameter does not exist, an empty string is returned. Example Interface_Static::CVal("write.step.schema"); which could return: "AP214".
|
| static int | IVal (const char *const namename) |
| | Returns the integer value of the translation parameter identified by the string name. Returns the value 0 if the parameter does not exist. Example Interface_Static::IVal("write.step.schema"); which could return: 3.
|
| static double | RVal (const char *const namename) |
| | Returns the value of a static translation parameter identified by the string name. Returns the value 0.0 if the parameter does not exist.
|
| static bool | SetCVal (const char *const namename, const char *const valval) |
| | Modifies the value of the parameter identified by name. The modification is specified by the string val. false is returned if the parameter does not exist. Example Interface_Static::SetCVal ("write.step.schema","AP203") This syntax specifies a switch from the default STEP 214 mode to STEP 203 mode.
|
| static bool | SetIVal (const char *const namename, const int valval) |
| | Modifies the value of the parameter identified by name. The modification is specified by the integer value val. false is returned if the parameter does not exist. Example Interface_Static::SetIVal ("write.step.schema", 3) This syntax specifies a switch from the default STEP 214 mode to STEP 203 mode.S.
|
| static bool | SetRVal (const char *const namename, const double valval) |
| | Modifies the value of a translation parameter. false is returned if the parameter does not exist. The modification is specified by the real number value val.
|
| static bool | Update (const char *const namename) |
| | Sets a Static to be "uptodate" Returns False if <name> is not present This status can be used by a reinitialisation procedure to rerun if a value has been changed.
|
| static bool | IsUpdated (const char *const namename) |
| | Returns the status "uptodate" from a Static Returns False if <name> is not present.
|
| static occ::handle< NCollection_HSequence< occ::handle< TCollection_HAsciiString > > > | Items (const int modemode=0, const char *const criter="") |
| | Returns a list of names of statics : <mode> = 0 (D) : criter is for family <mode> = 1 : criter is regexp on names, takes final items (ignore wild cards) <mode> = 2 : idem but take only wilded, not final items <mode> = 3 : idem, take all items matching criter idem + 100 : takes only non-updated items idem + 200 : takes only updated items criter empty (D) : returns all names else returns names which match the given criter Remark : families beginning by '$' are not listed by criter "" they are listed only by criter "$".
|
| static void | Standards () |
| | Initializes all standard static parameters, which can be used by every function. statics specific of a norm or a function must be defined around it.
|
| static void | FillMap (NCollection_DataMap< TCollection_AsciiString, TCollection_AsciiString > &theMap) |
| | Fills given string-to-string map with all static data.
|
| static MoniTool_ValueType | ParamTypeToValueType (const Interface_ParamType typ) |
| | Correspondence ParamType from Interface to ValueType from MoniTool.
|
| static Interface_ParamType | ValueTypeToParamType (const MoniTool_ValueType typ) |
| | Correspondence ParamType from Interface to ValueType from MoniTool.
|
| static bool | AddLib (const occ::handle< MoniTool_TypedValue > &tv, const char *const def="") |
| | 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.
|
| static occ::handle< MoniTool_TypedValue > | Lib (const char *const def) |
| | Returns the TypedValue bound with a given Name Null Handle if none recorded Warning: it is the original, not duplicated.
|
| static occ::handle< MoniTool_TypedValue > | FromLib (const char *const def) |
| | Returns a COPY of the TypedValue bound with a given Name Null Handle if none recorded.
|
| static occ::handle< NCollection_HSequence< TCollection_AsciiString > > | LibList () |
| | 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.
|
| static occ::handle< MoniTool_TypedValue > | StaticValue (const char *const namename) |
| | Returns a static value from its name, null if unknown.
|
| static constexpr const char * | get_type_name () |
| | Returns a type descriptor about this object.
|
| static const opencascade::handle< Standard_Type > & | get_type_descriptor () |
| | Returns type descriptor of Standard_Transient class.
|
This class gives a way to manage meaningful static variables, used as "global" parameters in various procedures.
A Static brings a specification (its type, constraints if any) and a value. Its basic form is a string, it can be specified as integer or real or enumerative string, and queried as such. Its string content, which is a occ::handle<HAsciiString> can be shared by other data structures, hence gives a direct on line access to its value.
All this description is inherited from TypedValue
A Static can be given an initial value, it can be filled from, either a set of Resources (an applicative feature which accesses and manages parameter files), or environment or internal definition : these define families of Static. In addition, it supports a status for reinitialisation : an initialisation procedure can ask if the value of the Static has changed from its last call, in this case does something then marks the Status "uptodate", else it does nothing.
Statics are named and recorded then accessed in an alphabetic dictionary