| MistServer
    2.5.3-Pro-19-gf5e75b1 ( Generic_64)
    | 
The server part of a server/client model for shared memory. More...
#include <shared_memory.h>
| Public Member Functions | |
| sharedServer () | |
| Default constructor, erases all the values.  More... | |
| sharedServer () | |
| sharedServer (std::string name, int len, bool withCounter=false) | |
| Desired constructor, initializes after cleaning.  More... | |
| sharedServer (std::string name, int len, bool withCounter=false) | |
| ~sharedServer () | |
| The deconstructor.  More... | |
| ~sharedServer () | |
| void | init (std::string name, int len, bool withCounter=false) | 
| void | init (std::string name, int len, bool withCounter=false) | 
| Initialize the server.  More... | |
| operator bool () const | |
| operator bool () const | |
| Determines whether a sharedServer is valid.  More... | |
| void | parseEach (void(*callback)(char *data, size_t len, unsigned int id)) | 
| void | parseEach (void(*callback)(char *data, size_t len, unsigned int id)) | 
| Parse each of the possible payload pieces, and runs a callback on it if in use.  More... | |
| Data Fields | |
| unsigned int | amount | 
| The amount of connected clients.  More... | |
| Private Member Functions | |
| void | deletePage () | 
| Deletes the highest allocated page.  More... | |
| void | deletePage () | 
| bool | isInUse (unsigned int id) | 
| bool | isInUse (unsigned int id) | 
| Determines whether an id is currently in use or not.  More... | |
| void | newPage () | 
| Creates the next page with the correct size.  More... | |
| void | newPage () | 
| 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... | |
| std::set< sharedPage > | myPages | 
| The set of sharedPage structures to manage the actual memory.  More... | |
| semaphore | mySemaphore | 
| A semaphore that is locked upon creation and deletion of the page, to ensure no new data is allocated during this step.  More... | |
| unsigned int | payLen | 
| The length of each consecutive piece of payload.  More... | |
The server 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::sharedServer::sharedServer | ( | ) | 
Default constructor, erases all the values.
| IPC::sharedServer::sharedServer | ( | std::string | name, | 
| int | len, | ||
| bool | withCounter = false | ||
| ) | 
Desired constructor, initializes after cleaning.
| name | The basename of this server | 
| len | The lenght of the payload | 
| withCounter | Whether the content should have a counter | 
| IPC::sharedServer::~sharedServer | ( | ) | 
The deconstructor.
| IPC::sharedServer::sharedServer | ( | ) | 
| IPC::sharedServer::sharedServer | ( | std::string | name, | 
| int | len, | ||
| bool | withCounter = false | ||
| ) | 
| IPC::sharedServer::~sharedServer | ( | ) | 
| 
 | private | 
Deletes the highest allocated page.
| 
 | private | 
| void IPC::sharedServer::init | ( | std::string | name, | 
| int | len, | ||
| bool | withCounter = false | ||
| ) | 
Initialize the server.
| name | The basename of this server | 
| len | The lenght of the payload | 
| withCounter | Whether the content should have a counter | 
| void IPC::sharedServer::init | ( | std::string | name, | 
| int | len, | ||
| bool | withCounter = false | ||
| ) | 
| 
 | private | 
Determines whether an id is currently in use or not.
| 
 | private | 
| 
 | private | 
| 
 | private | 
Creates the next page with the correct size.
| IPC::sharedServer::operator bool | ( | ) | const | 
| IPC::sharedServer::operator bool | ( | ) | const | 
Determines whether a sharedServer is valid.
| void IPC::sharedServer::parseEach | ( | void(*)(char *data, size_t len, unsigned int id) | callback | ) | 
| void IPC::sharedServer::parseEach | ( | void(*)(char *data, size_t len, unsigned int id) | callback | ) | 
Parse each of the possible payload pieces, and runs a callback on it if in use.
| unsigned int IPC::sharedServer::amount | 
The amount of connected clients.
| 
 | 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 set of sharedPage structures to manage the actual memory.
| 
 | private | 
A semaphore that is locked upon creation and deletion of the page, to ensure no new data is allocated during this step.
| 
 | private | 
The length of each consecutive piece of payload.
 1.8.11
 1.8.11