TTCN-3 supports ordered structured types known as record. The elements of a record type may be any of the basic types or user-defined data types (such as other records, sets or arrays).
type record MyRecordType
{
integer field1,
MyOtherRecordType field2 optional,
charstring field3
}
TTCN-3 supports unordered structured types known as set. Set types and values are similar to records except that the
ordering of the set fields is not significant.
type set MySetType
{
integer field1,
charstring field2
}
record定义的数据类型,是具有一定顺序的,而使用set定义的数据类型是没有顺序的。
一般情况下,没有本质区别,但是在数据结构赋值的时候,那么set的类型就非常方便了。
record定义的数据类型,就如同类的构造函数一样(在构造函数中,每个成员的初始化都必须和类声明中成员的声明顺序一致)。