Valkka  1.6.1
OpenSource Video Management
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
SimpleSharedMemSegment Class Reference

Shared mem segment with simple metadata : just the payload length. More...

#include <sharedmem.h>

Inheritance diagram for SimpleSharedMemSegment:
Inheritance graph
[legend]
Collaboration diagram for SimpleSharedMemSegment:
Collaboration graph
[legend]

Public Member Functions

 SimpleSharedMemSegment (const char *name, std::size_t n_bytes, bool is_server=false)
 
virtual std::size_t getSize ()
 Client: return metadata = the size of the payload (not the maximum size). Uses SharedMemSegment::getMeta.
 
virtual void put (std::vector< uint8_t > &inp_payload, void *meta_)
 typecast void to std::size_t
 
virtual void put (uint8_t *buf_, void *meta_)
 
virtual void putAVRGBFrame (AVRGBFrame *f)
 Copy from AVFrame->data directly. Only metadata used: payload size.
 
virtual void copyMetaFrom (void *meta_)
 Dereference metadata pointer correctly and copy the contents into this memory segment's metadata.
 
virtual void copyMetaTo (void *meta_)
 Dereference metadata pointer correctly and copy the contents from this memory segment's metadata.
 
void put (std::vector< uint8_t > &inp_payload)
 for legacy API
 
- Public Member Functions inherited from SharedMemSegment
 SharedMemSegment (const char *name, std::size_t n_bytes, bool is_server=false)
 Default constructor. More...
 
virtual ~SharedMemSegment ()
 Default destructor.
 
void init ()
 Must be called after construction. Reserves shmem payload and correct metadata (depending on the subclass)
 
void close_ ()
 Must be called before destruction. Releases correct amount of metadata bytes (depending on the subclass)
 
bool getClientState ()
 Was the shmem acquisition succesfull?
 

Public Attributes

std::size_t * meta
 
- Public Attributes inherited from SharedMemSegment
uint8_t * payload
 Pointer to payload.
 
std::size_t n_bytes
 Maximum size of the payload (this much is reserved)
 

Protected Member Functions

virtual void serverInit ()
 Uses shmem_open with write rights. used by the constructor if is_server=true. Init with correct metadata serialization.
 
virtual bool clientInit ()
 Uses shmem_open with read-only rights. Init with correct metadata serialization.
 
virtual void serverClose ()
 Erases the shmem segment. used by the constructor if is_server=true.
 
virtual void clientClose ()
 

Additional Inherited Members

- Protected Attributes inherited from SharedMemSegment
std::string name
 Name to identify the posix objects.
 
std::string payload_name
 Name to identify the posix memory mapped file.
 
std::string meta_name
 Name to identify the posix memory mapped file for the metadata.
 
bool is_server
 Client or server process?
 
void * ptr
 
void * ptr_
 Raw pointers to shared memory.
 
bool client_state
 Was the shmem acquisition succesfull?
 

Detailed Description

Shared mem segment with simple metadata : just the payload length.


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