Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

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:

simpleio.Write([1,2,3,4,5,6,7,8,9,10])
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:

complexio.Write([union1,union2,union3])
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)