#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Enumerations | |
enum | nv2_patch_send_result { NV2_PATCH_SEND_OK = 23456, NV2_PATCH_SEND_FAIL } |
Result type of nv2_label_reader_send_patch(). More... | |
Functions | |
NV2_EXTERN_C struct nv2_label_reader * | nv2_label_reader_create (const int label_reader_port, const char *remote_patch_reader_addr, const int remote_patch_reader_port) |
Create a label reader (which will also be a patch server). | |
NV2_EXTERN_C void | nv2_label_reader_destroy (struct nv2_label_reader *p) |
Destroy a label reader and release all resources associated with it. | |
NV2_EXTERN_C int | nv2_label_reader_get_current_label (struct nv2_label_reader *p, struct nv2_patch_label *l) |
Get the most recently received patch label, if any. | |
NV2_EXTERN_C void | nv2_label_reader_send_patch (struct nv2_label_reader *r, struct nv2_image_patch *p) |
Send an image patch from the patch server asynchronously. | |
NV2_EXTERN_C enum nv2_patch_send_result | nv2_label_reader_send_patch_sync (struct nv2_label_reader *r, struct nv2_image_patch *p, const int show_warnings) |
Send an image patch from the patch server synchronously. |
Definition in file nv2_label_reader.h.
Result type of nv2_label_reader_send_patch().
NV2_PATCH_SEND_OK |
patch was sent succesfully |
NV2_PATCH_SEND_FAIL |
patch was not sent (maybe server is down?) |
Definition at line 86 of file nv2_label_reader.h.
NV2_EXTERN_C struct nv2_label_reader* nv2_label_reader_create | ( | const int | label_reader_port, | |
const char * | remote_patch_reader_addr, | |||
const int | remote_patch_reader_port | |||
) | [read] |
Create a label reader (which will also be a patch server).
label_reader_port | tcp port on which the label reader should run on this host machine (by default, you should use NV2_LABEL_READER_PORT) | |
remote_patch_reader_addr | ip address to which we should connect to find the patch reader | |
remote_patch_reader_port | tcp port on which the patch reader is running on dest_addr |
Definition at line 256 of file nv2_label_reader.c.
References nv2_fatal, nv2_image_patch_init_empty(), nv2_patch_label_init_empty(), and NV2_PATCH_SEND_OK.
NV2_EXTERN_C void nv2_label_reader_destroy | ( | struct nv2_label_reader * | p | ) |
Destroy a label reader and release all resources associated with it.
Definition at line 297 of file nv2_label_reader.c.
References nv2_fatal, and nv2_image_patch_destroy().
NV2_EXTERN_C int nv2_label_reader_get_current_label | ( | struct nv2_label_reader * | p, | |
struct nv2_patch_label * | l | |||
) |
Get the most recently received patch label, if any.
l | if new label is found, it will be copied here |
Definition at line 320 of file nv2_label_reader.c.
References nv2_patch_label_init_empty().
NV2_EXTERN_C void nv2_label_reader_send_patch | ( | struct nv2_label_reader * | r, | |
struct nv2_image_patch * | p | |||
) |
Send an image patch from the patch server asynchronously.
r | handle to the patch server from which to send the patch | |
p | image patch to be sent; note the patch server assumes ownership of this image patch and will free memory associated with it, so (1) the memory in p->data should have be allocated with malloc() so that it can be released with free(), and (2) the patch pointed to by p will be an empty patch on return from this function (reflecting the fact that ownership of the original patch is now transferred to the patch server) |
Definition at line 335 of file nv2_label_reader.c.
References nv2_image_patch_destroy(), and nv2_image_patch_init_empty().
NV2_EXTERN_C enum nv2_patch_send_result nv2_label_reader_send_patch_sync | ( | struct nv2_label_reader * | r, | |
struct nv2_image_patch * | p, | |||
const int | show_warnings | |||
) |
Send an image patch from the patch server synchronously.
This is the work function that is called from a background thread to implement the asynchronous nv2_label_reader_send_patch().
show_warnings | whether or not to print warnings if the patch send fails |
Definition at line 346 of file nv2_label_reader.c.
References nv2_fatal, nv2_image_patch_destroy(), nv2_image_patch_init_empty(), NV2_PATCH_SEND_FAIL, NV2_PATCH_SEND_OK, nv2_pixel_type_bytes_per_pixel(), nv2_robust_write(), and nv2_warn.