Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / utility / atoi_fast.h
1 /*
2  * $XConsortium: atoi_fast.h /main/3 1996/06/11 17:35:30 cde-hal $
3  *
4  * Copyright (c) 1992 HaL Computer Systems, Inc.  All rights reserved.
5  * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
6  * States.  Use of a copyright notice is precautionary only and does not
7  * imply publication or disclosure.
8  * 
9  * This software contains confidential information and trade secrets of HaL
10  * Computer Systems, Inc.  Use, disclosure, or reproduction is prohibited
11  * without the prior express written permission of HaL Computer Systems, Inc.
12  * 
13  *                         RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the Government is subject to
15  * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
16  * Technical Data and Computer Software clause at DFARS 252.227-7013.
17  *                        HaL Computer Systems, Inc.
18  *                  1315 Dell Avenue, Campbell, CA  95008
19  * 
20  */
21
22
23 #ifndef _atoi_fast_h
24 #define _atoi_fast_h 1
25
26 #include "utility/funcs.h"
27 #include "utility/pm_random.h"
28 #include "utility/key.h"
29
30 class atoi_fast 
31 {
32
33 public:
34    atoi_fast(int _range, int _entries) ;
35    atoi_fast(int _range, int _entries, pm_random&) ;
36    virtual ~atoi_fast() ;
37
38    virtual int atoi(const key_type& k, int offset = 0) const ;
39    int atoi(const char* str, int _offset = 0, int range = 0) const ;
40    int atoi(const char* str, int sz, int _offset = 0, int range = 0) const ;
41
42    int size() { return v_entries; } ;
43
44    friend ostream& operator<<(ostream&, atoi_fast&);
45
46 private:
47    void init(int _range, int _entries, pm_random&);
48
49 protected:
50    char *v_tbl;
51    unsigned v_mask;
52    unsigned int v_entries;
53    unsigned int v_range;
54    unsigned int v_no_bytes;
55 };
56
57
58 #endif