Eneboo - Documentación para desarrolladores
src/hoard/src/heaplayers/util/sllist.h
Ir a la documentación de este archivo.
00001 // -*- C++ -*-
00002 
00003 /*
00004 
00005   Heap Layers: An Extensible Memory Allocation Infrastructure
00006   
00007   Copyright (C) 2000-2003 by Emery Berger
00008   http://www.cs.umass.edu/~emery
00009   emery@cs.umass.edu
00010   
00011   This program is free software; you can redistribute it and/or modify
00012   it under the terms of the GNU General Public License as published by
00013   the Free Software Foundation; either version 2 of the License, or
00014   (at your option) any later version.
00015   
00016   This program is distributed in the hope that it will be useful,
00017   but WITHOUT ANY WARRANTY; without even the implied warranty of
00018   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019   GNU General Public License for more details.
00020   
00021   You should have received a copy of the GNU General Public License
00022   along with this program; if not, write to the Free Software
00023   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 
00025 */
00026 
00027 #ifndef _SLLIST_H_
00028 #define _SLLIST_H_
00029 
00030 #include <assert.h>
00031 
00038 namespace HL {
00039 
00040   class SLList {
00041   public:
00042     
00043     inline SLList (void) {
00044       clear();
00045     }
00046 
00047     class Entry;
00048   
00050     inline void clear (void) {
00051       head.next = NULL;
00052     }
00053 
00055     inline Entry * get (void) {
00056       const Entry * e = head.next;
00057       if (e == NULL) {
00058         return NULL;
00059       }
00060       head.next = e->next;
00061       return (Entry *) e;
00062     }
00063 
00064   private:
00065 
00070     inline void remove (Entry *) {
00071       abort();
00072     }
00073 
00074   public:
00075 
00077     inline void insert (Entry * e) {
00078       e->next = head.next;
00079       head.next = e;
00080     }
00081 
00083     class Entry {
00084     public:
00085       inline Entry (void)
00086         : next (NULL)
00087       {}
00088       //  private:
00089       //    Entry * prev;
00090     public:
00091       Entry * next;
00092     };
00093 
00094   private:
00095 
00097     Entry head;
00098 
00099   };
00100 
00101 }
00102 
00103 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'