Resources | Resources |



IDL rout parameter of a method in JSON

When a sequence is specified as an rout parameter of a method of an interface, the mapping generates an input constraint parameter for the constraints of the sequence and a LengthRequired is added to the returned parameters. It is given the same name as the sequence parameter but with the suffix LenReq. For example:

var ret = simpleio.Read(2)
assert(ret.seqLenReq == 10)
assert(ret.seq[1] == 1)
assert(ret.seq[2] == 2)

When the elements of a sequence also require constraint parameters, you pass a table of constraints. The length of that table represents the length expected for the returned sequence. For example:

var cons = [{"case": RED}, {"case": GREEN}, {"case": BLUE}]
assert(cons.length == 3)
var ret = complex.Read(cons)
assert(ret.seqLenReq == 3)
assert(ret.seq.length == 3)
assert(ret.seq[1].case == RED)