Fix typo in license headers
[oweals/cde.git] / cde / programs / dtmail / include / DtMail / DtVirtArray.hh
1 /*
2  *+SNOTICE
3  *
4  *      $TOG: DtVirtArray.hh /main/5 1997/12/23 09:08:16 bill $
5  *
6  *      RESTRICTED CONFIDENTIAL INFORMATION:
7  *      
8  *      The information in this document is subject to special
9  *      restrictions in a confidential disclosure agreement between
10  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
11  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
12  *      Sun's specific written approval.  This document and all copies
13  *      and derivative works thereof must be returned or destroyed at
14  *      Sun's request.
15  *
16  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
17  *
18  *+ENOTICE
19  */
20
21 #ifndef _VIRTARRAY_HH
22 #define _VIRTARRAY_HH
23
24 #include <DtMail/DtLanguages.hh>
25
26 class DtVirtArrayImpl : public DtCPlusPlusAllocator {
27   public:
28     DtVirtArrayImpl(const int size);
29     ~DtVirtArrayImpl(void);
30     
31     int length(void);
32     void * operator[](const int at);
33     
34     int indexof(void * handle);
35     int append(void * handle);
36     void insert(void * handle, const int at);
37     void remove(const int at);
38     void remove(void * handle);
39     
40   private:
41     void make_slot(const int at);
42     void grow(void);
43
44     void        **_elements;
45     int         _size;
46     int         _count;
47
48     void        *_mutex;
49 };
50
51 template <class Element> 
52 class DtVirtArray : public DtCPlusPlusAllocator {
53   public:
54     DtVirtArray(const int size) 
55     : my_array(size) {}
56
57     ~DtVirtArray(void) {}
58
59     int length(void) { return(my_array.length()); }
60
61     Element operator[](const int at) { return((Element)my_array[at]); }
62     int indexof(Element handle) { return(my_array.indexof((void *)handle)); }
63     int append(Element handle) { return(my_array.append((void *)handle)); }
64     void insert(Element handle, const int at) { my_array.insert((void *)handle, at); }
65     void remove(const int at) { my_array.remove(at); }
66     void remove(Element handle) { my_array.remove((void *)handle); }
67
68   private:
69     DtVirtArrayImpl     my_array;
70 };
71
72 #endif