Packages

Like the Google C++ implementation of Protobuf, the package translates into a namespace. When defining a message in a package, the generated message class will be scoped into a namespace with the same name as the package.

Let us 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 between foo and bar is interpreted as two separate namespaces. An object instantiation of a Dummy message would now look like this:

foo::bar::Dummy my_dummy_message;