modules/up/src/gnug++/int.int.VHMap.h

/* [<][>]
[^][v][top][bottom][index][help] */

FUNCTIONS

This source file includes following functions.
  1. intintVHMap
  2. intintVHMap
  3. contains
  4. key
  5. contents

   1 // This may look like C code, but it is really -*- C++ -*-
   2 /* 
   3 Copyright (C) 1988 Free Software Foundation
   4     written by Doug Lea (dl@rocky.oswego.edu)
   5 
   6 This file is part of the GNU C++ Library.  This library is free
   7 software; you can redistribute it and/or modify it under the terms of
   8 the GNU Library General Public License as published by the Free
   9 Software Foundation; either version 2 of the License, or (at your
  10 option) any later version.  This library is distributed in the hope
  11 that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13 PURPOSE.  See the GNU Library General Public License for more details.
  14 You should have received a copy of the GNU Library General Public
  15 License along with this library; if not, write to the Free Software
  16 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17 */
  18 
  19 
  20 #ifndef _intintVHMap_h
  21 #ifdef __GNUG__
  22 #pragma interface
  23 #endif
  24 #define _intintVHMap_h 1
  25 
  26 #include "int.int.Map.h"
  27 
  28 
  29 class intintVHMap : public intintMap
     /* [<][>][^][v][top][bottom][index][help] */
  30 {
  31 protected:
  32   int*           tab;
  33   int*           cont;
  34   char*          status;
  35   unsigned int   size;
  36 
  37 public:
  38                 intintVHMap(int  dflt,unsigned int sz=DEFAULT_INITIAL_CAPACITY);
  39                 intintVHMap(intintVHMap& a);
  40                 ~intintVHMap();
  41 
  42   int&          operator [] (int  key);
  43 
  44   void          del(int  key);
  45 
  46   Pix           first();
  47   void          next(Pix& i);
  48   int&          key(Pix i);
  49   int&          contents(Pix i);
  50 
  51   Pix           seek(int  key);
  52   int           contains(int  key);
  53 
  54   void          clear(); 
  55   void          resize(unsigned int newsize = 0);
  56 
  57   int           OK();
  58 };
  59 
  60 inline intintVHMap::~intintVHMap()
     /* [<][>][^][v][top][bottom][index][help] */
  61 {
  62   delete [] tab;
  63   delete [] cont;
  64   delete [] status;
  65 }
  66 
  67 inline int intintVHMap::contains(int  key)
     /* [<][>][^][v][top][bottom][index][help] */
  68 {
  69   return seek(key) != 0;
  70 }
  71 
  72 inline int& intintVHMap::key(Pix i)
     /* [<][>][^][v][top][bottom][index][help] */
  73 {
  74   if (i == 0) error("null Pix");
  75   return *((int*)i);
  76 }
  77 
  78 inline int& intintVHMap::contents(Pix i)
     /* [<][>][^][v][top][bottom][index][help] */
  79 {
  80   if (i == 0) error("null Pix");
  81   return cont[((unsigned)(i) - (unsigned)(tab)) / sizeof(int)];
  82 }
  83 
  84 #endif

/* [<][>][^][v][top][bottom][index][help] */