#include <shashtbl.hpp>
Inheritance diagram for SExpressionHashTable:
The class implements hash tables similar to those from Common Lisp
Definition at line 56 of file shashtbl.hpp.
Public Member Functions | |
SExpressionHashTable (SEqualityPredicate eqp=0) | |
The constructor. | |
virtual class SString | TextRepresentation () const |
Text representation of the S-expression. | |
virtual SExpression * | Clone () const |
Clone a changeable object. | |
void | AddItem (SReference key, SReference val) |
Add a new item. | |
bool | SafeAddItem (SReference key, SReference val) |
Add a new item safely. | |
SReference | FindItem (SReference key, const SReference &defval=EmptySlotMark) const |
Find item. | |
SReference & | GetItemPosition (SReference key) |
Get the position where to store an item. | |
bool | RemoveItem (SReference key) |
Remove item. | |
long | Count () const |
Items count. | |
void | Clear () |
Clear the table. | |
const IntelibTypeId & | TermType () const |
Actual S-expression type. | |
bool | IsChangeable () const |
Can it be changed during the lifetime of the object? | |
virtual bool | SpecificEql (const SExpression *) const |
Are the two objects EQL (while not EQ). | |
Static Public Attributes | |
static IntelibTypeId | TypeId |
The type identifier. | |
static SLabel | EmptySlotMark |
Empty slot mark. | |
Protected Member Functions | |
SExpressionHashTable (const IntelibTypeId &id, SEqualityPredicate eqp=0) | |
~SExpressionHashTable () | |
bool | CanDie () |
Is it OK to delete the object now? | |
Friends | |
class | Iterator::Iterator |
Classes | |
class | Iterator |
Iterator to walk through the hash table. More... |
|
The constructor.
Definition at line 116 of file shashtbl.cpp. References SExprsAreEqual(). Referenced by Clone(). |
|
Definition at line 126 of file shashtbl.cpp. References SExprsAreEqual(). |
|
Definition at line 137 of file shashtbl.cpp. |
|
Text representation of the S-expression. Returns the text string which represents the given S-expression as for real Lisp (for example, (25 36 49)) Implements SExpression. Definition at line 240 of file shashtbl.cpp. References SReference::GetPtr(), SExprsAreEq(), SExprsAreEql(), and SExprsAreEqual(). |
|
Clone a changeable object. The method should return the pointer created with new
Reimplemented from SExpression. Definition at line 142 of file shashtbl.cpp. References SReference::Clone(), dim, itemcount, lastfoundpos, SExpressionHashTable(), and table. |
|
Add a new item. If there's already an item with the given key, it is replaced Definition at line 155 of file shashtbl.cpp. References GetItemPosition(). Referenced by SExpressionHashPackage::Import(), and SExpressionHashPackage::Intern(). |
|
Add a new item safely. If there was no such item, add one and returns true. If an item with the same key already exists, do nothing and return false. Definition at line 160 of file shashtbl.cpp. References EmptySlotMark, GetItemPosition(), and SReference::GetPtr(). Referenced by SExpressionHashPackage::Import(). |
|
Find item. Find an item with the given key. Return defval value if none found, or else return the found value (key is assumed to be the same) Definition at line 172 of file shashtbl.cpp. References SExpressionCons::Car(), SExpressionCons::Cdr(), SReference::GetPtr(), and LispHash(). Referenced by SExpressionHashPackage::FindSymbol(). |
|
Get the position where to store an item. Gets reference to the value position. If there's no such key, new entry is created. If the entry remains unbound, the table removes it at the next call to GetItemPosition()
Definition at line 188 of file shashtbl.cpp. References SExpressionCons::Car(), SExpressionCons::Cdr(), EmptySlotMark, SReference::GetPtr(), and LispHash(). Referenced by AddItem(), and SafeAddItem(). |
|
Remove item. Removes the item. Returns true if there was one, false othervise Definition at line 217 of file shashtbl.cpp. References SExpressionCons::Car(), SReference::GetPtr(), and LispHash(). |
|
Items count. Return total amount of items in the table Definition at line 129 of file shashtbl.hpp. |
|
Clear the table. Remove all existing items from the table Definition at line 232 of file shashtbl.cpp. |
|
Actual S-expression type.
Definition at line 195 of file sexpress.hpp. Referenced by SReference::DynamicCastGetPtr(), SchReference::IsEql(), LReference::IsEql(), SReference::SimpleCastGetPtr(), SchReference::TextRepresentation(), and LReference::TextRepresentation(). |
|
Can it be changed during the lifetime of the object?
Definition at line 198 of file sexpress.hpp. References IntelibTypeId::IsChangeable(). |
|
Are the two objects EQL (while not EQ). This function is overriden by those SExpressions able to be EQL while being not EQ.
Reimplemented in SExpressionInt, SExpressionFloat, SExpressionChar, and SExpressionString. Definition at line 235 of file sexpress.hpp. Referenced by SchReference::IsEql(), and LReference::IsEql(). |
|
Is it OK to delete the object now? Our children have no access to the private attribute RefCount and should never need it except when checking if the destruction is not an error. This solves the problem. Definition at line 53 of file refcount.hpp. |
|
Definition at line 153 of file shashtbl.hpp. |
|
The type identifier.
Reimplemented from SExpression. Reimplemented in SExpressionHashPackage, LExpressionPackage, and SchExpressionPackage. |
|
Empty slot mark. This object is returned as a search result when the given key is not found in the table Referenced by GetItemPosition(), and SafeAddItem(). |