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

Developer

resources

Bounded output parameters

OMG IDL supports three parameter attributes or modes that specify the direction the data flows:

  • in (caller to server)
  • out (server to caller)
  • inout (both directions)
In OMG IDL, the semantics of out and inout is such that the size of a variable-length parameter cannot be known to or bounded by the caller at runtime. However, standard practice in OS Services is for all buffers to be bounded by the caller.

The IDL compiler supports the standard OS Services output semantics through two new IDL keywords, rout and inrout, which are the bounded analogs of out and inout, respectively. The "r" in each keyword refers to the UNIX read() system call, where the caller provides a buffer and specifies at run time the maximum amount of data to be read into the buffer.

For fixed-size types, there is no difference between the traditional out and the new rout (and hence between inout and inrout), as the size is statically known and therefore need not be specified by the caller. However, for variable-size types, such as sequences and strings, rout and inrout imply an upper bound that is passed as an in parameter from client to server. For example, read() could be defined in IDL as follows:

typedef sequence<octet> SeqOctet; 
AEEResult read(rout SeqOctet buffer); 

In IDL, only a single rout parameter is needed, as it implies the caller providing to the server the maximum number of octets to return. See rout parameter of a method for details on how this parameter would be mapped to C/C++.

The rout and inrout modes also differ from out and inout for unions. For unions used as rout and inrout parameters, the union discriminator is specified by the caller and may not be changed by the callee. Any bounds or discriminators present in the active branch of the union are also passed from the caller to the callee. For example, if an IDL union with a long branch and a sequence<octet> branch were used as an rout parameter, the maximum length for the sequence<octet> branch would be valid if and only if the discriminator specified by the client selects the sequence<octet> branch.

Note: The traditional OMG IDL out and inout parameter modes are not currently supported by the compiler.