Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Private Attributes | Friends
rel_hashmap_rep< T, U > Class Template Reference

#include <rel_hashmap.hpp>

Inheritance diagram for rel_hashmap_rep< T, U >:
Inheritance graph
[legend]
Collaboration diagram for rel_hashmap_rep< T, U >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 rel_hashmap_rep (hashmap< T, U > item2, rel_hashmap< T, U > next2)
bool contains (T x)
void extend ()
void shorten ()
void merge ()
void find_changes (hashmap< T, U > &CH)
void find_differences (hashmap< T, U > &CH)
void change (hashmap< T, U > CH)

Public Attributes

hashmap< T, U > item
rel_hashmap< T, U > next

Private Attributes

int ref_count

Friends

class rel_hashmap< T, U >

Detailed Description

template<class T, class U>
class rel_hashmap_rep< T, U >

Definition at line 29 of file rel_hashmap.hpp.


Constructor & Destructor Documentation

template<class T , class U >
rel_hashmap_rep< T, U >::rel_hashmap_rep ( hashmap< T, U >  item2,
rel_hashmap< T, U >  next2 
) [inline]

Definition at line 34 of file rel_hashmap.hpp.

                                                                          :
    item(item2), next(next2) {}

Member Function Documentation

template<class T , class U >
void rel_hashmap_rep< T, U >::change ( hashmap< T, U >  CH)

Definition at line 103 of file rel_hashmap.cpp.

                                             {
  int i;
  for (i=0; i<CH->n; i++) {
    list<hashentry<T,U> > l (CH->a[i]);
    while (!is_nil (l)) {
      item (l->item.key)= l->item.im;
      l=l->next;
    }
  }
}

Here is the call graph for this function:

template<class T , class U >
bool rel_hashmap_rep< T, U >::contains ( T  x)

Definition at line 38 of file rel_hashmap.cpp.

                                   {
  if (item->contains (x)) return true;
  if (is_nil (next)) return false;
  return next->contains (x);
}

Here is the call graph for this function:

template<class T , class U >
void rel_hashmap_rep< T, U >::extend ( )

Definition at line 45 of file rel_hashmap.cpp.

                              {
  next= rel_hashmap<T,U> (item, next);
  item= hashmap<T,U> (item->init);
}
template<class T , class U >
void rel_hashmap_rep< T, U >::find_changes ( hashmap< T, U > &  CH)

Definition at line 65 of file rel_hashmap.cpp.

                                                    {
  int i;
  rel_hashmap<T,U> h (item, next);
  list<hashentry<T,U> > remove;
  for (i=0; i<CH->n; i++) {
    list<hashentry<T,U> > l (CH->a[i]);
    while (!is_nil (l)) {
      if (h [l->item.key] == l->item.im)
       remove= list<hashentry<T,U> > (l->item, remove);
      l=l->next;
    }
  }
  while (!is_nil (remove)) {
    CH->reset (remove->item.key);
    remove= remove->next;
  }
}

Here is the call graph for this function:

template<class T , class U >
void rel_hashmap_rep< T, U >::find_differences ( hashmap< T, U > &  CH)

Definition at line 84 of file rel_hashmap.cpp.

                                                        {
  int i;
  list<hashentry<T,U> > add;
  for (i=0; i<item->n; i++) {
    list<hashentry<T,U> > l (item->a[i]);
    while (!is_nil (l)) {
      if (!CH->contains (l->item.key))
       add= list<hashentry<T,U> > (l->item, add);
      l=l->next;
    }
  }
  while (!is_nil (add)) {
    CH (add->item.key)= next [add->item.key];
    add= add->next;
  }
  find_changes (CH);
}

Here is the call graph for this function:

template<class T , class U >
void rel_hashmap_rep< T, U >::merge ( )

Definition at line 58 of file rel_hashmap.cpp.

                             {
  ASSERT (!is_nil (next), "relative hashmap cannot be merged");
  next->change (item);
  shorten ();
}

Here is the call graph for this function:

template<class T , class U >
void rel_hashmap_rep< T, U >::shorten ( )

Definition at line 51 of file rel_hashmap.cpp.

                               {
  ASSERT (!is_nil (next), "relative hashmap cannot be shortened");
  item= next->item;
  next= next->next;
}

Here is the call graph for this function:


Friends And Related Function Documentation

template<class T , class U >
friend class rel_hashmap< T, U > [friend]

Definition at line 44 of file rel_hashmap.hpp.


Member Data Documentation

template<class T , class U >
hashmap<T,U> rel_hashmap_rep< T, U >::item

Definition at line 31 of file rel_hashmap.hpp.

template<class T , class U >
rel_hashmap<T,U> rel_hashmap_rep< T, U >::next

Definition at line 32 of file rel_hashmap.hpp.

int concrete_struct::ref_count [inherited]

Definition at line 135 of file basic.hpp.


The documentation for this class was generated from the following files: