Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

dict_both.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef MN_OS_DICT_BOTH_H 00025 #define MN_OS_DICT_BOTH_H 00026 00027 #include <assert.h> 00028 #include <stdlib.h> 00029 #include <time.h> 00030 00031 /*********************************************************************** 00032 * prototype declarations 00033 ***********************************************************************/ 00034 00035 typedef void* d_dic_item; 00036 00037 template <class K, class I> class dictionary; 00038 template <class K, class I> class MNdictionary; 00039 00042 00043 #define d_forall_items(x,S)\ 00044 for( x=S.first_item(); x!=NULL; x=S.next_item(x) ) 00045 00046 template <class T, class M> 00047 inline void* d_forall_assign(T& r, void* p, const M& l) { 00048 if(p) 00049 { 00050 r = l.inf(p); 00051 ASSERT_NON_NULL(r); 00052 } 00053 return p; 00054 } 00055 00060 #define d_forall_var d_forall_runner##__LINE__ 00061 00062 #define d_forall(r,l) \ 00063 for ( void* \ 00064 d_forall_var = d_forall_assign(r,l.first_item(),l); \ 00065 d_forall_var != NULL; \ 00066 d_forall_var = d_forall_assign(r,l.next_item(d_forall_var),l) ) 00067 00068 00069 /**********************************************************************/ 00077 template <class K, class I> class _d_dic_item 00078 { 00079 private: 00080 _d_dic_item<K,I>* left; 00081 _d_dic_item<K,I>* right; 00082 _d_dic_item<K,I>* father; 00083 K key; 00084 I inf; 00085 int index; 00086 00087 friend class dictionary<K,I>; 00088 friend class MNdictionary<K,I>; 00089 00090 _d_dic_item (const K& k, const I& i) 00091 : key(k) 00092 , inf(i) 00093 { 00094 index = rand(); 00095 left = NULL; 00096 right = NULL; 00097 father = NULL; 00098 } 00099 public: 00100 inline d_dic_item l() { return (d_dic_item)left; }; 00101 inline d_dic_item r() { return (d_dic_item)right; }; 00102 }; 00103 00104 #endif /* MN_OS_DICT_BOTH_H */ 00105

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8