CPUnit 0.95 (beta)
The REAL C++ port of JUnit.
cpunit::StringFlyweightStore Class Reference

Flyweight pattern implementation for std::string objects. More...

#include <cpunit_StringFlyweightStore.hpp>

List of all members.


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 StringFlyweightStoreget_instance ()

Private Types

typedef std::set< std::string
*, str_ptr_cmp

Private Member Functions

 StringFlyweightStore ()
 ~StringFlyweightStore ()

Private Attributes

str_ptr_set store
int users
bool disposed

Static Private Attributes

static StringFlyweightStoreINSTANCE

Detailed Description

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.

Member Typedef Documentation

typedef std::set<std::string*, str_ptr_cmp> cpunit::StringFlyweightStore::str_ptr_set [private]

Definition at line 51 of file cpunit_StringFlyweightStore.hpp.

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

Member Data Documentation

Definition at line 59 of file cpunit_StringFlyweightStore.hpp.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines