Protocol Buffers
Protocol buffers are method of serializing structured data.
Goal
- Want to use lingua franca in CS.
 - Simplicity and performance. In particular, it was designed to be smaller and faster than XML.
 
Components
- Interface description language.
 - IDL compiler: Program that generate source code from the description.
 
HowTo
- Define structure at proto definition file (.proto)
 - Compile it with protoc.
 - Use generated file.
 
Example
$vi test.proto //define 
$protoc test.proto //compile to generate code
$ls
test.pb.cc //for cpp
test.pb.h
HowTo
Caution
- Prefer use only optional and repeated.