![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
Now strictly equivalent to TypedValue from MoniTool, except for ParamType which remains for compatibility reasons. More...
#include <Interface_TypedValue.hxx>

Public Member Functions | |
| Interface_TypedValue (const char *const name, const Interface_ParamType type=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. | |
Public Member Functions inherited from MoniTool_TypedValue | |
| MoniTool_TypedValue (const char *const name, const MoniTool_ValueType type=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 &interp, 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 label) |
| 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 val) |
| 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 &val) 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 val) |
| 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 &val) 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 start=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 v1="", const char *const v2="", const char *const v3="", 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 val, const int num) |
| 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 num) 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 val) 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 func) |
| Sets a specific Interpret function. | |
| virtual bool | HasInterpret () const |
| Tells if a TypedValue has an Interpret. | |
| void | SetSatisfies (const MoniTool_ValueSatisfies func, const char *const name) |
| 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 val) |
| 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 > &val) 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 > &obj) |
| 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 Public Member Functions | |
| 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 Public Member Functions inherited from MoniTool_TypedValue | |
| 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 name) |
| Returns a static value from its name, null if unknown. | |
Static Public Member Functions inherited from Standard_Transient | |
| static constexpr const char * | get_type_name () |
| Returns a type descriptor about this object. | |
| static const opencascade::handle< Standard_Type > & | get_type_descriptor () |
| Returns type descriptor of Standard_Transient class. | |
Additional Inherited Members | |
Public Types inherited from Standard_Transient | |
| typedef void | base_type |
| Returns a type descriptor about this object. | |
Static Protected Member Functions inherited from MoniTool_TypedValue | |
| static NCollection_DataMap< TCollection_AsciiString, occ::handle< Standard_Transient > > & | Stats () |
| Gives the internal library of static values. | |
Now strictly equivalent to TypedValue from MoniTool, except for ParamType which remains for compatibility reasons.
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 occ::handle<HAsciiString> can be shared by other data structures, hence gives a direct on line access to its value.
| Interface_TypedValue::Interface_TypedValue | ( | const char *const | name, |
| const Interface_ParamType | type = Interface_ParamText, | ||
| const char *const | init = "" ) |
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
|
static |
Correspondence ParamType from Interface to ValueType from MoniTool.
| Interface_ParamType Interface_TypedValue::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.
|
static |
Correspondence ParamType from Interface to ValueType from MoniTool.