CPUnit 0.95 (beta)
The REAL C++ port of JUnit.
|
Flyweight pattern implementation for std::string objects. More...
#include <cpunit_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 cpunit_StringFlyweightStore.hpp.
typedef std::set<std::string*, str_ptr_cmp> cpunit::StringFlyweightStore::str_ptr_set [private] |
Definition at line 51 of file cpunit_StringFlyweightStore.hpp.
cpunit::StringFlyweightStore::StringFlyweightStore | ( | ) | [private] |
Definition at line 37 of file cpunit_StringFlyweightStore.cpp.
cpunit::StringFlyweightStore::~StringFlyweightStore | ( | ) | [private] |
Definition at line 44 of file cpunit_StringFlyweightStore.cpp.
void cpunit::StringFlyweightStore::add_user | ( | ) |
Definition at line 98 of file cpunit_StringFlyweightStore.cpp.
void cpunit::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 cpunit_StringFlyweightStore.cpp.
cpunit::StringFlyweightStore & cpunit::StringFlyweightStore::get_instance | ( | ) | [static] |
Definition at line 77 of file cpunit_StringFlyweightStore.cpp.
const std::string * cpunit::StringFlyweightStore::intern | ( | const std::string & | s | ) |
Definition at line 85 of file cpunit_StringFlyweightStore.cpp.
void cpunit::StringFlyweightStore::remove_user | ( | ) |
Definition at line 103 of file cpunit_StringFlyweightStore.cpp.
bool cpunit::StringFlyweightStore::disposed [private] |
Definition at line 60 of file cpunit_StringFlyweightStore.hpp.
cpunit::StringFlyweightStore * cpunit::StringFlyweightStore::INSTANCE [static, private] |
Definition at line 56 of file cpunit_StringFlyweightStore.hpp.
Definition at line 58 of file cpunit_StringFlyweightStore.hpp.
int cpunit::StringFlyweightStore::users [private] |
Definition at line 59 of file cpunit_StringFlyweightStore.hpp.