nv2_label_server.c File Reference

#include "NeovisionII/nv2_label_server.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 <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Include dependency graph for nv2_label_server.c:

Go to the source code of this file.

Classes

struct  nv2_label_server

Functions

static void * run_patch_reader (void *vq)
struct nv2_label_servernv2_label_server_create (const int patch_reader_port, const char *remote_label_reader_addr, const int remote_label_reader_port)
 Create a label server (which will also be a patch reader).
void nv2_label_server_destroy (struct nv2_label_server *p)
 Destroy a label server and release all resources associated with it.
enum nv2_image_patch_result nv2_label_server_get_current_patch (struct nv2_label_server *p, struct nv2_image_patch *ret)
 Get the most recently received patch.
enum nv2_label_send_result nv2_label_server_send_label (struct nv2_label_server *p, const struct nv2_patch_label *l)
 Send a patch label.
void nv2_label_server_set_verbosity (struct nv2_label_server *p, const int verbosity)
 Set the verbosity level for the label server.

Detailed Description

Definition in file nv2_label_server.c.


Function Documentation

struct nv2_label_server* nv2_label_server_create ( const int  patch_reader_port,
const char *  remote_label_reader_addr,
const int  remote_label_reader_port 
) [read]

Create a label server (which will also be a patch reader).

Parameters:
patch_reader_port tcp port on which the patch reader should run on this host machine (by default you should use NV2_PATCH_READER_PORT)
remote_label_reader_addr ip address to which we should connect to find the label reader
remote_label_reader_port tcp port on which the label reader is running on remote_label_reader_addr

Definition at line 252 of file nv2_label_server.c.

References nv2_fatal, and nv2_image_patch_init_empty().

void nv2_label_server_destroy ( struct nv2_label_server p  ) 

Destroy a label server and release all resources associated with it.

Definition at line 289 of file nv2_label_server.c.

References nv2_fatal, and nv2_image_patch_destroy().

enum nv2_image_patch_result nv2_label_server_get_current_patch ( struct nv2_label_server p,
struct nv2_image_patch ret 
)

Get the most recently received patch.

Parameters:
p handle to the label server from which to retrieve the patch
ret the returned image patch; NOTE that ownership of the nv2_image_patch object is transferred to the caller here, so that the caller is responsible for freeing resources associated with this image patch by calling nv2_image_patch_destroy() after use

Definition at line 305 of file nv2_label_server.c.

References NV2_IMAGE_PATCH_END, nv2_image_patch_init_empty(), NV2_IMAGE_PATCH_NONE, and NV2_IMAGE_PATCH_VALID.

enum nv2_label_send_result nv2_label_server_send_label ( struct nv2_label_server p,
const struct nv2_patch_label l 
)

Send a patch label.

Parameters:
p handle to the label server from which to send the patch label
l patch label to be sent
Returns:
non-zero if the label was sent succesfully, or zero if there was an error

Definition at line 320 of file nv2_label_server.c.

References nv2_patch_label::confidence, nv2_fatal, NV2_LABEL_SEND_FAIL, NV2_LABEL_SEND_OK, nv2_robust_write(), and nv2_warn.

void nv2_label_server_set_verbosity ( struct nv2_label_server p,
const int  verbosity 
)

Set the verbosity level for the label server.

Parameters:
verbosity if 0, then don't print anything except fatal error messages; if 1, then also print warnings (but not informational messages)

Definition at line 362 of file nv2_label_server.c.

Generated on Sun May 8 08:13:57 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3