I'd like to use message tags globally in my system as an "attribute
code" that uniquely identifies an object and attribute. To make them
unique, I wanted to define them specifically as a bitfield which
includes an object class code as well as the tag number. For this to
work, I think I need to be able to import or define symbols in
my .proto files to use in the message tags. It doesn't look like this
is currently supported by the compiler. Is this correct? And if so, is
this a feature anyone else could use?

Here's an example of what one of my .protos might look like:


MyObjectClassCode = 500;
message Data {
    optional int32 index1 = MyObjectClassCode << 16 | 1;
    optional int32 index2 = MyObjectClassCode << 16 | 2;
    repeated float coef = MyObjectClassCode << 16 | 3;

even better would be if myObject.proto could import MyObjectClassCode
from other files.

An alternative which I was hoping to avoid would be to write scripts
to parse my header files, evaluate the symbols, and then write
my .proto files accordingly. I am curious if others are doing similar
things with protobufs.

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to