SharedMemoryImageBuffer Class Reference
Shared memory image buffer. More...
#include <fvutils/ipc/shm_image.h>

Public Member Functions | |
| SharedMemoryImageBuffer (const char *image_id, colorspace_t cspace, unsigned int width, unsigned int height) | |
| Write Constructor. | |
| SharedMemoryImageBuffer (const char *image_id, bool is_read_only=true) | |
| Read Constructor. | |
| ~SharedMemoryImageBuffer () | |
| Destructor. | |
| const char * | image_id () const |
| Get Image ID. | |
| unsigned char * | buffer () const |
| Get image buffer. | |
| colorspace_t | colorspace () const |
| Get color space. | |
| unsigned int | width () const |
| Get image width. | |
| unsigned int | height () const |
| Get image height. | |
| unsigned int | roi_x () const |
| Get ROI X. | |
| unsigned int | roi_y () const |
| Get ROI Y. | |
| unsigned int | roi_width () const |
| Get ROI width. | |
| unsigned int | roi_height () const |
| Get ROI height. | |
| int | circle_x () const |
| Get circle X. | |
| int | circle_y () const |
| Get circle Y. | |
| unsigned int | circle_radius () const |
| Get circle radius. | |
| bool | circle_found () const |
| Check if circle was found . | |
| void | set_roi_x (unsigned int roi_x) |
| Set ROI X. | |
| void | set_roi_y (unsigned int roi_y) |
| Set ROI Y. | |
| void | set_roi_width (unsigned int roi_w) |
| Set ROI width. | |
| void | set_roi_height (unsigned int roi_h) |
| Set ROI height. | |
| void | set_roi (unsigned int roi_x, unsigned int roi_y, unsigned int roi_w, unsigned int roi_h) |
| Set ROI data. | |
| void | set_circle_x (int circle_x) |
| Set circle X. | |
| void | set_circle_y (int circle_y) |
| Set circle Y. | |
| void | set_circle_radius (unsigned int circle_radius) |
| Set circle radius. | |
| void | set_circle (int x, int y, unsigned int r) |
| Set circle data. | |
| void | set_circle_found (bool found) |
| Set circle found. | |
| bool | set_image_id (const char *image_id) |
| Set image number. | |
| fawkes::Time | capture_time () const |
| Get the time when the image was captured. | |
| void | capture_time (long int *sec, long int *usec) const |
| Get the time when the image was captured. | |
| void | set_capture_time (fawkes::Time *time) |
| Set the capture time. | |
| void | set_capture_time (long int sec, long int usec) |
| Set the capture time. | |
Static Public Member Functions | |
| static void | list () |
| List all shared memory segments that contain a FireVision image. | |
| static void | cleanup (bool use_lister=true) |
| Erase all shared memory segments that contain FireVision images. | |
| static bool | exists (const char *image_id) |
| Check image availability. | |
| static void | wipe (const char *image_id) |
| Erase a specific shared memory segment that contains an image. | |
Detailed Description
Shared memory image buffer.Write images to or retrieve images from a shared memory segment.
Definition at line 126 of file shm_image.h.
Constructor & Destructor Documentation
| SharedMemoryImageBuffer::SharedMemoryImageBuffer | ( | const char * | image_id, | |
| colorspace_t | cspace, | |||
| unsigned int | width, | |||
| unsigned int | height | |||
| ) |
Write Constructor.
Create a new shared memory segment. Will open a shared memory segment that exactly fits the given information. Will throw an error if image with id image_id exists. I will create a new segment if no matching segment was found. The segment is accessed in read-write mode.
Use this constructor to open a shared memory image buffer for writing.
- Parameters:
-
image_id image ID to open cspace colorspace width image width height image height
Definition at line 60 of file shm_image.cpp.
References fawkes::SharedMemory::add_semaphore().
| SharedMemoryImageBuffer::SharedMemoryImageBuffer | ( | const char * | image_id, | |
| bool | is_read_only = true | |||
| ) |
Read Constructor.
This constructor is used to search for an existing shared memory segment. It will throw an error if it cannot find a segment with the specified data. The segment is opened read-only by default, but this can be overridden with the is_read_only argument if needed.
Use this constructor to open an image for reading.
- Parameters:
-
image_id Image ID to open is_read_only true to open image read-only
Definition at line 84 of file shm_image.cpp.
| SharedMemoryImageBuffer::~SharedMemoryImageBuffer | ( | ) |
Member Function Documentation
| unsigned char * SharedMemoryImageBuffer::buffer | ( | ) | const |
Get image buffer.
- Returns:
- image buffer.
Definition at line 210 of file shm_image.cpp.
References fawkes::SharedMemory::_memptr.
Referenced by SharedMemoryCamera::buffer(), SharedMemoryCamera::capture(), FuseImageContent::FuseImageContent(), FvRetrieverThread::loop(), and MiniImageProducer::produce().
| void SharedMemoryImageBuffer::capture_time | ( | long int * | sec, | |
| long int * | usec | |||
| ) | const |
Get the time when the image was captured.
- Parameters:
-
sec upon return contains the seconds part of the time usec upon return contains the micro seconds part of the time
Definition at line 160 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::capture_time_sec, and SharedMemoryImageBuffer_header_t::capture_time_usec.
| Time SharedMemoryImageBuffer::capture_time | ( | ) | const |
Get the time when the image was captured.
- Returns:
- capture time
Definition at line 170 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::capture_time_sec, and SharedMemoryImageBuffer_header_t::capture_time_usec.
Referenced by SharedMemoryCamera::capture(), and FuseImageContent::FuseImageContent().
| bool SharedMemoryImageBuffer::circle_found | ( | ) | const |
Check if circle was found .
- Returns:
- true if circle was found, false otherwise
Definition at line 458 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::flag_circle_found.
| unsigned int SharedMemoryImageBuffer::circle_radius | ( | ) | const |
Get circle radius.
- Returns:
- circle radius
Definition at line 310 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::circle_radius.
| int SharedMemoryImageBuffer::circle_x | ( | ) | const |
Get circle X.
- Returns:
- circle X
Definition at line 290 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::circle_x.
| int SharedMemoryImageBuffer::circle_y | ( | ) | const |
Get circle Y.
- Returns:
- circle Y
Definition at line 300 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::circle_y.
| void SharedMemoryImageBuffer::cleanup | ( | bool | use_lister = true |
) | [static] |
Erase all shared memory segments that contain FireVision images.
- Parameters:
-
use_lister if true a lister is used to print the shared memory segments to stdout while cleaning up.
Definition at line 483 of file shm_image.cpp.
References fawkes::SharedMemory::erase_orphaned().
Referenced by FvBaseThread::init().
| colorspace_t SharedMemoryImageBuffer::colorspace | ( | ) | const |
Get color space.
- Returns:
- colorspace
Definition at line 220 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::colorspace.
Referenced by SharedMemoryCamera::buffer_size(), SharedMemoryCamera::colorspace(), and FuseImageContent::FuseImageContent().
| bool SharedMemoryImageBuffer::exists | ( | const char * | image_id | ) | [static] |
Check image availability.
- Parameters:
-
image_id image ID to check
- Returns:
- true if shared memory segment with requested image exists
Definition at line 504 of file shm_image.cpp.
| unsigned int SharedMemoryImageBuffer::height | ( | ) | const |
Get image height.
- Returns:
- image height
Definition at line 240 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::height.
Referenced by SharedMemoryCamera::buffer_size(), FuseImageContent::FuseImageContent(), MiniImageProducer::MiniImageProducer(), SharedMemoryCamera::pixel_height(), and MiniImageProducer::produce().
| const char * SharedMemoryImageBuffer::image_id | ( | ) | const |
Get Image ID.
- Returns:
- image id
Definition at line 149 of file shm_image.cpp.
Referenced by FuseImageContent::FuseImageContent().
| void SharedMemoryImageBuffer::list | ( | ) | [static] |
List all shared memory segments that contain a FireVision image.
Definition at line 466 of file shm_image.cpp.
| unsigned int SharedMemoryImageBuffer::roi_height | ( | ) | const |
Get ROI height.
- Returns:
- ROI height
Definition at line 280 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::roi_height.
| unsigned int SharedMemoryImageBuffer::roi_width | ( | ) | const |
Get ROI width.
- Returns:
- ROI width
Definition at line 270 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::roi_width.
| unsigned int SharedMemoryImageBuffer::roi_x | ( | ) | const |
Get ROI X.
- Returns:
- ROI X
Definition at line 250 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::roi_x.
| unsigned int SharedMemoryImageBuffer::roi_y | ( | ) | const |
Get ROI Y.
- Returns:
- ROI Y
Definition at line 260 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::roi_y.
| void SharedMemoryImageBuffer::set_capture_time | ( | long int | sec, | |
| long int | usec | |||
| ) |
Set the capture time.
- Parameters:
-
sec seconds part of capture time usec microseconds part of capture time
Definition at line 196 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, SharedMemoryImageBuffer_header_t::capture_time_sec, and SharedMemoryImageBuffer_header_t::capture_time_usec.
| void SharedMemoryImageBuffer::set_capture_time | ( | fawkes::Time * | time | ) |
Set the capture time.
- Parameters:
-
time capture time
Definition at line 180 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, SharedMemoryImageBuffer_header_t::capture_time_sec, SharedMemoryImageBuffer_header_t::capture_time_usec, and fawkes::Time::get_timeval().
| void SharedMemoryImageBuffer::set_circle | ( | int | x, | |
| int | y, | |||
| unsigned int | r | |||
| ) |
Set circle data.
- Parameters:
-
x circle X y circle Y r circle radius
Definition at line 433 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, SharedMemoryImageBuffer_header_t::circle_radius, SharedMemoryImageBuffer_header_t::circle_x, and SharedMemoryImageBuffer_header_t::circle_y.
| void SharedMemoryImageBuffer::set_circle_found | ( | bool | found | ) |
Set circle found.
- Parameters:
-
found true if circle found
Definition at line 448 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::flag_circle_found.
| void SharedMemoryImageBuffer::set_circle_radius | ( | unsigned int | circle_radius | ) |
Set circle radius.
- Parameters:
-
circle_radius new circle radius
Definition at line 418 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, and SharedMemoryImageBuffer_header_t::circle_radius.
| void SharedMemoryImageBuffer::set_circle_x | ( | int | circle_x | ) |
Set circle X.
- Parameters:
-
circle_x new circle X
Definition at line 392 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, and SharedMemoryImageBuffer_header_t::circle_x.
| void SharedMemoryImageBuffer::set_circle_y | ( | int | circle_y | ) |
Set circle Y.
- Parameters:
-
circle_y new circle Y
Definition at line 405 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, and SharedMemoryImageBuffer_header_t::circle_y.
| bool SharedMemoryImageBuffer::set_image_id | ( | const char * | image_id | ) |
Set image number.
This will close the currently opened image and will try to open the new image. This operation should be avoided.
- Parameters:
-
image_id new image ID
- Returns:
- true on success
Definition at line 133 of file shm_image.cpp.
References fawkes::SharedMemory::_memptr, fawkes::SharedMemory::attach(), fawkes::SharedMemory::free(), SharedMemoryImageBufferHeader::raw_header(), and SharedMemoryImageBufferHeader::set_image_id().
| void SharedMemoryImageBuffer::set_roi | ( | unsigned int | roi_x, | |
| unsigned int | roi_y, | |||
| unsigned int | roi_w, | |||
| unsigned int | roi_h | |||
| ) |
Set ROI data.
Definition at line 375 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, SharedMemoryImageBuffer_header_t::roi_height, SharedMemoryImageBuffer_header_t::roi_width, SharedMemoryImageBuffer_header_t::roi_x, and SharedMemoryImageBuffer_header_t::roi_y.
| void SharedMemoryImageBuffer::set_roi_height | ( | unsigned int | roi_h | ) |
Set ROI height.
- Parameters:
-
roi_h new ROI height
Definition at line 359 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, and SharedMemoryImageBuffer_header_t::roi_height.
| void SharedMemoryImageBuffer::set_roi_width | ( | unsigned int | roi_w | ) |
Set ROI width.
- Parameters:
-
roi_w new ROI width
Definition at line 346 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, and SharedMemoryImageBuffer_header_t::roi_width.
| void SharedMemoryImageBuffer::set_roi_x | ( | unsigned int | roi_x | ) |
Set ROI X.
- Parameters:
-
roi_x new ROI X
Definition at line 320 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, and SharedMemoryImageBuffer_header_t::roi_x.
| void SharedMemoryImageBuffer::set_roi_y | ( | unsigned int | roi_y | ) |
Set ROI Y.
- Parameters:
-
roi_y new ROI Y
Definition at line 333 of file shm_image.cpp.
References fawkes::SharedMemory::_is_read_only, and SharedMemoryImageBuffer_header_t::roi_y.
| unsigned int SharedMemoryImageBuffer::width | ( | ) | const |
Get image width.
- Returns:
- width
Definition at line 230 of file shm_image.cpp.
References SharedMemoryImageBuffer_header_t::width.
Referenced by SharedMemoryCamera::buffer_size(), FuseImageContent::FuseImageContent(), MiniImageProducer::MiniImageProducer(), SharedMemoryCamera::pixel_width(), and MiniImageProducer::produce().
| void SharedMemoryImageBuffer::wipe | ( | const char * | image_id | ) | [static] |
Erase a specific shared memory segment that contains an image.
- Parameters:
-
image_id ID of image to wipe
Definition at line 519 of file shm_image.cpp.
References fawkes::SharedMemory::erase().
The documentation for this class was generated from the following files:
- src/firevision/fvutils/ipc/shm_image.h
- src/firevision/fvutils/ipc/shm_image.cpp

