rgbd
Public Member Functions | Private Attributes | List of all members
rgbd::ClientSHM Class Reference

Client which uses shared memory, requires a server on the same machine. More...

#include <client_shm.h>

Public Member Functions

 ClientSHM ()
 Constructor. More...
 
bool deinitialize ()
 Clears all the shared memory classes to nullptrs or empty classes. initialized will now return false. More...
 
bool initialize (const std::string &server_name, float timeout=5.0)
 Initialize shared memory client. More...
 
bool initialized ()
 Check if the client is initialized. nextImage shouldn't be called if client is not initialized. More...
 
ImagePtr nextImage ()
 Get a new Image. If no new image has been received, the sequence nummer is still the same as the previous call, The ImagePtr will be a nullptr. More...
 
bool nextImage (Image &image)
 Get a new Image. If no new image has been received, the sequence nummer is still the same as the previous call, no image will be written and false will be returned. More...
 
 ~ClientSHM ()
 Destructor. More...
 

Private Attributes

BufferHeaderbuffer_header_
 
uint64_t depth_data_size_
 
unsigned char * image_data_
 
boost::interprocess::mapped_region mem_buffer_header_
 
boost::interprocess::mapped_region mem_image_
 
uint64_t rgb_data_size_
 
uint64_t sequence_nr_
 sequence_nr Contains the sequence nummer of the last NextImage call More...
 
boost::interprocess::shared_memory_object shm_
 

Detailed Description

Client which uses shared memory, requires a server on the same machine.

Definition at line 16 of file client_shm.h.

Constructor & Destructor Documentation

◆ ClientSHM()

rgbd::ClientSHM::ClientSHM ( )

Constructor.

buffer_header_ and image_data_ pointers are initialized to nullptr

Definition at line 21 of file client_shm.cpp.

◆ ~ClientSHM()

rgbd::ClientSHM::~ClientSHM ( )

Destructor.

buffer_header_ and image_data_ are not deleted as the client doesn't close the shared memory

Definition at line 27 of file client_shm.cpp.

Member Function Documentation

◆ deinitialize()

bool rgbd::ClientSHM::deinitialize ( )

Clears all the shared memory classes to nullptrs or empty classes. initialized will now return false.

Returns
indicates success

Definition at line 77 of file client_shm.cpp.

◆ initialize()

bool rgbd::ClientSHM::initialize ( const std::string server_name,
float  timeout = 5.0 
)

Initialize shared memory client.

Parameters
server_nameFully resolved server name
timeoutTimeout to wait for shared memory server
Returns
indicates success

Definition at line 33 of file client_shm.cpp.

◆ initialized()

bool rgbd::ClientSHM::initialized ( )
inline

Check if the client is initialized. nextImage shouldn't be called if client is not initialized.

Returns
initialized or not

Definition at line 53 of file client_shm.h.

◆ nextImage() [1/2]

ImagePtr rgbd::ClientSHM::nextImage ( )

Get a new Image. If no new image has been received, the sequence nummer is still the same as the previous call, The ImagePtr will be a nullptr.

Returns
ImagePtr to an Image or a nullptr

Definition at line 145 of file client_shm.cpp.

◆ nextImage() [2/2]

bool rgbd::ClientSHM::nextImage ( Image image)

Get a new Image. If no new image has been received, the sequence nummer is still the same as the previous call, no image will be written and false will be returned.

Parameters
imageImage reference which will be written.
Returns
valid image written

Definition at line 89 of file client_shm.cpp.

Member Data Documentation

◆ buffer_header_

BufferHeader* rgbd::ClientSHM::buffer_header_
private

Definition at line 77 of file client_shm.h.

◆ depth_data_size_

uint64_t rgbd::ClientSHM::depth_data_size_
private

Definition at line 81 of file client_shm.h.

◆ image_data_

unsigned char* rgbd::ClientSHM::image_data_
private

Definition at line 78 of file client_shm.h.

◆ mem_buffer_header_

boost::interprocess::mapped_region rgbd::ClientSHM::mem_buffer_header_
private

Definition at line 74 of file client_shm.h.

◆ mem_image_

boost::interprocess::mapped_region rgbd::ClientSHM::mem_image_
private

Definition at line 75 of file client_shm.h.

◆ rgb_data_size_

uint64_t rgbd::ClientSHM::rgb_data_size_
private

Definition at line 80 of file client_shm.h.

◆ sequence_nr_

uint64_t rgbd::ClientSHM::sequence_nr_
private

sequence_nr Contains the sequence nummer of the last NextImage call

Definition at line 86 of file client_shm.h.

◆ shm_

boost::interprocess::shared_memory_object rgbd::ClientSHM::shm_
private

Definition at line 72 of file client_shm.h.


The documentation for this class was generated from the following files: