Commit 86eee86f authored by Éric Thiébaut's avatar Éric Thiébaut
Browse files

counter -> serial and list_length -> nbufs

parent c1d7ef4a
......@@ -1077,13 +1077,19 @@ GETTER(tao_encoding, info.config, bufferencoding, TAO_ENCODING_UNKNOWN)
GETTER(tao_state, info, state, TAO_STATE_KILLED)
#undef GETTER
tao_serial tao_get_image_list_length(
const char* tao_shared_camera_get_owner(
const tao_shared_camera* cam)
{
return (TAO_LIKELY(cam != NULL) ? cam->nbufs : 0);
return (cam != NULL ? cam->owner : "");
}
uint64_t tao_get_last_image_counter(
long tao_shared_camera_get_nbufs(
const tao_shared_camera* cam)
{
return (cam != NULL ? cam->nbufs : 0);
}
tao_serial tao_shared_camera_get_serial(
const tao_shared_camera* cam)
{
return (cam != NULL ? cam->serial : 0);
......
......@@ -150,11 +150,6 @@ tao_shared_array* tao_shared_array_create(
return NULL;
}
size_t offset = TAO_SHARED_ARRAY_DATA_OFFSET;
#if 0
fprintf(stderr, "sizeof(tao_shared_array) = %ld bytes\n",
(long)sizeof(tao_shared_array));
fprintf(stderr, "array offset = %ld bytes\n", (long)offset);
#endif
size_t nbytes = offset + nelem*elsize;
tao_shared_array* obj =
(tao_shared_array*)tao_rwlocked_object_create(
......
......@@ -106,22 +106,13 @@ extern tao_shmid tao_shared_camera_get_shmid(
* @param cam Pointer to a shared camera attached to the address space of
* the caller.
*
* @return The name of the shared camera owner.
* @return The name of the shared camera owner. An empty string if `cam` is
* `NULL`. Whatever the result, the last caller's error is left
* unchanged.
*/
extern const char* tao_shared_camera_get_owner(
const tao_shared_camera* cam);
/**
* Get the accesspoint of the server owning a shared camera.
*
* @param cam Pointer to a shared camera attached to the address space of
* the caller.
*
* @return The name of the shared camera owner.
*/
extern const char* tao_get_shared_camera_accesspoint(
const tao_shared_camera* cam);
/**
* Lock a shared camera for reading or writing.
*
......@@ -236,7 +227,7 @@ extern tao_state tao_shared_camera_get_state(
* @return The pixel type for the captured images after pre-processing, `-1`
* if @a cam is `NULL`.
*/
extern tao_eltype tao_get_shared_camera_pixeltype(
extern tao_eltype tao_shared_camera_get_pixeltype(
const tao_shared_camera* cam);
/**
......@@ -392,32 +383,40 @@ extern double tao_shared_camera_get_exposuretime(
* the caller and locked by the caller.
*
* @note The length of the list is immutable, the caller does not have to lock
* the shared camera to insure consistency of the result.
* the shared camera to insure consistency of the result.
*
* @return The length of the list of shared arrays memorized by the owner of
* the shared camera, `0` if @a cam is `NULL`.
* the shared camera, `0` if @a cam is `NULL`. Whatever the result,
* the last caller's error is left unchanged.
*
* @see tao_shared_camera_rdlock.
*/
extern tao_serial tao_get_image_list_length(
extern long tao_shared_camera_get_nbufs(
const tao_shared_camera* cam);
/**
* Get the number of posted images.
* Get the serial number of the last available image.
*
* This function yields the serial number of the last image available from a
* remote camera. This is also the number of images posted by the server
* owning the remote camera so far.
*
* @param cam Pointer to a shared camera attached to the address space of
* the caller and locked by the caller.
*
* @warning Since the last image may change (because acquisition is running),
* the caller must have locked the shared camera. For efficiency reasons, this
* function does not perform error checking.
* @note The serial number of last image may change (i.e., when acquisition is
* running), but the caller may not have locked the shared camera because
* the serial number is an atomic variable. For efficiency reasons, this
* function does not perform error checking.
*
* @return The the number of images posted by the owner of the shared camera
* `0` if none or if @a cam is `NULL`.
* @return A nonnegative integer. A strictly positive value which is the
* serial number of the last available image if any, 0 if image
* acquisition has not yet started of if `cam` is `NULL`. Whatever the
* result, the last caller's error is left unchanged.
*
* @see tao_shared_camera_rdlock.
*/
extern uint64_t tao_get_last_image_counter(
extern tao_serial tao_shared_camera_get_serial(
const tao_shared_camera* cam);
/**
......@@ -481,7 +480,7 @@ extern tao_shmid tao_get_next_image_shmid(
* tao_shared_array* arr = NULL;
* tao_shared_camera_rdlock(NULL, cam);
* {
* uint64_t last_counter = tao_get_last_image_counter(cam);
* tao_serial last_counter = tao_shared_camera_get_serial(cam);
* if (last_counter > previous_counter) {
* arr = tao_attach_last_image(NULL, cam);
* previous_counter = last_counter;
......@@ -502,7 +501,7 @@ extern tao_shmid tao_get_next_image_shmid(
* tao_shared_array* arr = NULL;
* tao_shared_camera_rdlock(NULL, cam);
* {
* uint64_t last_counter = tao_get_last_image_counter(cam);
* tao_serial last_counter = tao_shared_camera_get_serial(cam);
* if (last_counter > previous_counter) {
* tao_shmid shmid = tao_get_last_image_shmid(cam);
* if (shmid != TAO_BAD_SHMID) {
......@@ -517,7 +516,7 @@ extern tao_shmid tao_get_next_image_shmid(
* @return The address of the shared camera in the address space of the caller;
* `NULL` on failure or if there is no valid last image.
*
* @see tao_get_last_image_shmid, tao_get_last_image_counter,
* @see tao_get_last_image_shmid, tao_shared_camera_get_serial,
* tao_attach_next_image.
*/
extern tao_shared_array* tao_attach_last_image(
......
......@@ -177,7 +177,6 @@ extern long tao_remote_mirror_get_nbufs(
*
* This function behaves as tao_shared_object_get_shmid() which to see.
*/
// Constant, no needs to lock object.
extern tao_shmid tao_remote_mirror_get_shmid(
const tao_remote_mirror* obj);
......@@ -441,7 +440,7 @@ extern tao_status tao_remote_mirror_send_commands(
tao_serial* serial);
/**
* Wait for next deformable mirror data-frame.
* Wait for a given deformable mirror data-frame.
*
* This function waits for a specific data-frame to be available. Upon
* success, the contents of the data-frame should be copied as soon as possible
......@@ -482,12 +481,12 @@ extern tao_status tao_remote_mirror_send_commands(
*
* @return A strictly positive number which is the serial number of the
* requested frame, `0` if the requested frame is not available before
* the time limit, `-1` if the requested frame has been overwritten by
* some newer frames, `-2` if the server is not running and the
* requested frame is beyond the last available frame (note that a
* non-running server will never be running again), or `-3` in case of
* failure. In the latter case, error details have been pushed on the
* caller's last error.
* the time limit (i.e. timeout), `-1` if the requested frame is too
* old (it has been overwritten by some newer frames or it is beyond
* the last available frame), `-2` if the server has been killed and
* the requested frame is beyond the last available one, or `-3` in
* case of failure. In the latter case, error details are reflected by
* the caller's last error.
*/
extern tao_serial tao_remote_mirror_wait_data(
tao_remote_mirror* obj,
......
......@@ -223,7 +223,11 @@ extern uint32_t tao_shared_object_get_type(
const tao_shared_object* obj);
/**
* @brief Get the unique identifier of a shared object.
* @brief Get the shared memory of a shared object.
*
* This function yields the shared memory identifier of the shared object.
* This identifier is constant for the life of the object, it is thus not
* necessary to have locked the object to retrieve its identifier.
*
* @param obj Pointer to a shared object attached to the address space of
* the caller.
......
Supports Markdown
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