Optimizing the transmission of user-defined types

In the general case, TPO++ cannot make any assumptions about the datatype to be transmitted. The layout in memory can be arbitrary and the number of data elements represented by the type can vary. To optimize communication, the user is allowed to give optimization hints to the TPO++ library. Care must be taken, that the contraints stated by an optimization hint for a type apply to that type, else the result of transmitting the type can be arbitrary, including program failure, since, for reasons of efficiency, TPO++ makes no runtime checks.

TPO++ differs between types having a linear memory layout and types representing data to be transmitted which is contained in non-contiguous memory locations. It further makes a distinction between dynamic data, i.e. types representing data which can be different on every transmission and static data, i.e. types representing constant data during object lifetime.

The most general case corresponds to a marshalling category of TPO_MARSHALL_DYNAMIC and works for all types, but incurring a possible performance loss for static or trivial types.

The user can tag a type with TPO_MARSHALL to give TPO++ a hint, that all objects of this type occupy the same amount of memory.

The user can tag a type with TPO_TRIVIAL to give TPO++ a hint, that an object of this type has constant in linear memory layout. This special optimization should only be used for fine-tuning application performance, since it breaks the type-safety.

Patrick Heckeler 2007-05-31