CPUnit 0.7 (beta)
The REAL C++ port of JUnit.
|
Flyweight pattern implementation for std::string objects. More...
#include <unittest_StringFlyweightStore.hpp>
Classes | |
struct | str_ptr_cmp |
Public Member Functions | |
const std::string * | intern (const std::string s) |
void | add_user () |
void | remove_user () |
Static Public Member Functions | |
static void | dispose () |
Disposes of the StringFluweightStore instance. | |
static StringFlyweightStore & | get_instance () |
Private Types | |
typedef std::set< std::string *, str_ptr_cmp > | str_ptr_set |
Private Member Functions | |
StringFlyweightStore () | |
~StringFlyweightStore () | |
Private Attributes | |
str_ptr_set | store |
int | users |
bool | disposed |
Static Private Attributes | |
static StringFlyweightStore * | INSTANCE |
Flyweight pattern implementation for std::string objects.
Used to reduce the RAM footprint, which can be large due to heavy use of strings in the test framework. The store is implemented as a singleton.
Definition at line 45 of file unittest_StringFlyweightStore.hpp.
typedef std::set<std::string*, str_ptr_cmp> unittest::StringFlyweightStore::str_ptr_set [private] |
Definition at line 51 of file unittest_StringFlyweightStore.hpp.
unittest::StringFlyweightStore::StringFlyweightStore | ( | ) | [private] |
Definition at line 37 of file unittest_StringFlyweightStore.cpp.
unittest::StringFlyweightStore::~StringFlyweightStore | ( | ) | [private] |
Definition at line 44 of file unittest_StringFlyweightStore.cpp.
void unittest::StringFlyweightStore::add_user | ( | ) |
Definition at line 98 of file unittest_StringFlyweightStore.cpp.
void unittest::StringFlyweightStore::dispose | ( | ) | [static] |
Disposes of the StringFluweightStore instance.
If there are no more registered users, the instance is removed, and all contained strings are deleted. If there are existing users,
Definition at line 64 of file unittest_StringFlyweightStore.cpp.
unittest::StringFlyweightStore & unittest::StringFlyweightStore::get_instance | ( | ) | [static] |
Definition at line 77 of file unittest_StringFlyweightStore.cpp.
const std::string * unittest::StringFlyweightStore::intern | ( | const std::string | s | ) |
Definition at line 85 of file unittest_StringFlyweightStore.cpp.
void unittest::StringFlyweightStore::remove_user | ( | ) |
Definition at line 103 of file unittest_StringFlyweightStore.cpp.
bool unittest::StringFlyweightStore::disposed [private] |
Definition at line 60 of file unittest_StringFlyweightStore.hpp.
unittest::StringFlyweightStore * unittest::StringFlyweightStore::INSTANCE [static, private] |
Definition at line 56 of file unittest_StringFlyweightStore.hpp.
Definition at line 58 of file unittest_StringFlyweightStore.hpp.
int unittest::StringFlyweightStore::users [private] |
Definition at line 59 of file unittest_StringFlyweightStore.hpp.