FreeNOS
Public Member Functions
Sequence< T > Class Template Referenceabstract

Sequences are containers that provide indexed based storage of items. More...

#include <Sequence.h>

Inheritance diagram for Sequence< T >:
Container Comparable< Sequence< T > > Array< T, N > List< T > Vector< T >

Public Member Functions

virtual int insert (const T &item)
 Adds the given item to the Sequence, if possible. More...
 
virtual bool insert (Size position, const T &item)
 Inserts the given item at the given position. More...
 
virtual void fill (T value)
 Fill the Sequence with the given value. More...
 
virtual int remove (T value)
 Remove all items with the given value. More...
 
virtual bool removeAt (Size position)
 Removes the item at the given position. More...
 
virtual void clear ()
 Removes all items from the Sequence. More...
 
virtual const T * get (Size position) const =0
 Returns the item at the given position. More...
 
virtual const T & at (Size position) const =0
 Returns a reference to the item at the given position. More...
 
virtual bool contains (const T value) const
 Check if the given item is stored in this Sequence. More...
 
virtual int compareTo (const Sequence< T > &s) const
 Compare this Sequence to another Sequence. More...
 
virtual bool equals (const Sequence< T > &s) const
 Test if this Sequence is equal to an other Sequence. More...
 
const T & operator[] (int i) const
 Returns the item at the given position in the Sequence. More...
 
const T & operator[] (Size i) const
 Returns the item at the given position in the Sequence. More...
 
T & operator[] (int i)
 Returns the item at the given position in the Sequence. More...
 
T & operator[] (Size i)
 Returns the item at the given position in the Sequence. More...
 
- Public Member Functions inherited from Container
 Container ()
 Constructor. More...
 
virtual ~Container ()
 Destructor. More...
 
virtual Size size () const =0
 Returns the maximum size of this Container. More...
 
virtual Size count () const =0
 Returns the number of items inside the Container. More...
 
virtual bool isEmpty () const
 Check if the Container is empty. More...
 
virtual bool reserve (Size size)
 Ensure that at least the given size is available. More...
 
virtual bool shrink (Size size)
 Shrink the container size by the given amount of items. More...
 
virtual Size squeeze ()
 Try to minimize the memory required in the Container. More...
 
virtual bool resize (Size size)
 Change the size of the Container. More...
 
- Public Member Functions inherited from Comparable< Sequence< T > >
virtual ~Comparable ()
 Class destructor. More...
 

Detailed Description

template<class T>
class Sequence< T >

Sequences are containers that provide indexed based storage of items.

Definition at line 37 of file Sequence.h.

Member Function Documentation

◆ at()

template<class T >
virtual const T& Sequence< T >::at ( Size  position) const
pure virtual

◆ clear()

template<class T >
virtual void Sequence< T >::clear ( )
inlinevirtual

◆ compareTo()

template<class T >
virtual int Sequence< T >::compareTo ( const Sequence< T > &  s) const
inlinevirtual

Compare this Sequence to another Sequence.

Implements Comparable< Sequence< T > >.

Definition at line 153 of file Sequence.h.

Referenced by Sequence< ATADrive * >::equals().

◆ contains()

template<class T >
virtual bool Sequence< T >::contains ( const T  value) const
inlinevirtual

◆ equals()

template<class T >
virtual bool Sequence< T >::equals ( const Sequence< T > &  s) const
inlinevirtual

Test if this Sequence is equal to an other Sequence.

Parameters
sSequence instance.
Returns
True if equal, false otherwise.

Implements Comparable< Sequence< T > >.

Definition at line 184 of file Sequence.h.

◆ fill()

template<class T >
virtual void Sequence< T >::fill ( value)
inlinevirtual

Fill the Sequence with the given value.

Parameters
valueNew value to fill the Sequence.

Definition at line 73 of file Sequence.h.

Referenced by API::API(), Kernel::Kernel(), LinnFileSystem::LinnFileSystem(), MpiProxy::MpiProxy(), and ProcessManager::ProcessManager().

◆ get()

template<class T >
virtual const T* Sequence< T >::get ( Size  position) const
pure virtual

◆ insert() [1/2]

template<class T >
virtual int Sequence< T >::insert ( const T &  item)
inlinevirtual

Adds the given item to the Sequence, if possible.

Parameters
itemThe item to add to the Sequence.
Returns
Position of the item in the Sequence or -1 on failure.

Reimplemented in Vector< T >, Vector< Size >, Vector< List< Process * > * >, Vector< List< InterruptHook * > * >, Vector< List< HashTable::Bucket > >, Vector< LinnGroup * >, Vector< Handler * >, and Vector< Argument * >.

Definition at line 48 of file Sequence.h.

Referenced by Sequence< ATADrive * >::fill().

◆ insert() [2/2]

template<class T >
virtual bool Sequence< T >::insert ( Size  position,
const T &  item 
)
inlinevirtual

Inserts the given item at the given position.

If an item exists at the given position, it will be replaced by the given item.

Parameters
positionThe position to insert the item.
itemThe item to insert
Returns
bool Whether inserting the item at the given position succeeded.

Reimplemented in Vector< T >, Array< T, N >, Vector< Size >, Array< ProcessID, MaximumChannels >, Vector< List< Process * > * >, Vector< List< InterruptHook * > * >, Vector< List< HashTable::Bucket > >, Vector< LinnGroup * >, Vector< Handler * >, and Vector< Argument * >.

Definition at line 63 of file Sequence.h.

◆ operator[]() [1/4]

template<class T >
T& Sequence< T >::operator[] ( int  i)
inline

Returns the item at the given position in the Sequence.

Parameters
iThe index of the item to return.
Returns
the Item at position i.

Definition at line 220 of file Sequence.h.

◆ operator[]() [2/4]

template<class T >
const T& Sequence< T >::operator[] ( int  i) const
inline

Returns the item at the given position in the Sequence.

Parameters
iThe index of the item to return.
Returns
the Item at position i.

Definition at line 196 of file Sequence.h.

◆ operator[]() [3/4]

template<class T >
T& Sequence< T >::operator[] ( Size  i)
inline

Returns the item at the given position in the Sequence.

Parameters
iThe index of the item to return.
Returns
the Item at position i.

Definition at line 232 of file Sequence.h.

◆ operator[]() [4/4]

template<class T >
const T& Sequence< T >::operator[] ( Size  i) const
inline

Returns the item at the given position in the Sequence.

Parameters
iThe index of the item to return.
Returns
the Item at position i.

Definition at line 208 of file Sequence.h.

◆ remove()

template<class T >
virtual int Sequence< T >::remove ( value)
inlinevirtual

◆ removeAt()

template<class T >
virtual bool Sequence< T >::removeAt ( Size  position)
inlinevirtual

Removes the item at the given position.

Parameters
positionThe position of the item to remove.
Returns
bool Whether removing the item succeeded.

Reimplemented in Vector< T >, Vector< Handler * >, Vector< Size >, Vector< List< InterruptHook * > * >, Vector< LinnGroup * >, Vector< List< HashTable::Bucket > >, Vector< List< Process * > * >, and Vector< Argument * >.

Definition at line 100 of file Sequence.h.

Referenced by Sequence< ATADrive * >::clear().


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