#include <SharedMemory.h>
Inherits AZ::SharedMemory.
Public Member Functions | |
bool | Create (const char *name, unsigned int size, bool openIfCreated=false) |
bool | Map (AccessMode mode=ReadWrite, unsigned int size=0) |
Maps to the created map. If size == 0 it will map the whole memory. | |
bool | UnMap () |
bool | Write (const void *data, unsigned int dataSize) |
IMPORTANT: All functions below are UNSAFE. Don't forget to Lock/Unlock before/after using them. | |
unsigned int | Read (void *data, unsigned int maxDataSize) |
Reads data up to the maxDataSize, returns number of bytes red. | |
unsigned int | DataToRead () const |
Get number of bytes to read. | |
unsigned int | MaxToWrite () const |
Get maximum data we can write. | |
void | Clear () |
Clears the ring buffer data and reset it to initial condition. | |
Public Member Functions inherited from AZ::SharedMemory | |
CreateResult | Create (const char *name, unsigned int size, bool openIfCreated=false) |
Create a shared memory block. If openIfCreated is false all memory will be cleared to 0. | |
bool | Open (const char *name) |
Open an existing shared memory block. If the block doesn't exist we will return false otherwise true. | |
bool | IsReady () const |
void | Close () |
bool | Map (AccessMode mode=ReadWrite, unsigned int size=0) |
Maps to the created map. If size == 0 it will map the whole memory. | |
bool | IsMapped () const |
bool | UnMap () |
void | lock () |
Naming is conforming with AZStd::lock_guard/unique_lock/etc. | |
bool | try_lock () |
void | unlock () |
bool | IsLockAbandoned () |
const char * | GetName () const |
void * | Data () |
const void * | Data () const |
unsigned int | DataSize () const |
void | Clear () |
Sets all data (if mapped to 0) | |
Additional Inherited Members | |
Public Types inherited from AZ::SharedMemory | |
typedef AZStd::lock_guard< SharedMemory > | MemoryGuard |
Public Types inherited from AZ::SharedMemory_Common | |
enum | AccessMode { ReadOnly , ReadWrite } |
enum | CreateResult { CreateFailed , CreatedNew , CreatedExisting } |
Protected Types inherited from AZ::SharedMemory | |
using | Platform = SharedMemory_Platform |
Protected Member Functions inherited from AZ::SharedMemory | |
SharedMemory (const SharedMemory &) | |
SharedMemory & | operator= (const SharedMemory &) |
Protected Member Functions inherited from AZ::SharedMemory_Unimplemented | |
bool | IsReady () const |
bool | IsMapHandleValid () const |
CreateResult | Create (const char *name, unsigned int size, bool openIfCreated) |
bool | Open (const char *name) |
void | Close () |
bool | Map (AccessMode mode, unsigned int size) |
bool | UnMap () |
void | lock () |
bool | try_lock () |
void | unlock () |
bool | IsLockAbandoned () |
bool | IsWaitFailed () const |
Static Protected Member Functions inherited from AZ::SharedMemory_Unimplemented | |
static int | GetLastError () |
Protected Attributes inherited from AZ::SharedMemory | |
void * | m_data |
Protected Attributes inherited from AZ::SharedMemory_Unimplemented | |
void * | m_globalMutex = nullptr |
Protected Attributes inherited from AZ::SharedMemory_Common | |
char | m_name [128] |
void * | m_mappedBase |
unsigned int | m_dataSize |
Shared memory with read and write pointers.
bool AZ::SharedMemoryRingBuffer::Write | ( | const void * | data, |
unsigned int | dataSize | ||
) |
IMPORTANT: All functions below are UNSAFE. Don't forget to Lock/Unlock before/after using them.
Returns true is we wrote the data, false if the free memory is insufficient.