Commit b5de0e01 authored by Arnaud Blanchard's avatar Arnaud Blanchard

Add wrappers for external access (i.e. python)

parent 9719c3b7
......@@ -59,6 +59,8 @@ typedef struct blc_channel
///Constructor opening the blc_channel in reading mode by default (otherwise use BLC_CHANNEL_WRITE)
blc_channel(char const *new_name, int mode);
///Constructor creating or opening the channel if it exist. In this case it has to be compatible with its properties.
blc_channel(char const *new_name, int mode, uint32_t type, uint32_t format, int dims_nb, int length, va_list vargs);
blc_channel(char const *name, int mode, uint32_t type, uint32_t format, int dims_nb, int length0, ...);
//Unmap the memory and close the file but the other informations are kept. The semaphores are not affected. @TODO See what to do with semaphores
~blc_channel();
......@@ -152,6 +154,12 @@ typedef struct blc_channel
The format are four chars user defined but usually describe the image format 'Y800' (for grey), 'RGB3', 'YUV2' ,...,.
Dims_nb is the number of dimenssions of the data ( 1 for a vector).
The following values are the the length of each dims. You must have the same number of length than dims_nb*/
blc_channel* blc_channel_new( const char *name, int mode, uint32_t type, uint32_t format, int dims_nb, int length0, ...);
void *blc_channel_get_data(blc_channel *channel);
void blc_channel_create(blc_channel* channel, const char *name, int mode, uint32_t type, uint32_t format, int dims_nb, int length0, ...);
/**Open an exisiting channel 'name' */
void blc_channel_open(blc_channel* channel, const char *name, int mode);
......@@ -168,6 +176,8 @@ typedef struct blc_channel
///Remove the blc_channel **name**. The other processes using it will still work but no new ones can use it.
void blc_remove_channel_with_name(char const *name);
void blc_channel_post_event();
void blc_channel_check_for_event(void (*callback)(void*user_data), void *user_data);
......
......@@ -45,6 +45,11 @@ blc_channel::blc_channel(char const *new_name, int mode){
open(new_name, mode);
}
blc_channel::blc_channel(char const *new_name, int mode, uint32_t type, uint32_t format, int dims_nb, int length, va_list vargs):access_mode(0), fd(-1), sem_new_data(NULL), sem_ack_data(NULL)
{
vcreate_or_open(new_name, mode, type,format, dims_nb, length, vargs);
}
blc_channel::blc_channel(char const *new_name, int mode, uint32_t type, uint32_t format, int dims_nb, int length, ...):access_mode(0), fd(-1), sem_new_data(NULL), sem_ack_data(NULL)
{
va_list arguments;
......
......@@ -50,6 +50,22 @@ pthread_t thread;
START_EXTERN_C
// This is especially for binding to external langage (e.g. python)
blc_channel *blc_channel_new(char const *name, int mode, uint32_t type, uint32_t format, int dims_nb, int length0, ...){
blc_channel* channel;
va_list vargs;
va_start(vargs, length0);
channel = new blc_channel(name, mode, type, format, dims_nb, length0, vargs);
va_end(vargs);
return channel;
}
void *blc_channel_get_data(blc_channel *channel){
return channel->data;
}
void blc_remove_channel_with_name(char const *name){
FILE *list_file;
......@@ -285,5 +301,7 @@ void blc_channel_wait_ack_data(void *channel_pt){
}
END_EXTERN_C
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment