Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5068 in orxonox.OLD for orxonox/trunk/src/lib/util


Ignore:
Timestamp:
Aug 18, 2005, 3:51:43 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: added Shell Class to the utils.
This class should enable us to print all the output from orxonox directly onto the screen.
Also it should allow inputting some little Commands, so that we have more force over our little project :)

Also added a new Function to tList, removeLast, that is very quick in deleting the last element, as this is used inside of the Shell (deleting the Last Element is a major issue)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/util/list.h

    r4836 r5068  
    11/*!
    2   \file list.h
    3   \brief a File that includes a List-template
    4 */
     2 * @file list.h
     3 * a File that includes a List-template
     4 */
    55
    66#ifndef _LIST_H
     
    132132  void add(T* entity);
    133133  void remove(T* entity);
     134  void removeLast();
    134135  void flush();
    135136  T* firstElement();
     
    214215{
    215216  this->currentEl = this->first;
    216   listElement<T>* te;
    217217  while( this->currentEl != NULL)
    218218    {
     
    233233}
    234234
     235/**
     236 * removes the Last Element of the List
     237 */
     238 template<class T>
     239     inline void tList<T>::removeLast()
     240{
     241  if (this->last == NULL)
     242    return;
     243  else if (this->last == this->first)
     244  {
     245    delete this->first;
     246    this->first = NULL;
     247    this->last = NULL;
     248    this->size--;
     249  }
     250  else
     251  {
     252    listElement<T>* delLast = this->last;
     253    this->last->prev->next = NULL;
     254    this->last = this->last->prev;
     255    delete delLast;
     256  }
     257}
    235258
    236259/**
Note: See TracChangeset for help on using the changeset viewer.