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

SExpressionDoubleList Class Reference

#include <sdbllist.hpp>

Inheritance diagram for SExpressionDoubleList:

Inheritance graph
[legend]
Collaboration diagram for SExpressionDoubleList:

Collaboration graph
[legend]
List of all members.

Detailed Description

S-expression containig a doubly-linked list.

The list is built off objects of the SExpressionBacklink class. This property of the implementation is visible and can even be useful in some cases.

Definition at line 42 of file sdbllist.hpp.

Public Member Functions

 SExpressionDoubleList ()
 The default constructor creates an empty list.
 SExpressionDoubleList (const SBacklinkRef &a_begin, const SBacklinkRef &a_end)
 Construct the object from an existing chain of items.
const SBacklinkRefAddToBegin (const SReference &ref)
 Add an item to the head of the list.
const SBacklinkRefAddToEnd (const SReference &ref)
 Add an item to the tail of the list.
SBacklinkRef GetBegin () const
 Get the first element's location.
SBacklinkRef GetEnd () const
 Get the last element's location.
void Exclude (const SBacklinkRef &from, const SBacklinkRef &thru)
 Exclude a sublist from the list.
void InsertListAfter (const SBacklinkRef &from, const SBacklinkRef &left, const SBacklinkRef &right)
 Insert a linked chain of elements into the list.
virtual SString TextRepresentation () const
 Text representation of the S-expression.
const IntelibTypeIdTermType () const
 Actual S-expression type.
bool IsChangeable () const
 Can it be changed during the lifetime of the object?
virtual SExpressionClone () const
 Clone a changeable object.
virtual bool SpecificEql (const SExpression *) const
 Are the two objects EQL (while not EQ).

Public Attributes

class Iterator

Static Public Attributes

static IntelibTypeId TypeId
 The type identifier.

Protected Member Functions

 SExpressionDoubleList (const IntelibTypeId &t)
 Constructor for derived types.
 SExpressionDoubleList (const SBacklinkRef &a_begin, const SBacklinkRef &a_end, const IntelibTypeId &t)
 ~SExpressionDoubleList ()
 The destructor.
bool CanDie ()
 Is it OK to delete the object now?

Classes

class  Iterator
 Iterator for a doubly-linked list. More...


Constructor & Destructor Documentation

SExpressionDoubleList::SExpressionDoubleList const IntelibTypeId t  )  [protected]
 

Constructor for derived types.

Definition at line 46 of file sdbllist.hpp.

SExpressionDoubleList::SExpressionDoubleList const SBacklinkRef a_begin,
const SBacklinkRef a_end,
const IntelibTypeId t
[protected]
 

Definition at line 47 of file sdbllist.hpp.

SExpressionDoubleList::~SExpressionDoubleList  )  [protected]
 

The destructor.

Definition at line 52 of file sdbllist.hpp.

SExpressionDoubleList::SExpressionDoubleList  ) 
 

The default constructor creates an empty list.

Definition at line 58 of file sdbllist.hpp.

References TypeId.

SExpressionDoubleList::SExpressionDoubleList const SBacklinkRef a_begin,
const SBacklinkRef a_end
 

Construct the object from an existing chain of items.

Warning:
The structure will be shared, so you'd better not use the list you pass. It's the caller's duty to make sure a_begin and a_end are the ends of the same list and there are no elements before and after them. No checks are performed. Chaos guaranteed if you don't comply.

Definition at line 67 of file sdbllist.hpp.

References TypeId.


Member Function Documentation

const SBacklinkRef & SExpressionDoubleList::AddToBegin const SReference ref  ) 
 

Add an item to the head of the list.

Definition at line 27 of file sdbllist.cpp.

References SBacklinkRef::GetPtr(), and PTheEmptyList.

const SBacklinkRef & SExpressionDoubleList::AddToEnd const SReference ref  ) 
 

Add an item to the tail of the list.

Definition at line 40 of file sdbllist.cpp.

References SBacklinkRef::GetPtr(), and SBacklinkRef::InsertAfter().

SBacklinkRef SExpressionDoubleList::GetBegin  )  const
 

Get the first element's location.

Definition at line 77 of file sdbllist.hpp.

SBacklinkRef SExpressionDoubleList::GetEnd  )  const
 

Get the last element's location.

Definition at line 79 of file sdbllist.hpp.

void SExpressionDoubleList::Exclude const SBacklinkRef from,
const SBacklinkRef thru
 

Exclude a sublist from the list.

Parameters from and thru must point to somewhere inside the list, and the from must precede the thru, or else the result is undefined.

The excluded part remains to be a linked chain, but
the first element doesn't have a backlink, and the last one doesn't have a Cdr link. The remaining part is updates as to remain consistent.
Parameters:
from points to the first element to be excluded
thru points to the last element to be excluded

Definition at line 51 of file sdbllist.cpp.

References SReference::IsEmptyList().

void SExpressionDoubleList::InsertListAfter const SBacklinkRef from,
const SBacklinkRef left,
const SBacklinkRef right
 

Insert a linked chain of elements into the list.

Parameters left and right must point to ends of a linked chani (e.g., a chain excluded from somewhere with the Exclude() method). The chain is inserted into the list after the element pointed by the from parameter. If from is unbound, the chain is inserted into the head of the list.

Parameters:
from determines the position where to insert the chain
left points to the left end of the chain to be inserted
right points to the right end of the chain to be inserted

Definition at line 70 of file sdbllist.cpp.

References SReference::IsEmptyList().

SString SExpressionDoubleList::TextRepresentation  )  const [virtual]
 

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 96 of file sdbllist.cpp.

References SBacklinkRef::GetPtr().

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 SExpression* SExpression::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 in SExpressionBacklink, SExpressionCons, SExpressionHashTable, SExpressionRawBuffer, and SExpressionVector.

Definition at line 214 of file sexpress.hpp.

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.


Member Data Documentation

IntelibTypeId SExpressionDoubleList::TypeId [static]
 

The type identifier.

Reimplemented from SExpression.

Referenced by SExpressionDoubleList().

class friend class SExpressionDoubleList::Iterator
 

Definition at line 111 of file sdbllist.hpp.


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