indexing description: "[ Event that notifies a peer to create a specific object. The object to be created is attached in `object_to_create'. The object will (by default) be created in the same group as the event is sent from. After the success agent was called, the event caller can assume that the object exists on all remote peers that belong to the sending group. This is a secured two phase commit event. ]" date: "$Date$" revision: "$Revision$" class EM_NET_CREATE_OBJECT_RESPONSE inherit EM_NET_2PC_EVENT_OBJECT create {EM_NET_OBJECT_TYPES} make_set_type feature -- Element change set_object_to_create (an_object: EM_NET_OBJECT) is -- Set `object_to_create' to `an_object'. require object_not_void: an_object /= Void do object_to_create := an_object end set_create_in_group_name (a_name: STRING) is -- Set `create_in_group_name' to `a_name'. require name_valid: a_name /= Void and then not a_name.is_equal ("") do create_in_group_name := a_name end feature -- Information object_to_create: EM_NET_OBJECT -- Object that the event will create on remote peers -- The object needs to be initialized. create_in_group_name: STRING -- Name of the group in which the object will be created feature -- Serialization serialize (a_serializer: EM_NET_SERIALIZER) is -- Serialize to the given stream using `a_serializer'. require else serializer_not_void: a_serializer /= Void object_to_create_set: object_to_create /= Void create_in_group_name_set: create_in_group_name /= Void local init_data: EM_NET_SERIALIZER do a_serializer.put_integer (id) create init_data.make ("") a_serializer.put_integer (object_to_create.type_id) a_serializer.put_integer (object_to_create.id) a_serializer.put_integer (create_in_group_name.count) a_serializer.put_string (create_in_group_name) object_to_create.serialize_init_data (init_data) a_serializer.put_integer (init_data.string.count) a_serializer.put_string (init_data.string) end serialization_byte_count: INTEGER is -- Count of bytes needed for a successful serialization do Result := 16 + create_in_group_name.count + 4 + object_to_create.init_serialization_byte_count end unserialize (an_unserializer: EM_NET_UNSERIALIZER) is -- Unserialize from a given stream using `an_unserializer'. local init_data: EM_NET_UNSERIALIZER do an_unserializer.read_integer id := an_unserializer.last_integer an_unserializer.read_integer object_to_create := group.base.net_object_factory.create_object_by_type_id (an_unserializer.last_integer) an_unserializer.read_integer object_to_create.set_id (an_unserializer.last_integer) an_unserializer.read_integer an_unserializer.read_string (an_unserializer.last_integer) create_in_group_name := an_unserializer.last_string an_unserializer.read_integer an_unserializer.read_string (an_unserializer.last_integer) create init_data.make (an_unserializer.last_string) object_to_create.make_from_stream (init_data) end end