gettypeprop
gettypeprop |
Purpose
Synopsis
int gettypeprop(XPRMcontext ctx, int type, int prop, XPRMalltypes *value);
Arguments
ctx
|
Mosel's execution context
|
||||||||||
type
|
Code of a type
|
||||||||||
prop
|
Property to retrieve. Possible values:
|
||||||||||
value
|
Pointer to an area where the type property is returned
|
Return value
0 if successful, -1 if
type is not valid and 1 if
prop is not supported.
Further information
1. This function returns a property of an external type (types provided by modules or user defined). For the property
XPRM_TPROP_NAME, the type name is returned in
value->string, for the 3 other properties, the result is returned in
value->integer.
2. The type features are bit encoded as follows:
XPRM_MTP_CREAT
|
|
XPRM_MTP_DELET
|
|
XPRM_MTP_TOSTR
|
|
XPRM_MTP_FRSTR
|
|
XPRM_MTP_PRTBL
|
|
XPRM_MTP_RFCNT
|
|
XPRM_MTP_COPY
|
|
XPRM_MTP_APPND
|
|
XPRM_MTP_ORSET
|
|
XPRM_MTP_PROB
|
|
XPRM_MTP_CMP
|
|
XPRM_MTP_SHARE
|
|
XPRM_MTP_TFBIN
|
|
XPRM_MTP_ORD
|
|
XPRM_MTP_CONST
|
3. The expanded type is available for user defined types only: it corresponds to the actual type (including structure information) associated to a user defined type code. For instance, assuming the type
myset is defined as a set of integer, getting the type expansion for the code associated to
myset will give
XPRM_STR_SET|XPRM_TYP_INT indicating that a reference to an entity of type
myset has to be handled with functions for sets.
4. Trying to get the expanded type of a module type or the features of a user defined type is an error: the function returns 1. This can be used to identify module types.
5. A user type which expanded value is
XPRM_STR_REC
is a record type. The public fields of a record type may be enumerated with
getnextfield.
6. A user type which expanded value is
XPRM_STR_PROB
is a problem type. The components of a problem type may be enumerated with
getnextpbcomp. Note that problem types are also implemented as native types. In this case, the flag
XPRM_MTP_PROB will be set in the type features.
7. If a type refers to a native or record constant the expanded type has structure
XPRM_STR_CSREF. The function
csrtoref might be used to retrieve the actual object associated to a constant. The property
XPRM_TPROP_ITYPS is an array of integers describing the types of the fields of a constant record (it is
NULL if the referenced type is not a record). The first cell of this array is the number of fields and each following entry is the type of the corresponding field (this information is required when implementing an IO driver supporting initialisations blocks).
Related topics