![]() |
Public API Reference |
![]() |
The string set is a collection of unique strings. More...
#include <csutil/scfstrset.h>
Public Member Functions | |
virtual void | Clear () |
Remove all stored strings. | |
virtual bool | Contains (char const *s) const |
Check if the set contains a particular string. | |
virtual bool | Contains (StringIDType id) const |
Check if the set contains a string with a particular ID. | |
virtual bool | Delete (char const *s) |
Remove specified string. | |
virtual bool | Delete (StringIDType id) |
Remove a string with the specified ID. | |
virtual void | Empty () |
Remove all stored strings. | |
Utility::StringSet< typename IF::TagType, true > ::GlobalIterator | GetIterator () const |
Return an iterator for the set which iterates over all strings. | |
virtual size_t | GetSize () const |
Get the number of elements in the hash. | |
virtual bool | IsEmpty () const |
Return true if the hash is empty. | |
virtual StringIDType | Request (const char *s) |
Request the numeric ID for the given string. | |
virtual const char * | Request (StringIDType id) const |
Request the string corresponding to the given ID. | |
ScfStringSet (size_t size=23) | |
Constructor. | |
virtual | ~ScfStringSet () |
Destructor. |
The string set is a collection of unique strings.
Each string has an ID number. The most important operation is to request a string, which means to return the ID for the string, adding it to the collection if not already present. This is useful when you need to work with strings but want the performance characteristics of simple numeric comparisons. Rather than performing string comparisons, you instead compare the numeric string ID's.
Instances of the set are locked are for concurrent accesses.
Definition at line 48 of file scfstrset.h.
CS::ScfStringSet< IF >::ScfStringSet | ( | size_t | size = 23 | ) | [inline] |
Constructor.
Definition at line 57 of file scfstrset.h.
virtual CS::ScfStringSet< IF >::~ScfStringSet | ( | ) | [inline, virtual] |
Destructor.
Definition at line 62 of file scfstrset.h.
virtual void CS::ScfStringSet< IF >::Clear | ( | ) | [inline, virtual] |
Remove all stored strings.
Definition at line 120 of file scfstrset.h.
virtual bool CS::ScfStringSet< IF >::Contains | ( | char const * | s | ) | const [inline, virtual] |
Check if the set contains a particular string.
Definition at line 85 of file scfstrset.h.
virtual bool CS::ScfStringSet< IF >::Contains | ( | StringIDType | id | ) | const [inline, virtual] |
Check if the set contains a string with a particular ID.
return Request(id) != NULL
, but more idomatic. Definition at line 93 of file scfstrset.h.
virtual bool CS::ScfStringSet< IF >::Delete | ( | char const * | s | ) | [inline, virtual] |
Remove specified string.
Definition at line 100 of file scfstrset.h.
virtual bool CS::ScfStringSet< IF >::Delete | ( | StringIDType | id | ) | [inline, virtual] |
Remove a string with the specified ID.
Definition at line 107 of file scfstrset.h.
virtual void CS::ScfStringSet< IF >::Empty | ( | ) | [inline, virtual] |
Remove all stored strings.
When new strings are registered again, new ID values will be used; the old ID's will not be re-used.
Definition at line 114 of file scfstrset.h.
Utility::StringSet<typename IF::TagType, true>::GlobalIterator CS::ScfStringSet< IF >::GetIterator | ( | ) | const [inline] |
Return an iterator for the set which iterates over all strings.
Definition at line 141 of file scfstrset.h.
virtual size_t CS::ScfStringSet< IF >::GetSize | ( | ) | const [inline, virtual] |
Get the number of elements in the hash.
Definition at line 124 of file scfstrset.h.
virtual bool CS::ScfStringSet< IF >::IsEmpty | ( | ) | const [inline, virtual] |
Return true if the hash is empty.
return GetSize() == 0
, but more idiomatic. Definition at line 132 of file scfstrset.h.
virtual StringIDType CS::ScfStringSet< IF >::Request | ( | const char * | s | ) | [inline, virtual] |
Request the numeric ID for the given string.
Definition at line 71 of file scfstrset.h.
virtual const char* CS::ScfStringSet< IF >::Request | ( | StringIDType | id | ) | const [inline, virtual] |
Request the string corresponding to the given ID.
Definition at line 79 of file scfstrset.h.