fwrite_serialized_itemT_fwrite_serialized_itemFwriteSerializedItemFwriteSerializedItemfwrite_serialized_item (Operator)

Name

fwrite_serialized_itemT_fwrite_serialized_itemFwriteSerializedItemFwriteSerializedItemfwrite_serialized_item — Write a serialized item to a file.

Signature

fwrite_serialized_item( : : FileHandle, SerializedItemHandle : )

Herror T_fwrite_serialized_item(const Htuple FileHandle, const Htuple SerializedItemHandle)

void FwriteSerializedItem(const HTuple& FileHandle, const HTuple& SerializedItemHandle)

void HSerializedItem::FwriteSerializedItem(const HFile& FileHandle) const

static void HOperatorSet.FwriteSerializedItem(HTuple fileHandle, HTuple serializedItemHandle)

void HSerializedItem.FwriteSerializedItem(HFile fileHandle)

def fwrite_serialized_item(file_handle: HHandle, serialized_item_handle: HHandle) -> None

Description

fwrite_serialized_itemfwrite_serialized_itemFwriteSerializedItemFwriteSerializedItemFwriteSerializedItemfwrite_serialized_item writes a serialized item to the output file with the handle FileHandleFileHandleFileHandleFileHandlefileHandlefile_handle. The serialized item is defined by the handle SerializedItemHandleSerializedItemHandleSerializedItemHandleSerializedItemHandleserializedItemHandleserialized_item_handle. The file can be opened by the operator open_fileopen_fileOpenFileOpenFileOpenFileopen_file. Note that the file must be open in binary format. For writing more than one item in one file, the operator fwrite_serialized_itemfwrite_serialized_itemFwriteSerializedItemFwriteSerializedItemFwriteSerializedItemfwrite_serialized_item must be called several times. A serialized item can be read with fread_serialized_itemfread_serialized_itemFreadSerializedItemFreadSerializedItemFreadSerializedItemfread_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_modelserialize_shape_modelSerializeShapeModelSerializeShapeModelSerializeShapeModelserialize_shape_model performs the serialization for the shape model . After this, a serialized item can be written by fwrite_serialized_itemfwrite_serialized_itemFwriteSerializedItemFwriteSerializedItemFwriteSerializedItemfwrite_serialized_item in a file or can be transferred by send_serialized_itemsend_serialized_itemSendSerializedItemSendSerializedItemSendSerializedItemsend_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_itemfread_serialized_itemFreadSerializedItemFreadSerializedItemFreadSerializedItemfread_serialized_item) or is received over the socket connection from another HALCON process (see receive_serialized_itemreceive_serialized_itemReceiveSerializedItemReceiveSerializedItemReceiveSerializedItemreceive_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_modeldeserialize_shape_modelDeserializeShapeModelDeserializeShapeModelDeserializeShapeModeldeserialize_shape_model deserializes the item for a serialized shape model .

Execution Information

Parameters

FileHandleFileHandleFileHandleFileHandlefileHandlefile_handle (input_control)  file HFile, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

File handle.

SerializedItemHandleSerializedItemHandleSerializedItemHandleSerializedItemHandleserializedItemHandleserialized_item_handle (input_control)  serialized_item HSerializedItem, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the serialized item.

Result

If the parameters are valid, the operator fwrite_serialized_itemfwrite_serialized_itemFwriteSerializedItemFwriteSerializedItemFwriteSerializedItemfwrite_serialized_item returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Possible Predecessors

open_fileopen_fileOpenFileOpenFileOpenFileopen_file, serialize_shape_modelserialize_shape_modelSerializeShapeModelSerializeShapeModelSerializeShapeModelserialize_shape_model, serialize_ncc_modelserialize_ncc_modelSerializeNccModelSerializeNccModelSerializeNccModelserialize_ncc_model

Possible Successors

close_fileclose_fileCloseFileCloseFileCloseFileclose_file, fread_serialized_itemfread_serialized_itemFreadSerializedItemFreadSerializedItemFreadSerializedItemfread_serialized_item

Module

Foundation