
#include "NeovisionII/nv2_label_reader.h"#include "NeovisionII/nv2_common.h"#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <errno.h>#include <fcntl.h>#include <pthread.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>
Go to the source code of this file.
| Classes | |
| struct | nv2_label_reader | 
| Functions | |
| static void | cleanup_fd (void *p) | 
| static void * | run_label_reader (void *q) | 
| static void * | run_patch_sender (void *q) | 
| 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). | |
| void | nv2_label_reader_destroy (struct nv2_label_reader *p) | 
| Destroy a label reader and release all resources associated with it. | |
| 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. | |
| 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. | |
| 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.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.
| 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().
| 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().
| 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().
| 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.
 1.6.3
 1.6.3