Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

clawsoft::List< T > Class Template Reference

#include <List.h>

Inheritance diagram for clawsoft::List< T >:

Inheritance graph
[legend]
Collaboration diagram for clawsoft::List< T >:

Collaboration graph
[legend]

Detailed Description

template<class T>
class clawsoft::List< T >

This class handles single linked lists using templates, don't use this class if you intend to share it's data between threads if you do please use the appropiate semaphore or mutex code to prevent data corruption between threads, you have been warned.


Public Methods

 List ()
 This is the default constructor, it initilizes all data to zero.

 ~List ()
 By default we only destroy the list itself, without destroying its data.

void destroy ()
 Use this method to destroy the list without destroying its data.

void add (T data)
 Appends an element to the end of the list.

void remove (unsigned int idx)
 Removes an element from the end of the list.

T & get (unsigned int j)
 Return the elemt at the j position of the list starting by the head.

T & get ()
 Obtains the current element.

void rewind ()
 Rewinds the list.

T & operator[] (unsigned int i)
 Same as List::get(i).

unsigned int size ()
 Returns the size of the given list.

const char * getClassName ()
 Returns the name of the current class.


Static Public Methods

int installedCPUs ()
 This will return how many CPUs are installed in the system.

double cpuSpeed ()
 This will return the CPU speed in megahertz.

int totalMemory ()
 Will return the total amount of system memory.

int freeMemory ()
 Will return the total amount of free system memory.

void usleep (Uint32 usec)
 Will freeze the software for usec microseconds.


Protected Methods

void setClassName (const char *n)
 Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.


Protected Attributes

unsigned int middle
 Keeps the index of the data in the middle of the list.

nodeTlist
 Points to the beginning of the list.

nodeTend
 Points to the beginning of the list.

unsigned int num_data
 Keeps a count of the number of elements contained in the list.


Constructor & Destructor Documentation

template<class T>
clawsoft::List< T >::List   [inline]
 

This is the default constructor, it initilizes all data to zero.

template<class T>
clawsoft::List< T >::~List   [inline]
 

By default we only destroy the list itself, without destroying its data.


Member Function Documentation

template<class T>
void clawsoft::List< T >::add   data [inline]
 

Appends an element to the end of the list.

double clawsoft::System::cpuSpeed   [static, inherited]
 

This will return the CPU speed in megahertz.

template<class T>
void clawsoft::List< T >::destroy   [inline]
 

Use this method to destroy the list without destroying its data.

int clawsoft::System::freeMemory   [static, inherited]
 

Will return the total amount of free system memory.

template<class T>
T& clawsoft::List< T >::get   [inline]
 

Obtains the current element.

template<class T>
T& clawsoft::List< T >::get unsigned int    j [inline]
 

Return the elemt at the j position of the list starting by the head.

const char * clawsoft::Object::getClassName   [inherited]
 

Returns the name of the current class.

int clawsoft::System::installedCPUs   [static, inherited]
 

This will return how many CPUs are installed in the system.

template<class T>
T& clawsoft::List< T >::operator[] unsigned int    i [inline]
 

Same as List::get(i).

template<class T>
void clawsoft::List< T >::remove unsigned int    idx [inline]
 

Removes an element from the end of the list.

template<class T>
void clawsoft::List< T >::rewind   [inline]
 

Rewinds the list.

void clawsoft::Object::setClassName const char *    n [protected, inherited]
 

Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.

unsigned int clawsoft::Container::size   [inline, inherited]
 

Returns the size of the given list.

int clawsoft::System::totalMemory   [static, inherited]
 

Will return the total amount of system memory.

void clawsoft::System::usleep Uint32    usec [static, inherited]
 

Will freeze the software for usec microseconds.


Field Documentation

template<class T>
nodeT* clawsoft::List< T >::end [protected]
 

Points to the beginning of the list.

template<class T>
nodeT* clawsoft::List< T >::list [protected]
 

Points to the beginning of the list.

template<class T>
unsigned int clawsoft::List< T >::middle [protected]
 

Keeps the index of the data in the middle of the list.

unsigned int clawsoft::Container::num_data [protected, inherited]
 

Keeps a count of the number of elements contained in the list.


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

Authors:

Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara

Powered by:

SourceForgeLogo