0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Types | Private Attributes | List of all members
Hypertable::FlyweightString Class Reference

The Flyweight string set stores duplicate strings efficiently. More...

#include <FlyweightString.h>

Collaboration diagram for Hypertable::FlyweightString:
Collaboration graph
[legend]

Public Member Functions

 FlyweightString ()
 
 ~FlyweightString ()
 The destructor deletes all internal pointers and clears the set; pointers retrieved with. More...
 
const char * get (const char *str)
 Returns a copy of the string; this string is valid till the FlyweightString set is destructed. More...
 
const char * get (const std::string &str)
 Returns a copy of the string; this string is valid till the FlyweightString set is destructed. More...
 
const char * get (const char *str, size_t len)
 Returns a copy of the string; this string is valid till the FlyweightString set is destructed. More...
 
void clear ()
 Clears and deallocates the set of strings. More...
 

Private Types

typedef PageArenaAllocator
< const char * > 
CstrSetAlloc
 
typedef std::set< const char
*, LtCstr, CstrSetAlloc
CstrSet
 

Private Attributes

CharArena m_arena
 The page arena. More...
 
CstrSet m_strings
 The std::set holding the strings. More...
 

Detailed Description

The Flyweight string set stores duplicate strings efficiently.

Definition at line 43 of file FlyweightString.h.

Member Typedef Documentation

typedef std::set<const char*, LtCstr, CstrSetAlloc> Hypertable::FlyweightString::CstrSet
private

Definition at line 113 of file FlyweightString.h.

Definition at line 112 of file FlyweightString.h.

Constructor & Destructor Documentation

Hypertable::FlyweightString::FlyweightString ( )
inline

Definition at line 46 of file FlyweightString.h.

Hypertable::FlyweightString::~FlyweightString ( )
inline

The destructor deletes all internal pointers and clears the set; pointers retrieved with.

See also
get() are invalidated.

Definition at line 53 of file FlyweightString.h.

Member Function Documentation

void Hypertable::FlyweightString::clear ( )
inline

Clears and deallocates the set of strings.

This function walks through m_strings, deallocating each string it finds, and then clears m_strings.

Definition at line 105 of file FlyweightString.h.

const char* Hypertable::FlyweightString::get ( const char *  str)
inline

Returns a copy of the string; this string is valid till the FlyweightString set is destructed.

Duplicate strings are not inserted twice.

Parameters
strThe string to insert
Returns
A copy of the inserted string

Definition at line 62 of file FlyweightString.h.

const char* Hypertable::FlyweightString::get ( const std::string &  str)
inline

Returns a copy of the string; this string is valid till the FlyweightString set is destructed.

Duplicate strings are not inserted twice.

Parameters
strThe string to insert
Returns
A copy of the inserted string

Definition at line 78 of file FlyweightString.h.

const char* Hypertable::FlyweightString::get ( const char *  str,
size_t  len 
)
inline

Returns a copy of the string; this string is valid till the FlyweightString set is destructed.

Duplicate strings are not inserted twice.

Parameters
strThe string to insert
lenThe length of the string
Returns
A copy of the inserted string

Definition at line 93 of file FlyweightString.h.

Member Data Documentation

CharArena Hypertable::FlyweightString::m_arena
private

The page arena.

Definition at line 116 of file FlyweightString.h.

CstrSet Hypertable::FlyweightString::m_strings
private

The std::set holding the strings.

Definition at line 119 of file FlyweightString.h.


The documentation for this class was generated from the following file: