Skip to content

fwrite_serialized_itemFwriteSerializedItemFwriteSerializedItemfwrite_serialized_itemT_fwrite_serialized_item🔗

Short description🔗

fwrite_serialized_itemFwriteSerializedItemFwriteSerializedItemfwrite_serialized_itemT_fwrite_serialized_item — Write a serialized item to a file.

Signature🔗

fwrite_serialized_item( file FileHandle, serialized_item SerializedItemHandle )void FwriteSerializedItem( const HTuple& FileHandle, const HTuple& SerializedItemHandle )static void HOperatorSet.FwriteSerializedItem( HTuple fileHandle, HTuple serializedItemHandle )def fwrite_serialized_item( file_handle: HHandle, serialized_item_handle: HHandle ) -> None

Herror T_fwrite_serialized_item( const Htuple FileHandle, const Htuple SerializedItemHandle )

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

void HSerializedItem.FwriteSerializedItem( HFile fileHandle )

Description🔗

fwrite_serialized_itemFwriteSerializedItem writes a serialized item to the output file with the handle FileHandlefileHandlefile_handle. The serialized item is defined by the handle SerializedItemHandleserializedItemHandleserialized_item_handle. The file can be opened by the operator open_fileOpenFile. Note that the file must be open in binary format. For writing more than one item in one file, the operator fwrite_serialized_itemFwriteSerializedItem must be called several times. A serialized item can be read with fread_serialized_itemFreadSerializedItem.

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_modelSerializeShapeModel performs the serialization for the shape model . After this, a serialized item can be written by fwrite_serialized_itemFwriteSerializedItem in a file or can be transferred by send_serialized_itemSendSerializedItem 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_itemFreadSerializedItem) or is received over the socket connection from another HALCON process (see receive_serialized_itemReceiveSerializedItem). 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_modelDeserializeShapeModel deserializes the item for a serialized shape model .

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

FileHandlefileHandlefile_handle (input_control) file → (handle)HTuple (HHandle)HFile, HTuple (IntPtr)HHandleHtuple (handle)

File handle.

SerializedItemHandleserializedItemHandleserialized_item_handle (input_control) serialized_item → (handle)HTuple (HHandle)HSerializedItem, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the serialized item.

Result🔗

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

Combinations with other operators🔗

Combinations

Possible predecessors

open_fileOpenFile, serialize_shape_modelSerializeShapeModel, serialize_ncc_modelSerializeNccModel

Possible successors

close_fileCloseFile, fread_serialized_itemFreadSerializedItem

Module🔗

Foundation