# DataExchange
TKXSBase
MoniTool

# MoniTool_TypedValue Class Reference

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.
.

`#include <MoniTool_TypedValue.hxx>`

Inheritance diagram for MoniTool_TypedValue:

[legend]

## Public Member Functions

Standard_EXPORT | MoniTool_TypedValue (const Standard_CString name, const MoniTool_ValueType type=MoniTool_ValueText, const Standard_CString 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 .
Standard_EXPORT | MoniTool_TypedValue (const Handle(MoniTool_TypedValue)&other)
| Creates a TypedValue from another one, by duplication .
Standard_EXPORT void | Internals (MoniTool_ValueInterpret &interp, MoniTool_ValueSatisfies &satisf, Standard_CString &satisname, Handle(Dico_DictionaryOfInteger)&enums) const
| Access to internal data which have no other access .
Standard_EXPORT Standard_CString | Name () const
| Returns the name .
Standard_EXPORT MoniTool_ValueType | ValueType () const
| Returns the type of the value .
Standard_EXPORT TCollection_AsciiString | Definition () const
| Returns the Definition By priority, the enforced one, else an automatic one, computed from the specification .
Standard_EXPORT void | SetDefinition (const Standard_CString deftext)
| Enforces a Definition .
virtual Standard_EXPORT void | Print (const Handle(Message_Messenger)&S) const
| Prints definition, specification, and actual status and value .
Standard_EXPORT void | PrintValue (const Handle(Message_Messenger)&S) const
| Prints only the Value .
Standard_EXPORT Standard_Boolean | AddDef (const Standard_CString 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
.

Standard_EXPORT void | SetLabel (const Standard_CString label)
| Sets a label, which can then be displayed .
Standard_EXPORT Standard_CString | Label () const
| Returns the label, if set; else returns an empty string .
Standard_EXPORT void | SetMaxLength (const Standard_Integer max)
| Sets a maximum length for a text (active only for a free text) .
Standard_EXPORT Standard_Integer | MaxLength () const
| Returns the maximum length, 0 if not set .
Standard_EXPORT void | SetIntegerLimit (const Standard_Boolean max, const Standard_Integer val)
| Sets an Integer limit (included) to <val>, the upper limit if <max> is True, the lower limit if <max> is False .
Standard_EXPORT Standard_Boolean | IntegerLimit (const Standard_Boolean max, Standard_Integer &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) .
Standard_EXPORT void | SetRealLimit (const Standard_Boolean max, const Standard_Real val)
| Sets a Real limit (included) to <val>, the upper limit if <max> is True, the lower limit if <max> is False .
Standard_EXPORT Standard_Boolean | RealLimit (const Standard_Boolean max, Standard_Real &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) .
Standard_EXPORT void | SetUnitDef (const Standard_CString 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 .
Standard_EXPORT Standard_CString | UnitDef () const
| Returns the recorded unit definition, empty if not set .
Standard_EXPORT void | StartEnum (const Standard_Integer start=0, const Standard_Boolean match=Standard_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) .
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 enumerative definitions. For more than 10, several calls .
Standard_EXPORT void | AddEnumValue (const Standard_CString val, const Standard_Integer 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 .
Standard_EXPORT Standard_Boolean | EnumDef (Standard_Integer &startcase, Standard_Integer &endcase, Standard_Boolean &match) const
| Gives the Enum definitions : start value, end value, match status. Returns True for an Enum, False else. .
Standard_EXPORT Standard_CString | EnumVal (const Standard_Integer num) const
| Returns the value of an enumerative definition, from its rank Empty string if out of range or not an Enum .
Standard_EXPORT Standard_Integer | EnumCase (const Standard_CString val) 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 void | SetObjectType (const Handle(Standard_Type)&typ)
| Sets type of which an Object TypedValue must be kind of //! Error for a TypedValue not an Object (Entity) .
Standard_EXPORT 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 .
Standard_EXPORT void | SetInterpret (const MoniTool_ValueInterpret func)
| Sets a specific Interpret function .
virtual Standard_EXPORT Standard_Boolean | HasInterpret () const
| Tells if a TypedValue has an Interpret .
Standard_EXPORT void | SetSatisfies (const MoniTool_ValueSatisfies func, const Standard_CString name)
| 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 Standard_CString | SatisfiesName () const
| Returns name of specific satisfy, empty string if none .
Standard_EXPORT Standard_Boolean | IsSetValue () const
| Returns True if the value is set (not empty/not null object) .
Standard_EXPORT Standard_CString | CStringValue () const
| Returns the value, as a cstring. Empty if not set. .
Standard_EXPORT Handle_TCollection_HAsciiString | HStringValue () const
| Returns the value, as a Handle (can then be shared) Null if not defined .
virtual Standard_EXPORT Handle_TCollection_HAsciiString | Interpret (const Handle(TCollection_HAsciiString)&hval, const Standard_Boolean 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 Standard_EXPORT Standard_Boolean | Satisfies (const 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) .
Standard_EXPORT void | ClearValue ()
| Clears the recorded Value : it is now unset .
virtual Standard_EXPORT Standard_Boolean | SetCStringValue (const Standard_CString 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 Standard_EXPORT Standard_Boolean | SetHStringValue (const 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)
.

Standard_EXPORT Standard_Integer | 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 Standard_EXPORT Standard_Boolean | SetIntegerValue (const Standard_Integer ival)
| Changes the value as an integer, only for Integer or Enum .
Standard_EXPORT Standard_Real | RealValue () const
| Returns the value as real, for a Real type TypedValue Else, returns 0. .
virtual Standard_EXPORT Standard_Boolean | SetRealValue (const Standard_Real rval)
| Changes the value as a real, only for Real .
Standard_EXPORT 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 .
Standard_EXPORT void | GetObjectValue (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 Standard_EXPORT Standard_Boolean | SetObjectValue (const 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) .
Standard_EXPORT Standard_CString | ObjectTypeName () const
| Returns the type name of the ObjectValue, or an empty string if not set .
Standard_EXPORT const | Handle (Standard_Type)&DynamicType() const

## Static Public Member Functions

static Standard_EXPORT Standard_Boolean | AddLib (const Handle(MoniTool_TypedValue)&tv, const Standard_CString 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 If a TypedValue was already recorded under this name, it is replaced .
static Standard_EXPORT Handle_MoniTool_TypedValue | Lib (const Standard_CString def)
| Returns the TypedValue bound with a given Name Null Handle if none recorded Warning : it is the original, not duplicated .
static Standard_EXPORT Handle_MoniTool_TypedValue | FromLib (const Standard_CString def)
| Returns a COPY of the TypedValue bound with a given Name Null Handle if none recorded .
static Standard_EXPORT Handle_TColStd_HSequenceOfAsciiString | 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 Standard_EXPORT Handle_MoniTool_TypedValue | StaticValue (const Standard_CString name)
| Returns a static value from its name, null if unknown .

## Static Protected Member Functions

static Standard_EXPORT Handle_Dico_DictionaryOfTransient | Stats ()
| Gives the internal library of static values .

## Private Attributes

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

## Constructor & Destructor Documentation

Standard_EXPORT MoniTool_TypedValue::MoniTool_TypedValue | ( | const Standard_CString | name,
|  | const MoniTool_ValueType | type = `MoniTool_ValueText`,
|  | const Standard_CString | init = `""`
| ) |

Standard_EXPORT MoniTool_TypedValue::MoniTool_TypedValue | ( | const Handle(MoniTool_TypedValue)& | other | ) |

## Member Function Documentation

Standard_EXPORT Standard_Boolean MoniTool_TypedValue::AddDef | ( | const Standard_CString | initext | ) |

Standard_EXPORT void MoniTool_TypedValue::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 = `""`
| ) |

Standard_EXPORT void MoniTool_TypedValue::AddEnumValue | ( | const Standard_CString | val,
|  | const Standard_Integer | num
| ) |

static Standard_EXPORT Standard_Boolean MoniTool_TypedValue::AddLib | ( | const Handle(MoniTool_TypedValue)& | tv,
|  | const Standard_CString | def = `""`
| ) | `[static]`

Standard_EXPORT void MoniTool_TypedValue::ClearValue | ( |  | ) |

Standard_EXPORT Standard_CString MoniTool_TypedValue::CStringValue | ( |  | ) | const

Standard_EXPORT TCollection_AsciiString MoniTool_TypedValue::Definition | ( |  | ) | const

Standard_EXPORT Standard_Integer MoniTool_TypedValue::EnumCase | ( | const Standard_CString | val | ) | const

Standard_EXPORT Standard_Boolean MoniTool_TypedValue::EnumDef | ( | Standard_Integer & | startcase,
|  | Standard_Integer & | endcase,
|  | Standard_Boolean & | match
| ) | const

Standard_EXPORT Standard_CString MoniTool_TypedValue::EnumVal | ( | const Standard_Integer | num | ) | const

static Standard_EXPORT Handle_MoniTool_TypedValue MoniTool_TypedValue::FromLib | ( | const Standard_CString | def | ) | `[static]`

Standard_EXPORT void MoniTool_TypedValue::GetObjectValue | ( | Handle(Standard_Transient)& | val | ) | const

Standard_EXPORT const MoniTool_TypedValue::Handle | ( | Standard_Type |  | ) | const

| Reimplemented in Interface_Static, and Interface_TypedValue.

virtual Standard_EXPORT Standard_Boolean MoniTool_TypedValue::HasInterpret | ( |  | ) | const`[virtual]`

Standard_EXPORT Handle_TCollection_HAsciiString MoniTool_TypedValue::HStringValue | ( |  | ) | const

Standard_EXPORT Standard_Boolean MoniTool_TypedValue::IntegerLimit | ( | const Standard_Boolean | max,
|  | Standard_Integer & | val
| ) | const

Standard_EXPORT Standard_Integer MoniTool_TypedValue::IntegerValue | ( |  | ) | const

Standard_EXPORT void MoniTool_TypedValue::Internals | ( | MoniTool_ValueInterpret & | interp,
|  | MoniTool_ValueSatisfies & | satisf,
|  | Standard_CString & | satisname,
|  | Handle(Dico_DictionaryOfInteger)& | enums
| ) | const

virtual Standard_EXPORT Handle_TCollection_HAsciiString MoniTool_TypedValue::Interpret | ( | const Handle(TCollection_HAsciiString)& | hval,
|  | const Standard_Boolean | native
| ) | const`[virtual]`

Standard_EXPORT Standard_Boolean MoniTool_TypedValue::IsSetValue | ( |  | ) | const

Standard_EXPORT Standard_CString MoniTool_TypedValue::Label | ( |  | ) | const

static Standard_EXPORT Handle_MoniTool_TypedValue MoniTool_TypedValue::Lib | ( | const Standard_CString | def | ) | `[static]`

static Standard_EXPORT Handle_TColStd_HSequenceOfAsciiString MoniTool_TypedValue::LibList | ( |  | ) | `[static]`

Standard_EXPORT Standard_Integer MoniTool_TypedValue::MaxLength | ( |  | ) | const

Standard_EXPORT Standard_CString MoniTool_TypedValue::Name | ( |  | ) | const

Standard_EXPORT Handle_Standard_Type MoniTool_TypedValue::ObjectType | ( |  | ) | const

Standard_EXPORT Standard_CString MoniTool_TypedValue::ObjectTypeName | ( |  | ) | const

Standard_EXPORT Handle_Standard_Transient MoniTool_TypedValue::ObjectValue | ( |  | ) | const

virtual Standard_EXPORT void MoniTool_TypedValue::Print | ( | const Handle(Message_Messenger)& | S | ) | const`[virtual]`

Standard_EXPORT void MoniTool_TypedValue::PrintValue | ( | const Handle(Message_Messenger)& | S | ) | const

Standard_EXPORT Standard_Boolean MoniTool_TypedValue::RealLimit | ( | const Standard_Boolean | max,
|  | Standard_Real & | val
| ) | const

Standard_EXPORT Standard_Real MoniTool_TypedValue::RealValue | ( |  | ) | const

virtual Standard_EXPORT Standard_Boolean MoniTool_TypedValue::Satisfies | ( | const Handle(TCollection_HAsciiString)& | hval | ) | const`[virtual]`

Standard_EXPORT Standard_CString MoniTool_TypedValue::SatisfiesName | ( |  | ) | const

virtual Standard_EXPORT Standard_Boolean MoniTool_TypedValue::SetCStringValue | ( | const Standard_CString | val | ) | `[virtual]`

Standard_EXPORT void MoniTool_TypedValue::SetDefinition | ( | const Standard_CString | deftext | ) |

virtual Standard_EXPORT Standard_Boolean MoniTool_TypedValue::SetHStringValue | ( | const Handle(TCollection_HAsciiString)& | hval | ) | `[virtual]`

Standard_EXPORT void MoniTool_TypedValue::SetIntegerLimit | ( | const Standard_Boolean | max,
|  | const Standard_Integer | val
| ) |

virtual Standard_EXPORT Standard_Boolean MoniTool_TypedValue::SetIntegerValue | ( | const Standard_Integer | ival | ) | `[virtual]`

Standard_EXPORT void MoniTool_TypedValue::SetInterpret | ( | const MoniTool_ValueInterpret | func | ) |

Standard_EXPORT void MoniTool_TypedValue::SetLabel | ( | const Standard_CString | label | ) |

Standard_EXPORT void MoniTool_TypedValue::SetMaxLength | ( | const Standard_Integer | max | ) |

Standard_EXPORT void MoniTool_TypedValue::SetObjectType | ( | const Handle(Standard_Type)& | typ | ) |

virtual Standard_EXPORT Standard_Boolean MoniTool_TypedValue::SetObjectValue | ( | const Handle(Standard_Transient)& | obj | ) | `[virtual]`

Standard_EXPORT void MoniTool_TypedValue::SetRealLimit | ( | const Standard_Boolean | max,
|  | const Standard_Real | val
| ) |

virtual Standard_EXPORT Standard_Boolean MoniTool_TypedValue::SetRealValue | ( | const Standard_Real | rval | ) | `[virtual]`

Standard_EXPORT void MoniTool_TypedValue::SetSatisfies | ( | const MoniTool_ValueSatisfies | func,
|  | const Standard_CString | name
| ) |

Standard_EXPORT void MoniTool_TypedValue::SetUnitDef | ( | const Standard_CString | def | ) |

Standard_EXPORT void MoniTool_TypedValue::StartEnum | ( | const Standard_Integer | start = `0`,
|  | const Standard_Boolean | match = `Standard_True`
| ) |

static Standard_EXPORT Handle_MoniTool_TypedValue MoniTool_TypedValue::StaticValue | ( | const Standard_CString | name | ) | `[static]`

static Standard_EXPORT Handle_Dico_DictionaryOfTransient MoniTool_TypedValue::Stats | ( |  | ) | `[static, protected]`

Standard_EXPORT Standard_CString MoniTool_TypedValue::UnitDef | ( |  | ) | const

Standard_EXPORT MoniTool_ValueType MoniTool_TypedValue::ValueType | ( |  | ) | const

## Field Documentation

TCollection_AsciiString MoniTool_TypedValue::thedef`[private]`

| Reimplemented in Interface_TypedValue.

Handle_Dico_DictionaryOfInteger MoniTool_TypedValue::theeadds`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

Handle_TColStd_HArray1OfAsciiString MoniTool_TypedValue::theenums`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

Handle_TCollection_HAsciiString MoniTool_TypedValue::thehval`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

MoniTool_ValueInterpret MoniTool_TypedValue::theinterp`[private]`

| Reimplemented in Interface_TypedValue.

Standard_Integer MoniTool_TypedValue::theintlow`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

Standard_Integer MoniTool_TypedValue::theintup`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

Standard_Integer MoniTool_TypedValue::theival`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

TCollection_AsciiString MoniTool_TypedValue::thelabel`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

Standard_Integer MoniTool_TypedValue::thelims`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

Standard_Integer MoniTool_TypedValue::themaxlen`[private]`

| Reimplemented in Interface_TypedValue.

TCollection_AsciiString MoniTool_TypedValue::thename`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

Handle_Standard_Type MoniTool_TypedValue::theotyp`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

Handle_Standard_Transient MoniTool_TypedValue::theoval`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

Standard_Real MoniTool_TypedValue::therealow`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

Standard_Real MoniTool_TypedValue::therealup`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

MoniTool_ValueSatisfies MoniTool_TypedValue::thesatisf`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

TCollection_AsciiString MoniTool_TypedValue::thesatisn`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

MoniTool_ValueType MoniTool_TypedValue::thetype`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

TCollection_AsciiString MoniTool_TypedValue::theunidef`[private]`

| Reimplemented in Interface_Static, and Interface_TypedValue.

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

- MoniTool_TypedValue.hxx