OMNeT++ Simulation Library
5.6.1
|
#include <cstringpool.h>
Reference-counted storage for strings.
The purpose of this class is to allow saving memory on the storage of (largely) constant strings that occur in many instances during runtime: module names, gate names, property names, keys and values, etc.
Public Member Functions | |
cStringPool (const char *poolName=nullptr) | |
~cStringPool () | |
const char * | get (const char *s) |
const char * | peek (const char *s) const |
void | release (const char *s) |
void | dump () const |
cStringPool | ( | const char * | poolName = nullptr | ) |
Constructor.
~cStringPool | ( | ) |
Destructor
const char* get | ( | const char * | s | ) |
const char* peek | ( | const char * | s | ) | const |
Returns pointer to the pooled copy of the given string, or nullptr. Reference count is not incremented. Passing nullptr is OK.
void release | ( | const char * | s | ) |
The parameter must a pointer returned by get(). It decrements the reference count and frees the pooled string if it reaches zero. Passing nullptr is OK.
void dump | ( | ) | const |
For debug purposes.