#include <schpack.hpp>
Inheritance diagram for SchExpressionPackage:
SchExpressionPackage is used to translate strings to symbols. Symbols generated by the package are stored inside the package. Note there can be symbols registered but not stored in the package, in which case we assume they stored somewhere else, e.g. defined as a named (non-dynamic) variable.
Definition at line 44 of file schpack.hpp.
Public Member Functions | |
SchExpressionPackage () | |
The default constructor. | |
SchExpressionPackage (SchPackage &a_parent) | |
This form creates a package derived from an existing one. | |
bool | Import (SReference &symb, char *symbname=0, bool safe=true) |
Register an existing symbol with the package. | |
SReference | Intern (char *name) |
Provide a symbol with the given name. | |
SReference | FindSymbol (char *name) |
Find a symbol. Return reference to it. | |
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 | |
~SchExpressionPackage () | |
virtual SString | TextRepresentation () |
bool | CanDie () |
Is it OK to delete the object now? | |
Friends | |
class | Iterator::Iterator |
|
The default constructor.
Definition at line 29 of file schpack.cpp. |
|
This form creates a package derived from an existing one.
Definition at line 33 of file schpack.cpp. |
|
Definition at line 37 of file schpack.cpp. |
|
Register an existing symbol with the package. Similar to CL's function IMPORT. Return false on a name conflict, true on success.
Definition at line 52 of file spkghsh.cpp. References SExpressionHashTable::AddItem(), SExpressionLabel::GetName(), INTELIB_ASSERT, and SExpressionHashTable::SafeAddItem(). Referenced by LExpressionPackageIntelib::LExpressionPackageIntelib(), and SchExpressionPackageIntelib::SchExpressionPackageIntelib(). |
|
Provide a symbol with the given name. If no symbol found, create it. Similar to CL's Intern. Definition at line 69 of file spkghsh.cpp. References SExpressionHashTable::AddItem(), SExpressionHashPackage::CreateNewSymbolObject(), SExpressionHashPackage::FindSymbol(), and SReference::GetPtr(). |
|
Find a symbol. Return reference to it. If nothing found, return NO-VALUE (unbound reference). Definition at line 80 of file spkghsh.cpp. References SExpressionHashTable::FindItem(), GenericSReference< Tp, X_wrongtype >::GetPtr(), and SReference::GetPtr(). Referenced by SExpressionHashPackage::Intern(). |
|
Definition at line 108 of file spkghsh.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(), SExpressionHashTable::dim, SExpressionHashTable::itemcount, SExpressionHashTable::lastfoundpos, SExpressionHashTable::SExpressionHashTable(), and SExpressionHashTable::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 SExpressionHashTable::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 SExpressionHashTable::EmptySlotMark, SExpressionHashTable::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(), SExpressionHashTable::EmptySlotMark, SReference::GetPtr(), and LispHash(). Referenced by SExpressionHashTable::AddItem(), and SExpressionHashTable::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 SExpressionHashPackage. |
|
Empty slot mark. This object is returned as a search result when the given key is not found in the table Referenced by SExpressionHashTable::GetItemPosition(), and SExpressionHashTable::SafeAddItem(). |