2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * $XConsortium: index.h /main/7 1996/08/21 15:52:20 drk $
26 * Copyright (c) 1993 HAL Computer Systems International, Ltd.
27 * All rights reserved. Unpublished -- rights reserved under
28 * the Copyright Laws of the United States. USE OF A COPYRIGHT
29 * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
32 * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
33 * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
34 * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
35 * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
38 * RESTRICTED RIGHTS LEGEND
39 * Use, duplication, or disclosure by the Government is subject
40 * to the restrictions as set forth in subparagraph (c)(l)(ii)
41 * of the Rights in Technical Data and Computer Software clause
42 * at DFARS 252.227-7013.
44 * HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
55 #include "utility/c_strstream.h"
57 #include <strstream.h>
60 #include "object/oid_list.h"
61 #include "index/inv_lists.h"
63 class c_index : public composite
67 c_index(c_code_t = INDEX_CODE);
68 virtual ~c_index() {} ;
70 void init_persistent_info(persistent_info* x);
73 void set_selector(int cmp) { v_cmp_selector = cmp; };
75 // iteration functions
76 virtual oid_list_handler* operator()(int index);
77 virtual oid_t first_of_invlist(int ind) ;
78 virtual oid_t first_of_invlist(const handler&);
80 // insert index functions
81 virtual Boolean batch_index_begin() { return true; };
82 virtual Boolean batch_index_end() { return true; };
83 virtual Boolean insert_key_loc(const handler&, const oid_t&) = 0;
84 virtual Boolean insert_key_loc(const oid_t&, const oid_t&) = 0;
85 virtual Boolean load(const char*) { return true; };
87 // remove index functions
88 virtual Boolean remove_loc(handler&, const oid_t&) = 0;
89 virtual Boolean remove_loc(const oid_t&, const oid_t&) = 0;
91 // update index function
92 virtual Boolean update_streampos(handler& old_obj,
98 virtual oid_list_handler* get_loc_list(const oid_t&)=0;
99 virtual oid_list_handler* get_loc_list(const handler&)=0;
100 virtual int invlist_length(handler&) = 0;
102 // translate a query to an index of an inv_list
103 virtual int handler_to_inv_idx(const handler& query) = 0;
105 // status inquiry functions
106 int bound_to() const { return v_cmp_selector; } ;
107 virtual Boolean sorted() const = 0;
109 virtual int cdr_sizeof();
110 virtual io_status cdrOut(buffer&);
111 virtual io_status cdrIn(buffer&);
115 friend ostream& operator <<(ostream& s, c_index& t) ;
118 friend void initialize_MMDB();
119 friend void quit_MMDB();
123 Boolean get_key_string(const handler&) const;
124 Boolean get_key_string(const oid_t&) const;
129 static key_type* v_static_key_ptr;
131 static key_type v_static_key;
135 inv_lists_handler *v_inv_lists_hd;
138 typedef c_index* indexPtr;
140 HANDLER_SIGNATURES(c_index)