What exactly do in, out and inout 开发者_Python百科- 'directional' operators mean in CORBA IDL function parameters?
From Ciaran McHale's free online book, CORBA Explained Simply:
The parameters of an operation have a specified direction, which can be
in
(meaning that the parameter is passed from the client to the server),out
(the parameter is passed from the server back to the client) orinout
(the parameter is passed in both directions).
So an in
parameter is very similar to "traditional" function parameters in that the caller must pass a value for them and that value is used by the server to do its work.
An out
parameter is just like a return value, so the caller never populates it with a value. It just magically has a value when the function returns (assuming an exception wasn't thrown) because the server is responsible for putting a value inside it as part of its execution rules. You can have as many out
parameters as you want, allowing you to return multiple distinct objects or values without having to first combine them into a struct
.
An inout
parameter combines the two concepts above. The caller must populate all inout
parameters with valid data but those values may be different after the function returns because the server is free to put new data in there.
精彩评论