39 #ifndef __EST_TKVL_H__
40 #define __EST_TKVL_H__
46 #include "EST_TList.h"
47 #include "instantiate/EST_TKVLI.h"
48 #include "EST_TIterator.h"
61 return( (i.k == k) && (i.v == v) );
64 friend ostream& operator << (ostream& s, EST_TKVI<K,V>
const &i)
65 {
return s << i.k <<
"\t" << i.v <<
"\n"; }
74 EST_Litem *find_pair_key(
const K &key)
const;
75 EST_Litem *find_pair_val(
const V &val)
const;
96 const int length()
const {
return list.length();}
108 const V &val(
const K &rkey,
bool m=0)
const;
110 V &val(
const K &rkey,
bool m=0);
112 const V &val(
EST_Litem *ptr,
bool m=0)
const;
116 const V &val_def(
const K &rkey,
const V &def)
const;
119 const K &key(
EST_Litem *ptr,
int m=1)
const;
124 const K &key(
const V &v,
int m=1)
const;
129 int change_val(
const K &rkey,
const V &rval);
132 int change_val(
EST_Litem *ptr,
const V &rval);
134 int change_key(
EST_Litem *ptr,
const K &rkey);
137 int add_item(
const K &rkey,
const V &rval,
int no_search = 0);
140 int remove_item(
const K &rkey,
int quiet = 0);
145 const int present(
const K &rkey)
const;
148 void map(
void (*func)(K&, V&));
150 friend ostream& operator << (ostream& s, EST_TKVL<K,V>
const &l)
152 for (p = l.list.head(); p ; p = p->next())
153 s << l.list(p).k <<
"\t" << l.list(p).v << endl;
169 void point_to_first(
IPointer &ip)
const { ip.p = list.head(); }
170 void move_pointer_forwards(IPointer &ip)
const { ip.p = ip.p->next(); }
171 bool points_to_something(
const IPointer &ip)
const {
return ip.p != NULL; }
172 EST_TKVI<K, V> &points_at(
const IPointer &ip) {
return list(ip.p); }
189 void point_to_first(
IPointer_k &ip)
const { ip.p = list.head(); }
190 void move_pointer_forwards(IPointer_k &ip)
const { ip.p = ip.p->next(); }
191 bool points_to_something(
const IPointer_k &ip)
const {
return ip.p != NULL; }
192 K &points_at(
const IPointer_k &ip) {
return list(ip.p).k; }