Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

SchExpressionPackageIntelib Class Reference

#include <schpack.hpp>

Inheritance diagram for SchExpressionPackageIntelib:

Inheritance graph
[legend]
Collaboration diagram for SchExpressionPackageIntelib:

Collaboration graph
[legend]
List of all members.

Detailed Description

A package to map the symbol QUOTE.

SchExpressionPackageIntelib class is intended to map the symbols provided by the library (presently it's only the symbol QUOTE).

Definition at line 67 of file schpack.hpp.

Public Member Functions

 SchExpressionPackageIntelib ()
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 SExpressionClone () 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.
SReferenceGetItemPosition (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 IntelibTypeIdTermType () 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

 ~SchExpressionPackageIntelib ()
virtual SString TextRepresentation ()
bool CanDie ()
 Is it OK to delete the object now?

Friends

class Iterator::Iterator


Constructor & Destructor Documentation

SchExpressionPackageIntelib::SchExpressionPackageIntelib  ) 
 

Definition at line 48 of file schpack.cpp.

References SExpressionHashPackage::Import(), SchLibraryProvidedSymbols::Quote, and TheSchLibraryProvidedSymbols.

SchExpressionPackageIntelib::~SchExpressionPackageIntelib  )  [protected]
 

Definition at line 71 of file schpack.hpp.


Member Function Documentation

bool SExpressionHashPackage::Import SReference symb,
char *  symbname = 0,
bool  safe = true
[inherited]
 

Register an existing symbol with the package.

Similar to CL's function IMPORT. Return false on a name conflict, true on success.

Parameters:
symb is the symbol to register
symbname If given, the parameter determines the name by which the symbol will be known in this package. Default is to get symbname from the symbol.
safe If true (the default), the function avoids name conflicts. If false, the symbol is imported even if another symbol is already known by that name; in this case, the function always returns true.

Definition at line 52 of file spkghsh.cpp.

References SExpressionHashTable::AddItem(), SExpressionLabel::GetName(), INTELIB_ASSERT, and SExpressionHashTable::SafeAddItem().

Referenced by LExpressionPackageIntelib::LExpressionPackageIntelib(), and SchExpressionPackageIntelib().

SReference SExpressionHashPackage::Intern char *  name  )  [inherited]
 

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

SReference SExpressionHashPackage::FindSymbol char *  name  )  [inherited]
 

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

SString SExpressionHashPackage::TextRepresentation  )  [protected, virtual, inherited]
 

Definition at line 108 of file spkghsh.cpp.

SString SExpressionHashTable::TextRepresentation  )  const [virtual, inherited]
 

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

SExpression * SExpressionHashTable::Clone  )  const [virtual, inherited]
 

Clone a changeable object.

The method should return the pointer created with new

Note:
It can (and should) return null pointer for non-changeables
Warning:
This method will hang your program being called for a looped data structure, including looped lists, a hash table which references a list in which it is a member, etc.

If you create a changeable S-expression, you MUST make sure this method duplicates your object in such a way that nothing is shared between the old and new objects, that is, changing the new object can not in any way change the old object.

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.

void SExpressionHashTable::AddItem SReference  key,
SReference  val
[inherited]
 

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

bool SExpressionHashTable::SafeAddItem SReference  key,
SReference  val
[inherited]
 

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

SReference SExpressionHashTable::FindItem SReference  key,
const SReference defval = EmptySlotMark
const [inherited]
 

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

SReference & SExpressionHashTable::GetItemPosition SReference  key  )  [inherited]
 

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

Warning:
You must use the value returned by this method BEFORE another call to this method. The subsequent call may cause rehashing so that your reference become invalid.

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

bool SExpressionHashTable::RemoveItem SReference  key  )  [inherited]
 

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

long SExpressionHashTable::Count  )  const [inherited]
 

Items count.

Return total amount of items in the table

Definition at line 129 of file shashtbl.hpp.

void SExpressionHashTable::Clear  )  [inherited]
 

Clear the table.

Remove all existing items from the table

Definition at line 232 of file shashtbl.cpp.

const IntelibTypeId& SExpression::TermType  )  const [inherited]
 

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

bool SExpression::IsChangeable  )  const [inherited]
 

Can it be changed during the lifetime of the object?

Definition at line 198 of file sexpress.hpp.

References IntelibTypeId::IsChangeable().

virtual bool SExpression::SpecificEql const SExpression  )  const [virtual, inherited]
 

Are the two objects EQL (while not EQ).

This function is overriden by those SExpressions able to be EQL while being not EQ.

Warning:
It is not demanded that this function return true if it's arguments are the same SExpression (that is, they're EQ). It is only called by the EQL predicate implementation when it has been checked that the operands are not the same object.

Reimplemented in SExpressionInt, SExpressionFloat, SExpressionChar, and SExpressionString.

Definition at line 235 of file sexpress.hpp.

Referenced by SchReference::IsEql(), and LReference::IsEql().

bool GarbageSafe::CanDie  )  [protected, inherited]
 

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.


Friends And Related Function Documentation

friend class Iterator::Iterator [friend, inherited]
 

Definition at line 153 of file shashtbl.hpp.


Member Data Documentation

IntelibTypeId SchExpressionPackage::TypeId [static, inherited]
 

The type identifier.

Reimplemented from SExpressionHashPackage.

SLabel SExpressionHashTable::EmptySlotMark [static, inherited]
 

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


The documentation for this class was generated from the following files:
Generated on Tue Dec 18 00:40:47 2007 for InteLib by  doxygen 1.4.1