Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

LL.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2001 Carnegie Mellon University.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.cs.cmu.edu/~lemur/license.html
00008  *
00009  *==========================================================================
00010 */
00011 
00012 
00013 #ifndef _LLH_
00014 #define _LLH_
00015 
00016 #ifndef NULL
00017 #define NULL ((void *)0)
00018 #endif
00019 
00020 template <class Type> class List;
00021 
00022 // Internal class for List, do not use as linked list
00023 template <class Type>
00024 class LL {
00025 public:
00026   // ****************** Constructors ***************************
00027   // Constructor with data, next, and prev
00028   LL(Type *d=(Type *) NULL, LL<Type> *n=(LL<Type> *) NULL, LL<Type> *p=(LL<Type> *)NULL);
00029   LL(LL<Type> &ll) : datamem((Type *)NULL), prevmem((LL<Type> *)NULL), nextmem((LL<Type> *)NULL)
00030       { *this = ll; }
00031   // ****************** Destructor ***************************
00032   ~LL();
00033 
00034   // ****************** Overloaded Operators ******************
00035   // Copy operator
00036   LL<Type> &operator=(const LL<Type> &ll);
00037 
00038   // Comparison operators
00039   int operator!=(const LL<Type> &ll) const { return !(*this == ll); }
00040   int operator==(const LL<Type> &ll) const;
00041 
00042   // Data accessing operator
00043   Type *operator[](int num) const;
00044 
00045   // Data search operator
00046   LL<Type> *operator[](const Type *d);
00047 
00048   // ************************ Member Functions *********************
00049   void DeleteData();
00050   Type *Remove();
00051 
00052 private:
00053   // ********************** Member Data ***********************
00054   Type *datamem;
00055   LL<Type> *prevmem;
00056   LL<Type> *nextmem;
00057 
00058   friend class List<Type>;
00059 };
00060 
00061 
00062 #endif

Generated at Fri Jul 26 18:22:27 2002 for LEMUR by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000