Hi,

I´m unsure on how the serializer determines object identity. Is it by
address or by value? I´m using C++ and trying to serialize something
like that:
A Shop contains all Wheels and Cars. A Car has several Wheels but
those Wheels are also referenced by the Shop. So they are the same
Wheels. (It´s only a stupid example...)

Shop {
  optional Name name = 1;
  repeated Car car = 2;
  repeated Wheel wheel = 3;
}

Car {
  optional Name name = 1;
  repeated Wheel wheel = 2;
}

Wheel {
  optional Name name = 1;
}

When creating the Shop I first create all Wheels and then I want to
create the Cars. For creating the Cars I first have to get the already
created Wheels and find out which one I need, then I add the already
created Wheels to the Car.

Let´s assume every Car has only one Wheel ;) My code would look like
that:

// Find existing Wheel (More complicated in reality)
Wheel existing_wheel = shop->wheel(0);

// Add Wheel
Wheel *to_replace = car->mutable_wheel();
*to_replace = existing_wheel;


If I now serialize the Shop are my Wheels only once serialized? If
yes, is it the recommended way to deal with DAGs?

Thank you!
Conny

--~--~---------~--~----~------------~-------~--~----~
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 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to