# FoundationClasses
TKernel
NCollection

# FoundationClasses
TKernel
NCollection

# NCollection_SList< TheItemType > Class Template Reference

`#include <NCollection_SList.hxx>`

Inheritance diagram for NCollection_SList< TheItemType >:

[legend]

## Public Member Functions

| NCollection_SList (const Handle(NCollection_BaseAllocator)&theAllocator=0L)
| Empty constructor.
| NCollection_SList (const TheItemType &theItem, const NCollection_SList &theTail)
| Constructor.
| NCollection_SList (const NCollection_SList &theOther)
| Copy constructor.
void * | operator new (size_t theSize, const Handle(NCollection_BaseAllocator)&theAllocator)
| Operator new for creating 'iterator'.
void | Clear (void)
| Clear the items out.
NCollection_SList & | operator= (const NCollection_SList &theOther)
| Make this list identical to theOther.
virtual void | Assign (const NCollection_BaseCollection< TheItemType > &theOther)
| Replace this list by the items of theOther collection.
Standard_Boolean | IsEmpty (void) const
| IsEmpty query.
virtual const TheItemType & | Value (void) const
| Value - constant access.
virtual TheItemType & | ChangeValue (void) const
| ChangeValue - variable access.
void | SetValue (const TheItemType &theItem)
| SetValue.
const NCollection_SList & | Tail (void) const
| Tail.
NCollection_SList & | ChangeTail (void)
| ChangeTail.
void | SetTail (NCollection_SList &theList)
| SetTail.
void | Construct (const TheItemType &theItem)
| Construct.
NCollection_SList | Constructed (const TheItemType &theItem) const
| Constructed.
void | ToTail (void)
| ToTail.
void | Initialize (const NCollection_SList &theOther)
| Initialize (~Assign).
void | Init (const NCollection_SList &theOther)
| Init (virtual method of base iterator).
virtual Standard_Boolean | More (void) const
| More (~!IsEmpty).
virtual void | Next (void)
| Next (~ToTail).
virtual Standard_Integer | Size (void) const
| Size - Number of items.
| ~NCollection_SList (void)
| Destructor - clears the SList.

## Private Member Functions

virtual TYPENAME NCollection_BaseCollection< TheItemType >::Iterator & | CreateIterator (void) const
| Creates Iterator for use on BaseCollection.

## Private Attributes

SListNode * | myNode

## Data Structures

class | SListNode
| The node of SList. More...

## Detailed Description

### template<class TheItemType>
class NCollection_SList< TheItemType >

Purpose: An SList is a LISP like list of Items. An SList is : . Empty. . Or it has a Value and a Tail which is an other SList.

The Tail of an empty list is an empty list. SList are shared. It means that they can be modified through other lists. SList may be used as Iterators. They have Next, More, and value methods. To iterate on the content of the list S just do.

SList Iterator; for (Iterator = S; Iterator.More(); Iterator.Next()) X = Iterator.Value();

Memory usage is automatically managed for SLists (using reference counts).

Example: If S1 and S2 are SLists : if S1.Value() is X.

And the following is done : S2 = S1; S2.SetValue(Y);

S1.Value() becomes also Y. So SList must be used with care. Mainly the SetValue() method is dangerous.

## Constructor & Destructor Documentation

template<class TheItemType>
NCollection_SList< TheItemType >::NCollection_SList | ( | const Handle(NCollection_BaseAllocator)& | theAllocator = `0L` | ) | `[inline]`

template<class TheItemType>
NCollection_SList< TheItemType >::NCollection_SList | ( | const TheItemType & | theItem,
|  | const NCollection_SList< TheItemType > & | theTail
| ) | `[inline]`

template<class TheItemType>
NCollection_SList< TheItemType >::NCollection_SList | ( | const NCollection_SList< TheItemType > & | theOther | ) | `[inline]`

template<class TheItemType>
NCollection_SList< TheItemType >::~NCollection_SList | ( | void |  | ) | `[inline]`

## Member Function Documentation

template<class TheItemType>
virtual void NCollection_SList< TheItemType >::Assign | ( | const NCollection_BaseCollection< TheItemType > & | theOther | ) | `[inline, virtual]`

template<class TheItemType>
NCollection_SList& NCollection_SList< TheItemType >::ChangeTail | ( | void |  | ) | `[inline]`

template<class TheItemType>
virtual TheItemType& NCollection_SList< TheItemType >::ChangeValue | ( | void |  | ) | const`[inline, virtual]`

| Implements NCollection_BaseCollection< TheItemType >::Iterator.

template<class TheItemType>
void NCollection_SList< TheItemType >::Clear | ( | void |  | ) | `[inline]`

template<class TheItemType>
void NCollection_SList< TheItemType >::Construct | ( | const TheItemType & | theItem | ) | `[inline]`

template<class TheItemType>
NCollection_SList NCollection_SList< TheItemType >::Constructed | ( | const TheItemType & | theItem | ) | const`[inline]`

template<class TheItemType>
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& NCollection_SList< TheItemType >::CreateIterator | ( | void |  | ) | const`[inline, private, virtual]`

| Implements NCollection_BaseCollection< TheItemType >.

template<class TheItemType>
void NCollection_SList< TheItemType >::Init | ( | const NCollection_SList< TheItemType > & | theOther | ) | `[inline]`

template<class TheItemType>
void NCollection_SList< TheItemType >::Initialize | ( | const NCollection_SList< TheItemType > & | theOther | ) | `[inline]`

template<class TheItemType>
Standard_Boolean NCollection_SList< TheItemType >::IsEmpty | ( | void |  | ) | const`[inline]`

template<class TheItemType>
virtual Standard_Boolean NCollection_SList< TheItemType >::More | ( | void |  | ) | const`[inline, virtual]`

| Implements NCollection_BaseCollection< TheItemType >::Iterator.

template<class TheItemType>
virtual void NCollection_SList< TheItemType >::Next | ( | void |  | ) | `[inline, virtual]`

| Implements NCollection_BaseCollection< TheItemType >::Iterator.

template<class TheItemType>
void* NCollection_SList< TheItemType >::operator new | ( | size_t | theSize,
|  | const Handle(NCollection_BaseAllocator)& | theAllocator
| ) | `[inline]`

template<class TheItemType>
NCollection_SList& NCollection_SList< TheItemType >::operator= | ( | const NCollection_SList< TheItemType > & | theOther | ) | `[inline]`

template<class TheItemType>
void NCollection_SList< TheItemType >::SetTail | ( | NCollection_SList< TheItemType > & | theList | ) | `[inline]`

template<class TheItemType>
void NCollection_SList< TheItemType >::SetValue | ( | const TheItemType & | theItem | ) | `[inline]`

template<class TheItemType>
virtual Standard_Integer NCollection_SList< TheItemType >::Size | ( | void |  | ) | const`[inline, virtual]`

| Implements NCollection_BaseCollection< TheItemType >.

template<class TheItemType>
const NCollection_SList& NCollection_SList< TheItemType >::Tail | ( | void |  | ) | const`[inline]`

template<class TheItemType>
void NCollection_SList< TheItemType >::ToTail | ( | void |  | ) | `[inline]`

template<class TheItemType>
virtual const TheItemType& NCollection_SList< TheItemType >::Value | ( | void |  | ) | const`[inline, virtual]`

| Implements NCollection_BaseCollection< TheItemType >::Iterator.

## Field Documentation

template<class TheItemType>
SListNode* NCollection_SList< TheItemType >::myNode `[private]`

The documentation for this class was generated from the following file:

- NCollection_SList.hxx