Everything that I've been trying has been failing completely so I'm 
wondering if there is something that I missing or doing wrong.

To summarize, I have an Any message (let's call it mA) that I know contains 
a certain other specific message (call it messageTypeB).  If I create an 
instance of messageTypeB (call it mB) and mA.UnpackTo(&mB) it fails.  If I 
use the mA.Is<messageTypeB>() method it also returns false.  If I compare 
mA.type_url() to mB.GetDescriptor()->full_name() they differ only in that 
the former has "type.googleapis.com/" at the front.  So it seems that they 
do/should be corresponding to the same type.  Yet the Is() method still 
says they don't.

Just to see what would happen I tried creating a new Any object (call it 
mANew) from mA and use set_type_url() to set the url to exactly the string 
that I'm getting back from mB, but even then mANew.Is<messageTypeB>() 
returns false.

Sometimes code speaks louder than words so here is an example of what I'm 
doing that seems like it should work but isn't:

        const ::vthree::protobuf::Any& anyMessage = 
        const std::string anyUrl = 
// anyUrl is 

        const std::string aName = 
// aName is 

                // It never gets in here.

So now I'm thoroughly baffled (and going a little crazy).  When I ask the 
message for a string telling me type it is, it tells me that it is of a 
certain type.  But if I use the Is() method with that type, it returns 
false.  Even if I set the type_url() string to exactly match what I get 
from the descriptor of the type that I'm trying to unpack into it still 
says it's not that type.

Has anybody else been using Any objects in C++ and had success?  If so, 
were you doing anything different than what I've shown here?  Elsewhere at 
my company we are using these same protobuf binary files in Java and having 
no problems 
so either I'm missing something here or the problem might be specific to 
the C++ libraries.   (For reference we're using Beta-1 but it didn't seem 
like Beta-2 offered any changes that would be related.)


You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to