Packages

Just like the Goolge C++ implementation of Protobuf, package translate into namespaces. When defining a message in a package, the generated message class will be scoped a namespace with the same name as the package.

Lets take the following .proto where we have placed a simple message in a package:

package foo.bar;

message Dummy
{
  int32 data = 1;
};

The message Dummy will in this case be placed in the namespace foo::bar. The period in between foo and bar is interpreted as two separate namespaces. An object instantiation of a Dummy message would now look like:

foo::bar::Dummy my_dummy_message;