|
Fawkes API
Fawkes Development Version
|
Shared memory lookup table. More...
#include <>>

Public Member Functions | |
| SharedMemoryLookupTable (const char *lut_id, unsigned int width, unsigned int height, unsigned int depth=1, unsigned int bytes_per_cell=1) | |
| Write Constructor. | |
| SharedMemoryLookupTable (const char *lut_id, bool is_read_only=true) | |
| Read constructor. | |
| ~SharedMemoryLookupTable () | |
| Destructor. | |
| const char * | lut_id () const |
| Get LUT ID. | |
| bool | set_lut_id (const char *lut_id) |
| Set LUT ID. | |
| unsigned char * | buffer () const |
| Get LUT buffer. | |
| unsigned int | width () const |
| Get LUT width. | |
| unsigned int | height () const |
| Get LUT height. | |
| unsigned int | depth () const |
| Get LUT depth. | |
| unsigned int | bytes_per_cell () const |
| Get bytes per cell. | |
Public Member Functions inherited from fawkes::SharedMemory | |
| SharedMemory (const char *magic_token, SharedMemoryHeader *header, bool is_read_only, bool create, bool destroy_on_delete, const char *registry_name=0) | |
| Create a new shared memory segment. | |
| SharedMemory (const SharedMemory &s) | |
| Copy constructor. | |
| virtual | ~SharedMemory () |
| Destructor. | |
| bool | is_read_only () const |
| Check for read-only mode. | |
| bool | is_destroyed () const |
| Check if segment has been destroyed This can be used if the segment has been destroyed. | |
| bool | is_swapable () const |
| Check if memory can be swapped out. | |
| bool | is_valid () const |
| Check validity of shared memory segment. | |
| bool | is_creator () const |
| Determine if the shared memory segment has been created by this instance. | |
| bool | is_protected () const |
| Check if memory segment is protected. | |
| void * | memptr () const |
| Get a pointer to the shared memory This method returns a pointer to the data-segment of the shared memory segment. | |
| size_t | data_size () const |
| Get the size of the data-segment. | |
| int | shmem_id () const |
| Get shared memory ID. | |
| unsigned int | num_attached () const |
| Get number of attached processes. | |
| void | set (void *memptr) |
| Copies data from the memptr to shared memory. | |
| void | set_destroy_on_delete (bool destroy) |
| Set deletion behaviour. | |
| void | add_semaphore () |
| Add semaphore to shared memory segment. | |
| void | set_swapable (bool swapable) |
| Set shared memory swapable. | |
| void | lock_for_read () |
| Lock shared memory segment for reading. | |
| bool | try_lock_for_read () |
| Try to aquire lock on shared memory segment for reading. | |
| void | lock_for_write () |
| Lock shared memory segment for writing. | |
| bool | try_lock_for_write () |
| Try to aquire lock on shared memory segment for writing. | |
| void | unlock () |
| Unlock memory. | |
| void * | ptr (void *addr) const |
| Get the real pointer to the data based on an address. | |
| void * | addr (void *ptr) const |
| Get an address from a real pointer. | |
Static Public Member Functions | |
| static void | list () |
| List shared memory LUT segments. | |
| static void | cleanup (bool use_lister=true) |
| Erase all shared memory segments that contain FireVision LUTs. | |
| static bool | exists (const char *lut_id) |
| Check LUT availability. | |
| static void | wipe (const char *lut_id) |
| Erase a specific shared memory segment that contains a LUT. | |
Static Public Member Functions inherited from fawkes::SharedMemory | |
| static void | list (const char *magic_token, SharedMemoryHeader *header, SharedMemoryLister *lister, const char *registry_name=0) |
| List shared memory segments of a given type. | |
| static void | erase (const char *magic_token, SharedMemoryHeader *header, SharedMemoryLister *lister=0, const char *registry_name=0) |
| Erase shared memory segments of a given type. | |
| static void | erase_orphaned (const char *magic_token, SharedMemoryHeader *header, SharedMemoryLister *lister=0, const char *registry_name=0) |
| Erase orphaned (attach count = 0) shared memory segments of a given type. | |
| static bool | exists (const char *magic_token, SharedMemoryHeader *header, const char *registry_name=0) |
| Check if a specific shared memory segment exists. | |
| static bool | is_destroyed (int shm_id) |
| Check if a segment has been destroyed. | |
| static bool | is_swapable (int shm_id) |
| Check if memory can be swapped out. | |
| static unsigned int | num_attached (int shm_id) |
| Get number of attached processes. | |
| static SharedMemoryIterator | find (const char *magic_token, SharedMemoryHeader *header, const char *registry_name=0) |
| Find SharedMemory segments. | |
| static SharedMemoryIterator | end () |
| Get invalid iterator. | |
Additional Inherited Members | |
Static Public Attributes inherited from fawkes::SharedMemory | |
| static const unsigned int | MagicTokenSize = MAGIC_TOKEN_SIZE |
| The magic token size. | |
| static const short | MaxNumConcurrentReaders = 8 |
| Maximum number of concurrent readers. | |
Protected Member Functions inherited from fawkes::SharedMemory | |
| SharedMemory (const char *magic_token, bool is_read_only, bool create, bool destroy_on_delete, const char *registry_name=0) | |
| Constructor for derivates. | |
| void | attach () |
| Attach to the shared memory segment. | |
| void | free () |
| Detach from and maybe destroy the shared memory segment. | |
Protected Attributes inherited from fawkes::SharedMemory | |
| void * | _memptr |
| Pointer to the data segment. | |
| size_t | _mem_size |
| Total size of the segment, including headers. | |
| size_t | _data_size |
| Size of the data segment only. | |
| SharedMemoryHeader * | _header |
| Data-specific header. | |
| bool | _is_read_only |
| Read-only. | |
| bool | _destroy_on_delete |
| destroy on delete. | |
| bool | _should_create |
| Create shared memory segment. | |
| char * | _magic_token |
| Magic token. | |
| char * | _shm_magic_token |
| Magic token as stored in the shared memory segment. | |
| SharedMemory_header_t * | _shm_header |
| general header as stored in the shared memory segment | |
| void * | _shm_upper_bound |
| Upper bound of memory. | |
| long unsigned int | _shm_offset |
| Offset to the master's base addr. | |
| firevision::SharedMemoryLookupTable::SharedMemoryLookupTable | ( | const char * | lut_id, |
| unsigned int | width, | ||
| unsigned int | height, | ||
| unsigned int | depth = 1, |
||
| unsigned int | bytes_per_cell = 1 |
||
| ) |
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 num image_num exists it will throw an exception an exception. I will create a new segment if no matching segment was found. The segment is accessed in read-write mode.
| lut_id | LUT ID |
| width | LUT width |
| height | LUT height |
| depth | LUT depth |
| bytes_per_cell | LUT bytes per cell |
Definition at line 58 of file shm_lut.cpp.
| firevision::SharedMemoryLookupTable::SharedMemoryLookupTable | ( | const char * | lut_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.
| lut_id | LUT ID |
| is_read_only | true to open read-only |
Definition at line 77 of file shm_lut.cpp.
| firevision::SharedMemoryLookupTable::~SharedMemoryLookupTable | ( | ) |
| unsigned char * firevision::SharedMemoryLookupTable::buffer | ( | ) | const |
Get LUT buffer.
Definition at line 148 of file shm_lut.cpp.
References fawkes::SharedMemory::_memptr.
Referenced by firevision::FuseLutContent::FuseLutContent().
| unsigned int firevision::SharedMemoryLookupTable::bytes_per_cell | ( | ) | const |
Get bytes per cell.
Definition at line 188 of file shm_lut.cpp.
References firevision::SharedMemoryLookupTable_header_t::bytes_per_cell.
Referenced by firevision::FuseLutContent::FuseLutContent().
|
static |
Erase all shared memory segments that contain FireVision LUTs.
| use_lister | if true a lister is used to print the shared memory segments to stdout while cleaning up. |
Definition at line 213 of file shm_lut.cpp.
References fawkes::SharedMemory::erase_orphaned().
| unsigned int firevision::SharedMemoryLookupTable::depth | ( | ) | const |
Get LUT depth.
Definition at line 178 of file shm_lut.cpp.
References firevision::SharedMemoryLookupTable_header_t::depth.
Referenced by firevision::FuseLutContent::FuseLutContent().
|
static |
Check LUT availability.
| lut_id | image number to check |
Definition at line 234 of file shm_lut.cpp.
| unsigned int firevision::SharedMemoryLookupTable::height | ( | ) | const |
Get LUT height.
Definition at line 168 of file shm_lut.cpp.
References firevision::SharedMemoryLookupTable_header_t::height.
Referenced by firevision::FuseLutContent::FuseLutContent().
|
static |
List shared memory LUT segments.
Definition at line 196 of file shm_lut.cpp.
| const char * firevision::SharedMemoryLookupTable::lut_id | ( | ) | const |
Get LUT ID.
Definition at line 122 of file shm_lut.cpp.
Referenced by firevision::FuseLutContent::FuseLutContent().
| bool firevision::SharedMemoryLookupTable::set_lut_id | ( | const char * | lut_id | ) |
Set LUT ID.
| lut_id | LUT ID |
Definition at line 133 of file shm_lut.cpp.
References fawkes::SharedMemory::_memptr, fawkes::SharedMemory::attach(), fawkes::SharedMemory::free(), and firevision::SharedMemoryLookupTableHeader::set_lut_id().
| unsigned int firevision::SharedMemoryLookupTable::width | ( | ) | const |
Get LUT width.
Definition at line 158 of file shm_lut.cpp.
References firevision::SharedMemoryLookupTable_header_t::width.
Referenced by firevision::FuseLutContent::FuseLutContent().
|
static |
Erase a specific shared memory segment that contains a LUT.
| lut_id | LUT ID |
Definition at line 247 of file shm_lut.cpp.
References fawkes::SharedMemory::erase().