OSF DCE Application Development Guide--Introduction and Style Guide

OSF DCE Application Development Guide—Introduction and Style Guide
6.3.7 Pipes
Pipes allow application-level optimization of bulk data transfer, by allowing the
communication and processing of data to overlap. The actual data communications
occur at about the same speed as arrays. However, pipes can reduce latency (how soon
the application sees each ‘‘chunk’’ of data) and memory utilization. The intent is that the
pipe routines should actually process the data and then get rid of it (for example,
summarize it; write it to a file; pass it to another thread) rather than merely write it into
an array. If an application desires to pass all of a stream of data and process it
synchronously, then an array will probably be more efficient, since it entails considerably
less processing overhead, as well as being simpler to program. For more on pipes as a
topic in RPC application development, see the .
6.3.8 The transmit_as Attribute
The [transmit_as] attribute provides applications a way to do their own marshalling of
data types. This is primarily useful as a way to deal with data structures that the stubs
cannot marshall efficiently, such as sparse arrays. Following is an example of code to
compress and reconstruct a large array by removing and then replacing all the zero-
valued elements:
The .idl declarations are as follows:
/*
* Transmit_as example: Here we turn a large sparse array into
* a small conformant array for transmission. The server is able
* to reconstitute the sparse array.
*/
const long int S_ARRAY_SIZE = 32;
typedef struct{
unsigned32 value;
unsigned32 subscript;
} a_element;
typedef struct{
unsigned32 size;
[size_is(size)] a_element array[];
}compact_array_t;
typedef [transmit_as(compact_array_t)] unsigned32 sparse_array_t[S_ARRAY_SIZE];
void ship_array(
[in] handle_t handle,
[in] sparse_array_t *array,
[out] error_status_t *status
);
6 26 Tandem Computers Incorporated 124246