1 Introduction There are many situations in which it is useful to encode a formal C/C++ data structure like a struct or a class, or some other set of related data into a text-based stream (a process called serialization). This is useful, for instance, when writing structure data to disk or transmitting it to another computer that uses a di*erent hardware architecture. The need for data serialization occurs again and again in the code base, almost always in connection with passing messages between processes or between computers. A simple text- based protocol for serializing/deserializing data into/out of strings is described here. We will rst examine the format of the protocol itself, then we'll look at the MessageParser class. This class implements a simple parser for protocol compliant strings.
Revised: September 30, 2014 |
Published: August 1, 2013