Portable data

The Taligent Application Environment runs on different processors--sometimes concurrently. If you write or read any data in a context where it might go to or come from a different CPU running the Taligent Application Environment, you have to worry about formats. Such situations include reading or writing disk files, or sending IPC messages that go over a network (or even over an expansion bus). The other CPU might even have a different byte order!

A solution to this problem is to pick a canonical format for messages and data files that is the same no matter what the CPU. The Taligent Application Environment package for reading and writing objects (TStream) already does this. TStream also has static member functions you can call to convert to and from this canonical format without using a stream.

Just because you have a canonical format doesn't mean you must pay a big overhead every time you access your data. One alternative is to perform the translation to or from the canonical format at a predetermined time. For example, TrueType outline fonts have a certain canonical format that depends heavily on the 680x0 architecture. However, you could convert them to a convenient local format when they are installed or when they are used, rather than accessing them directly in their canonical format.

Some data types aren't portable:


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker