FreeNOS
Public Member Functions | Private Attributes
Index< T, N > Class Template Reference

Index is a N-sized array of pointers to items of type T. More...

#include <Index.h>

Public Member Functions

 Index ()
 Constructor. More...
 
virtual bool insert (Size &position, T *item)
 Adds the given item, if possible. More...
 
virtual bool insert (T *item)
 Adds the given item, if possible. More...
 
virtual bool insertAt (const Size position, T *item)
 Inserts the given item at the given position. More...
 
virtual bool remove (const Size position)
 Removes the item at the given position. More...
 
void deleteAll ()
 Removes and delete()'s all items. More...
 
virtual T * get (const Size position) const
 Returns the item at the given position. More...
 
virtual bool contains (const T *item) const
 Check if the given item is stored in this Sequence. More...
 
virtual Size size () const
 Size of the Index. More...
 
virtual Size count () const
 Item count in the Index. More...
 
T * operator[] (const Size i)
 Returns the item at the given position in the Index. More...
 

Private Attributes

T * m_array [N]
 Array of pointers to items. More...
 
Size m_count
 Amount of valid pointers in the array. More...
 

Detailed Description

template<class T, const Size N>
class Index< T, N >

Index is a N-sized array of pointers to items of type T.

Definition at line 36 of file Index.h.

Constructor & Destructor Documentation

◆ Index()

template<class T , const Size N>
Index< T, N >::Index ( )
inline

Constructor.

Definition at line 43 of file Index.h.

Member Function Documentation

◆ contains()

template<class T , const Size N>
virtual bool Index< T, N >::contains ( const T *  item) const
inlinevirtual

Check if the given item is stored in this Sequence.

Definition at line 201 of file Index.h.

◆ count()

template<class T , const Size N>
virtual Size Index< T, N >::count ( ) const
inlinevirtual

Item count in the Index.

Definition at line 225 of file Index.h.

Referenced by DeviceServer::initialize().

◆ deleteAll()

template<class T , const Size N>
void Index< T, N >::deleteAll ( )
inline

Removes and delete()'s all items.

Definition at line 166 of file Index.h.

Referenced by ChannelServer< DatastoreServer, DatastoreMessage >::~ChannelServer(), and DirectoryScanner::~DirectoryScanner().

◆ get()

template<class T , const Size N>
virtual T* Index< T, N >::get ( const Size  position) const
inlinevirtual

◆ insert() [1/2]

template<class T , const Size N>
virtual bool Index< T, N >::insert ( Size position,
T *  item 
)
inlinevirtual

Adds the given item, if possible.

Parameters
positionOn output the position of the item in the Index.
itemPointer to the item to add.
Returns
True on success, false otherwise.

Definition at line 60 of file Index.h.

Referenced by ProcessManager::create(), UDP::createSocket(), ICMP::createSocket(), Index< NetworkQueue::Packet, NetworkQueue::MaxPackets >::insert(), DeviceServer::registerDevice(), and DirectoryScanner::scan().

◆ insert() [2/2]

template<class T , const Size N>
virtual bool Index< T, N >::insert ( T *  item)
inlinevirtual

Adds the given item, if possible.

Parameters
itemPointer to the item to add.
Returns
True on success, false otherwise.

Definition at line 97 of file Index.h.

◆ insertAt()

template<class T , const Size N>
virtual bool Index< T, N >::insertAt ( const Size  position,
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
True on success, false otherwise.

Definition at line 113 of file Index.h.

Referenced by ChannelServer< DatastoreServer, DatastoreMessage >::addIPCHandler(), ChannelServer< DatastoreServer, DatastoreMessage >::addIRQHandler(), ProcessManager::create(), MpiProxy::createChannels(), MpiTarget::createReadChannel(), MpiTarget::createWriteChannel(), CoreServer::prepareCoreInfo(), DeviceServer::registerInterrupt(), Sun8iEmac::resetReceive(), and CoreServer::setupChannels().

◆ operator[]()

template<class T , const Size N>
T* Index< T, N >::operator[] ( const Size  i)
inline

Returns the item at the given position in the Index.

Parameters
iThe position of the item to return.
Returns
the Item at position i or ZERO if no item available.

Definition at line 237 of file Index.h.

◆ remove()

template<class T , const Size N>
virtual bool Index< T, N >::remove ( const 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.

Definition at line 143 of file Index.h.

Referenced by ProcessManager::create(), UDP::createSocket(), ICMP::createSocket(), ProcessManager::remove(), UDP::unregisterSockets(), and ICMP::unregisterSockets().

◆ size()

template<class T , const Size N>
virtual Size Index< T, N >::size ( ) const
inlinevirtual

Size of the Index.

Definition at line 217 of file Index.h.

Referenced by ICMP::process(), and ProcessManager::remove().

Field Documentation

◆ m_array

template<class T , const Size N>
T* Index< T, N >::m_array[N]
private

◆ m_count

template<class T , const Size N>
Size Index< T, N >::m_count
private

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