| MistServer
    2.5.3-Pro-19-gf5e75b1 ( Generic_64)
    | 
The client part of a server/client model for shared memory. More...
#include <shared_memory.h>
| Public Member Functions | |
| sharedClient () | |
| Creates an empty shared client.  More... | |
| sharedClient () | |
| sharedClient (const sharedClient &rhs) | |
| Copy constructor for sharedClients.  More... | |
| sharedClient (const sharedClient &rhs) | |
| sharedClient (std::string name, int len, bool withCounter=false) | |
| SharedClient Constructor, allocates space on the correct page.  More... | |
| sharedClient (std::string name, int len, bool withCounter=false) | |
| ~sharedClient () | |
| The deconstructor.  More... | |
| ~sharedClient () | |
| void | finish () | 
| void | finish () | 
| Indicate that the process is done using this piece of memory, set the counter to finished.  More... | |
| char * | getData () | 
| Get a pointer to the data of this client.  More... | |
| char * | getData () | 
| void | keepAlive () | 
| Re-initialize the counter.  More... | |
| void | keepAlive () | 
| void | operator= (const sharedClient &rhs) | 
| void | operator= (const sharedClient &rhs) | 
| Assignment operator.  More... | |
| void | write (char *data, int len) | 
| void | write (char *data, int len) | 
| Writes data to the shared data.  More... | |
| Private Attributes | |
| std::string | baseName | 
| The basename of the shared pages.  More... | |
| bool | hasCounter | 
| Whether the payload has a counter, if so, it is added in front of the payload.  More... | |
| sharedPage | myPage | 
| The shared page this client has reserved a space on.  More... | |
| semaphore | mySemaphore | 
| A semaphore that is locked upon trying to allocate space on a page.  More... | |
| int | offsetOnPage | 
| The offset of the payload reserved for this client within the opened page.  More... | |
| int | payLen | 
| The size in bytes of the opened page.  More... | |
The client part of a server/client model for shared memory.
The server manages the shared memory pages, and allocates new pages when needed.
Pages are created with a basename + index, where index is in the range of 'A' - 'Z' Each time a page is nearly full, the next page is created with a size double to the previous one.
Clients should allocate payLen bytes at a time, possibly with the addition of a counter. If no such length can be allocated, the next page should be tried, and so on.
| IPC::sharedClient::sharedClient | ( | ) | 
Creates an empty shared client.
| IPC::sharedClient::sharedClient | ( | const sharedClient & | rhs | ) | 
Copy constructor for sharedClients.
| rhs | The client ro copy | 
| IPC::sharedClient::sharedClient | ( | std::string | name, | 
| int | len, | ||
| bool | withCounter = false | ||
| ) | 
SharedClient Constructor, allocates space on the correct page.
| name | The basename of the server to connect to | 
| len | The size of the payload to allocate | 
| withCounter | Whether or not this payload has a counter | 
| IPC::sharedClient::~sharedClient | ( | ) | 
The deconstructor.
| IPC::sharedClient::sharedClient | ( | ) | 
| IPC::sharedClient::sharedClient | ( | const sharedClient & | rhs | ) | 
| IPC::sharedClient::sharedClient | ( | std::string | name, | 
| int | len, | ||
| bool | withCounter = false | ||
| ) | 
| IPC::sharedClient::~sharedClient | ( | ) | 
| void IPC::sharedClient::finish | ( | ) | 
Indicate that the process is done using this piece of memory, set the counter to finished.
| void IPC::sharedClient::finish | ( | ) | 
| char * IPC::sharedClient::getData | ( | ) | 
Get a pointer to the data of this client.
| char* IPC::sharedClient::getData | ( | ) | 
| void IPC::sharedClient::keepAlive | ( | ) | 
Re-initialize the counter.
| void IPC::sharedClient::keepAlive | ( | ) | 
| void IPC::sharedClient::operator= | ( | const sharedClient & | rhs | ) | 
| void IPC::sharedClient::operator= | ( | const sharedClient & | rhs | ) | 
Assignment operator.
| void IPC::sharedClient::write | ( | char * | data, | 
| int | len | ||
| ) | 
Writes data to the shared data.
| void IPC::sharedClient::write | ( | char * | data, | 
| int | len | ||
| ) | 
| 
 | private | 
The basename of the shared pages.
| 
 | private | 
Whether the payload has a counter, if so, it is added in front of the payload.
| 
 | private | 
The shared page this client has reserved a space on.
| 
 | private | 
A semaphore that is locked upon trying to allocate space on a page.
| 
 | private | 
The offset of the payload reserved for this client within the opened page.
| 
 | private | 
The size in bytes of the opened page.
 1.8.11
 1.8.11