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

SExpressionVector Class Reference

#include <svector.hpp>

Inheritance diagram for SExpressionVector:

Inheritance graph
[legend]
Collaboration diagram for SExpressionVector:

Collaboration graph
[legend]
List of all members.

Detailed Description

Vector of SExpressions.

Implements an optionally-resizeable vector of S-expressions.

Note:
The vector is also an S-expression so it can be a member of a Lisp-like list and/or a member of another vector, etc.
Warning:
Do not use the objects of SExpressionVector directly. There are SVectorRef and SVector classes which are designed to be the interface to the S-expression vector facility.

Definition at line 37 of file svector.hpp.

Public Member Functions

 SExpressionVector (int n=0)
 Constructor.
const SReferenceoperator[] (unsigned int n) const
 constant version of the indexing operator
SReferenceoperator[] (unsigned int n)
 non-constant version of the indexing operator
int Size () const
 Get the current slots count.
void SetSize (unsigned int n)
 Force resizing the vector.
bool IsResizeable () const
 Is it allowed to resize the vector?
virtual SExpressionClone () const
 Clone a changeable object.
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 bool SpecificEql (const SExpression *) const
 Are the two objects EQL (while not EQ).

Static Public Attributes

static IntelibTypeId TypeId
 The type identifier.

Protected Member Functions

 SExpressionVector (const IntelibTypeId &tid, int n=0)
 Constructor form for derived classes.
 ~SExpressionVector ()
 Destructor.
bool CanDie ()
 Is it OK to delete the object now?


Constructor & Destructor Documentation

SExpressionVector::SExpressionVector int  n = 0  ) 
 

Constructor.

Parameters:
n is the vector's length. 0 (the default) means the vector will be dynamically resized. If a positive size is given, it means the size is strict and resizing is prohibited. If n<0 is given, then the vector will be dynamically resized, and -n is a hint for the constructor how much slots to allocate during initialization.

Definition at line 28 of file svector.cpp.

Referenced by Clone().

SExpressionVector::SExpressionVector const IntelibTypeId tid,
int  n = 0
[protected]
 

Constructor form for derived classes.

Definition at line 44 of file svector.cpp.

SExpressionVector::~SExpressionVector  )  [protected]
 

Destructor.

Definition at line 60 of file svector.hpp.


Member Function Documentation

const SReference & SExpressionVector::operator[] unsigned int  n  )  const
 

constant version of the indexing operator

Definition at line 59 of file svector.cpp.

References INTELIB_ASSERT.

SReference & SExpressionVector::operator[] unsigned int  n  ) 
 

non-constant version of the indexing operator

Definition at line 65 of file svector.cpp.

References INTELIB_ASSERT.

int SExpressionVector::Size  )  const
 

Get the current slots count.

Definition at line 69 of file svector.hpp.

Referenced by TextRepresentation().

void SExpressionVector::SetSize unsigned int  n  ) 
 

Force resizing the vector.

Definition at line 100 of file svector.cpp.

bool SExpressionVector::IsResizeable  )  const
 

Is it allowed to resize the vector?

Definition at line 73 of file svector.hpp.

SExpression * SExpressionVector::Clone  )  const [virtual]
 

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 75 of file svector.cpp.

References SReference::Clone(), Resize(), SExpressionVector(), and vector.

SString SExpressionVector::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 85 of file svector.cpp.

References GenericSReference< Tp, X_wrongtype >::GetPtr(), Size(), and SExpression::TextRepresentation().

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.


Member Data Documentation

IntelibTypeId SExpressionVector::TypeId [static]
 

The type identifier.

Reimplemented from SExpression.


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