next up previous contents index
Next: Objects of undefined data Up: Objects and structures Previous: How to create and   Contents   Index


Aliases of object types

It is possible to define faster several identical object types with different names using the keyword alias. If the section !def of the initialization file contains for example the following :

!def
; Objects of type 1 (comment line)
defobj1
-1
0
2
Objects of type 1 : 
ndim1_1
ndim1_2
nb1
; Objects of type 1b (comment line)
defobj1_b
alias defobj1
Objects of type 1b :

the object type defobj1 will first be created. Then another object type called defobj1_b will be created, which will be identical to defobj1 (i.e. they have the same parameters, except the comment defining it). In this case the definition of defobj1_b needs only three lines : in the first is the name of the command defining the objects of this type, in the second we put the keyword alias followed by the name of a previously defined object type and in the third the comment defining the object type.

It is possible to see in a program if an object type is an alias of another. For this we use the global variable

int *Obj_alias;

If the object type number i is not the alias of another object type, the integer Obj_alias[i] will be equal to i. If this object type is the alias of the object type j then Obj_alias[i] will be equal to j (in this case j is smaller than i). This array can be used for instance if one wants to write commands using object types which are the aliases of one object type.


next up previous contents index
Next: Objects of undefined data Up: Objects and structures Previous: How to create and   Contents   Index
2009-11-12