Back to index

texmacs  1.0.7.15
Defines | Functions
hashmap_extra.cpp File Reference
#include "hashmap.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define HASHMAP_EXTRA_CC
#define TMPL   template<class T, class U>
#define H   hashentry<T,U>

Functions

TMPL list< hashentry< T, U > > copy_list (list< hashentry< T, U > > l)
TMPL hashmap< T, U > copy (hashmap< T, U > h)
TMPL hashmap< T, U > changes (hashmap< T, U > patch, hashmap< T, U > base)
TMPL hashmap< T, U > invert (hashmap< T, U > patch, hashmap< T, U > base)

Define Documentation

#define H   hashentry<T,U>

Definition at line 16 of file hashmap_extra.cpp.

Definition at line 13 of file hashmap_extra.cpp.

#define TMPL   template<class T, class U>

Definition at line 15 of file hashmap_extra.cpp.


Function Documentation

TMPL hashmap<T,U> changes ( hashmap< T, U >  patch,
hashmap< T, U >  base 
)

Definition at line 90 of file hashmap_extra.cpp.

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

Here is the call graph for this function:

TMPL hashmap<T,U> copy ( hashmap< T, U >  h)

Definition at line 80 of file hashmap_extra.cpp.

                      {
  int i, n= h->n;
  hashmap<T,U> h2 (h->init, n, h->max);
  h2->size= h->size;
  for (i=0; i<n; i++)
    h2->a[i]= copy_list (h->a[i]);
  return h2;
}

Here is the call graph for this function:

TMPL list<hashentry<T,U> > copy_list ( list< hashentry< T, U > >  l)

Definition at line 72 of file hashmap_extra.cpp.

                                    {
  if (is_nil (l)) return l;
  else return list<hashentry<T,U> >
               (hashentry<T,U> (l->item.code, l->item.key, l->item.im),
               copy_list (l->next));
}

Here is the call graph for this function:

Here is the caller graph for this function:

TMPL hashmap<T,U> invert ( hashmap< T, U >  patch,
hashmap< T, U >  base 
)

Definition at line 105 of file hashmap_extra.cpp.

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

Here is the call graph for this function: