fwrite_serialized_item
— Write a serialized item to a file.
fwrite_serialized_item( : : FileHandle, SerializedItemHandle : )
fwrite_serialized_item
writes a serialized item to the
output file with the handle FileHandle
. The serialized
item is defined by the handle SerializedItemHandle
. The
file can be opened by the operator open_file
. Note that the
file must be open in binary format. For writing more than one item in
one file, the operator fwrite_serialized_item
must be called
several times. A serialized item can be read with
fread_serialized_item
.
Basics of the serialization and deserialization
For writing or sending iconic objects, data, or models to a file or
to another HALCON process over a socket connection, first, the iconic
objects, data, or models must be converted to serialized items. For
this purpose, a lot of operators are available. E.g., the
operator serialize_shape_model
performs the serialization
for the shape model . After this, a serialized item can be written
by fwrite_serialized_item
in a file or can be transferred
by send_serialized_item
to another HALCON process over a
socket connection.
To deserialize a serialized item, first a serialized item is read
from a file (see fread_serialized_item
) or is received over
the socket connection from another HALCON process (see
receive_serialized_item
). There are also operators to convert
the serialized item to the original format, i.e., to the iconic object,
the data, or the model. These operators deserialize the iconic
object, the data, or the model. E.g., the operator
deserialize_shape_model
deserializes the item for a serialized
shape model .
FileHandle
(input_control) file →
(handle)
File handle.
SerializedItemHandle
(input_control) serialized_item →
(handle)
Handle of the serialized item.
If the parameters are valid, the operator
fwrite_serialized_item
returns the value 2 (
H_MSG_TRUE)
. If
necessary, an exception is raised.
open_file
,
serialize_shape_model
,
serialize_ncc_model
close_file
,
fread_serialized_item
Foundation