![]() |
cacao
Release 0.1.03-dev
Compute And Control For Adaptive Optics
|
Function prototypes for ImageStreamIO. More...
#include "ImageStruct.h"
Go to the source code of this file.
Functions | |
void | __attribute__ ((constructor)) libinit_ImageStreamIO() |
Initialize module. More... | |
errno_t | init_ImageStreamIO () |
errno_t | ImageStreamIO_set_default_printError () |
Set the error reporting function to the default provided by the library. More... | |
errno_t | ImageStreamIO_set_printError (errno_t(*new_printError)(const char *, const char *, int, errno_t, char *)) |
Set the error reporting function. The new function supplied by the pointer will be called whenever a library function reports an error. Pass NULL to turn off error reporting from within the library. More... | |
ImageStreamIO - 0. Utilities | |
uint64_t | ImageStreamIO_nbSlices (const IMAGE *image) |
uint64_t | ImageStreamIO_writeIndex (const IMAGE *image) |
uint64_t | ImageStreamIO_readLastWroteIndex (const IMAGE *image) |
errno_t | ImageStreamIO_readBufferAt (const IMAGE *image, const unsigned int slice_index, void **buffer) |
Get the raw pointer to the beginning of the slice slice_index. More... | |
errno_t | ImageStreamIO_writeBuffer (const IMAGE *image, void **buffer) |
Get the raw pointer where the producer should write. More... | |
errno_t | ImageStreamIO_readLastWroteBuffer (const IMAGE *image, void **buffer) |
Get the raw pointer where the consumer will find the last frame wrote. More... | |
errno_t | ImageStreamIO_filename (char *file_name, size_t ssz, const char *im_name) |
Get the standard stream filename. More... | |
int | ImageStreamIO_typesize (uint8_t atype) |
Get the size in bytes from the data type code. More... | |
int | ImageStreamIO_bitpix (uint8_t atype) |
Get the FITSIO BITPIX from the data type code. More... | |
ImageStreamIO - 1. READ / WRITE STREAM | |
errno_t | ImageStreamIO_createIm (IMAGE *image, const char *name, long naxis, uint32_t *size, uint8_t atype, int shared, int NBkw) |
Create shared memory image stream (legacy API) More... | |
errno_t | ImageStreamIO_createIm_gpu (IMAGE *image, const char *name, long naxis, uint32_t *size, uint8_t atype, int8_t location, int shared, int NBsem, int NBkw, uint64_t imagetype) |
Create shared memory image stream. More... | |
errno_t | ImageStreamIO_destroyIm (IMAGE *image) |
Deallocate and remove an IMAGE structure. More... | |
errno_t | ImageStreamIO_openIm (IMAGE *image, const char *name) |
Connect to an existing shared memory image stream. More... | |
void * | ImageStreamIO_get_image_d_ptr (IMAGE *image) |
errno_t | ImageStreamIO_read_sharedmem_image_toIMAGE (const char *name, IMAGE *image) |
Read / connect to existing shared memory image stream. More... | |
errno_t | ImageStreamIO_closeIm (IMAGE *image) |
Close a shared memmory image stream. More... | |
ImageStreamIO - 2. MANAGE SEMAPHORES | |
int | ImageStreamIO_destroysem (IMAGE *image) |
Destroy shmim semaphores. More... | |
int | ImageStreamIO_createsem (IMAGE *image, long NBsem) |
Create shmim semaphores. More... | |
long | ImageStreamIO_sempost (IMAGE *image, long index) |
Post all shmim semaphores. More... | |
long | ImageStreamIO_sempost_excl (IMAGE *image, long index) |
Post all shmim semaphores except one. More... | |
long | ImageStreamIO_sempost_loop (IMAGE *image, long index, long dtus) |
Post shmim semaphores at regular time interval. More... | |
int | ImageStreamIO_getsemwaitindex (IMAGE *image, int semindexdefault) |
Get available semaphore index. More... | |
int | ImageStreamIO_semwait (IMAGE *image, int index) |
Wait for semaphore. More... | |
int | ImageStreamIO_semtrywait (IMAGE *image, int index) |
int | ImageStreamIO_semtimedwait (IMAGE *image, int index, const struct timespec *semwts) |
long | ImageStreamIO_semflush (IMAGE *image, long index) |
Flush all semaphores of a shmim. More... | |
Function prototypes for ImageStreamIO.
void __attribute__ | ( | (constructor) | ) |
Initialize module.
int ImageStreamIO_bitpix | ( | uint8_t | atype | ) |
Get the FITSIO BITPIX from the data type code.
[in] | atype | the type code (see ImageStruct.h |
Close a shared memmory image stream.
For use in clients, detaches and cleans up memory used by non-owner process.
[in] | image | A real-time image structure which contains the image data and meta-data. |
errno_t ImageStreamIO_createIm | ( | IMAGE * | image, |
const char * | name, | ||
long | naxis, | ||
uint32_t * | size, | ||
uint8_t | atype, | ||
int | shared, | ||
int | NBkw | ||
) |
Create shared memory image stream (legacy API)
[out] | image | IMAGE structure which will have its members allocated and initialized. |
[in] | name | the name of the shared memory file will be data.tmpfsdir/<name>_im.shm |
[in] | naxis | number of axes in the image. |
[in] | size | the size of the image along each axis. Must have naxis elements. |
[in] | atype | data type code |
[in] | shared | if true then a shared memory buffer is allocated. If false, only local storage is used. |
[in] | NBkw | the number of keywords to allocate. |
errno_t ImageStreamIO_createIm_gpu | ( | IMAGE * | image, |
const char * | name, | ||
long | naxis, | ||
uint32_t * | size, | ||
uint8_t | atype, | ||
int8_t | location, | ||
int | shared, | ||
int | NBsem, | ||
int | NBkw, | ||
uint64_t | imagetype | ||
) |
Create shared memory image stream.
[out] | image | IMAGE structure which will have its members allocated and initialized. |
[in] | name | the name of the shared memory file will be data.tmpfsdir/<name>_im.shm |
[in] | naxis | number of axes in the image. |
[in] | size | the size of the image along each axis. Must have naxis elements. |
[in] | atype | data type code |
[in] | location | if -1 then a CPU memory buffer is allocated. If >=0, GPU memory buffer is allocated on devive location . |
[in] | shared | if true then a shared memory buffer is allocated. If false, only local storage is used. |
[in] | NBsem | the number of semaphores to allocate. |
[in] | NBkw | the number of keywords to allocate. |
[in] | imagetype | type of the stream |
int ImageStreamIO_createsem | ( | IMAGE * | image, |
long | NBsem | ||
) |
Create shmim semaphores.
Create semaphore of a shmim
[in] | image | IMAGE* pointer to shmim |
[in] | NBsem | number of semaphores to be created |
[in] | image | the name of the shared memory file |
[in] | NBsem | number of semaphores to be created |
Deallocate and remove an IMAGE structure.
For a shared image: Closes all semaphores, deallcoates sem pointers, and removes associated files. Unmaps the shared memory segment, and finally removes the file. Sets the metadata and keyword pointers to NULL.
For a non-shred image: Deallocates all arrays and sets pointers to NULL.
[in] | image | The IMAGE structure to deallocate and remove from the system. |
int ImageStreamIO_destroysem | ( | IMAGE * | image | ) |
Destroy shmim semaphores.
Destroy semaphore of a shmim
[in] | image | IMAGE* pointer to shmim |
[in] | image | the name of the shared memory file |
errno_t ImageStreamIO_filename | ( | char * | file_name, |
size_t | ssz, | ||
const char * | im_name | ||
) |
Get the standard stream filename.
Fills in the file_name
string with the standard shared memory image path, e.g.
produces the output:
* /milk/shm/image00.im.shm 8
[out] | file_name | the file name string to fill in |
[in] | ssz | the allocated size of file_name |
[in] | im_name | the image name |
void* ImageStreamIO_get_image_d_ptr | ( | IMAGE * | image | ) |
int ImageStreamIO_getsemwaitindex | ( | IMAGE * | image, |
int | semindexdefault | ||
) |
Get available semaphore index.
Get available shmim semaphore index
[in] | image | IMAGE* pointer to shmim |
[in] | index | preferred semaphore index, if available |
[in] | image | the name of the shared memory file |
|
inline |
Connect to an existing shared memory image stream.
Wrapper for ImageStreamIO_read_sharedmem_image_toIMAGE
errno_t ImageStreamIO_readBufferAt | ( | const IMAGE * | image, |
const unsigned int | slice_index, | ||
void ** | buffer | ||
) |
Get the raw pointer to the beginning of the slice slice_index.
Return the raw pointer to the beginning of the slice slice_index
[in] | image | IMAGE* pointer to shmim |
[in] | indec | const int slice_index of the slice to read |
[out] | buffer | void** pointer to the beginning of the slice |
Get the raw pointer where the consumer will find the last frame wrote.
Return the raw pointer where the consumer will find the last frame wrote
[in] | image | IMAGE* pointer to shmim |
[out] | buffer | void** raw pointer where the consumer will find the last frame wrote |
[in] | image | the name of the shared memory file |
[out] | buffer | raw pointer where the consumer will find the last frame wrote |
|
inline |
long ImageStreamIO_semflush | ( | IMAGE * | image, |
long | index | ||
) |
Flush all semaphores of a shmim.
Flush shmim semaphore
[in] | image | IMAGE* pointer to shmim |
[in] | index | semaphore index flush all semaphores if index<0 |
[in] | image | the name of the shared memory file |
long ImageStreamIO_sempost | ( | IMAGE * | image, |
long | index | ||
) |
Post all shmim semaphores.
Posts semaphore of a shmim if index < 0, post all semaphores
[in] | image | IMAGE* pointer to shmim |
[in] | index | semaphore index index of semaphore to be posted if index=-1, post all semaphores |
[in] | image | the name of the shared memory file |
[in] | index | semaphore index |
long ImageStreamIO_sempost_excl | ( | IMAGE * | image, |
long | index | ||
) |
Post all shmim semaphores except one.
Posts all semaphores of a shmim except one
[in] | image | IMAGE* pointer to shmim |
[in] | index | semaphore index index of semaphore to be excluded |
[in] | image | the name of the shared memory file |
[in] | index | semaphore index |
long ImageStreamIO_sempost_loop | ( | IMAGE * | image, |
long | index, | ||
long | dtus | ||
) |
Post shmim semaphores at regular time interval.
Posts all semaphores of a shmim at regular time intervals
[in] | image | IMAGE* pointer to shmim |
[in] | index | semaphore index is =-1, post all semaphores |
[in] | dtus | time interval [us] |
[in] | image | the name of the shared memory file |
[in] | index | semaphore index |
int ImageStreamIO_semtimedwait | ( | IMAGE * | image, |
int | index, | ||
const struct timespec * | semwts | ||
) |
[in] | image | the name of the shared memory file |
[in] | index | semaphore index |
int ImageStreamIO_semtrywait | ( | IMAGE * | image, |
int | index | ||
) |
[in] | image | the name of the shared memory file |
[in] | index | semaphore index |
int ImageStreamIO_semwait | ( | IMAGE * | image, |
int | index | ||
) |
Wait for semaphore.
Wait on a shmim semaphore
[in] | image | IMAGE* pointer to shmim |
[in] | index | semaphore index |
[in] | image | the name of the shared memory file |
[in] | index | semaphore index |
errno_t ImageStreamIO_set_default_printError | ( | ) |
Set the error reporting function to the default provided by the library.
errno_t ImageStreamIO_set_printError | ( | errno_t(*)(const char *, const char *, int, errno_t, char *) | new_printError | ) |
Set the error reporting function. The new function supplied by the pointer will be called whenever a library function reports an error. Pass NULL
to turn off error reporting from within the library.
new_printError | is a pointer to the function to use for reporting errors. Can be NULL. |
int ImageStreamIO_typesize | ( | uint8_t | atype | ) |
Get the size in bytes from the data type code.
[in] | atype | the type code (see ImageStruct.h |
Get the raw pointer where the producer should write.
Return the raw pointer where the producer should write
[in] | image | IMAGE* pointer to shmim |
[out] | buffer | void** raw pointer where the producer should write |
[in] | image | the name of the shared memory file |
[out] | buffer | raw pointer where the producer should write |
|
inline |
errno_t init_ImageStreamIO | ( | ) |