CORBA IDL 输入、输出和输入输出
in、out 和 inout - “方向”运算符在 CORBA IDL 函数参数中到底意味着什么?
What exactly do in, out and inout - 'directional' operators mean in CORBA IDL function parameters?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 Ciaran McHale 的免费在线书籍CORBA 简单解释:
因此,
in
参数与“传统”函数参数非常相似,因为调用者必须为它们传递一个值,并且服务器使用该值来完成其工作。out
参数就像返回值一样,因此调用者永远不会用值填充它。当函数返回时(假设没有抛出异常),它神奇地具有一个值,因为服务器负责将一个值放入其中作为其执行规则的一部分。您可以根据需要拥有任意多个out
参数,从而允许您返回多个不同的对象或值,而无需先将它们组合到struct
中。inout
参数结合了上面的两个概念。调用者必须使用有效数据填充所有inout
参数,但这些值在函数返回后可能会有所不同,因为服务器可以自由地将新数据放入其中。From Ciaran McHale's free online book, CORBA Explained Simply:
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 manyout
parameters as you want, allowing you to return multiple distinct objects or values without having to first combine them into astruct
.An
inout
parameter combines the two concepts above. The caller must populate allinout
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.