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: abs_storage.h /main/6 1996/07/18 14:52:29 drk $
26 * Copyright (c) 1992 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.
51 #ifndef _abs_storage_h
52 #define _abs_storage_h 1
54 #include "storage/rep_policy.h"
55 #include "utility/buffer.h"
56 #include "utility/types.h"
57 #include "object/root.h"
58 #include "storage/version.h"
60 /*****************************************
61 // abstract storage class
62 // this class provides a set of common
63 // member function signatures and a policy
64 // pointer for all derived storage classes.
65 *****************************************/
70 mmdb_little_endian = 2
74 class abs_storage : public root
79 abs_storage( char* path, char* name,
83 virtual ~abs_storage() ;
86 virtual void remove() = 0; // wipe all contents
89 virtual int readString (mmdb_pos_t loc, char* base, int len,
90 int str_offset = 0) = 0;
91 virtual int insertString(mmdb_pos_t& loc, const char* base, int len, Boolean flush = false) = 0;
92 virtual int appendString(mmdb_pos_t loc, const char*, int len,
93 Boolean flush_opt = false) = 0;
96 virtual int get_str_ptr(mmdb_pos_t loc, char*&, int& len
99 virtual int updateString(mmdb_pos_t loc, const char* base, int len,
100 int string_ofst = 0, Boolean flush = false) = 0;
101 virtual int deleteString (mmdb_pos_t loc, Boolean flush = false) = 0;
102 virtual int allocString (mmdb_pos_t& loc, int len,
103 char*&, int mode = 0) = 0;
105 virtual const char* my_path() { return path; };
106 virtual const char* my_name() { return name; };
107 virtual Boolean io_mode(int mode) = 0;
109 // return byte order of the machine with one of enums in MMDB_BYTE_ORDER
111 virtual Boolean swap_order() { return v_swap_order; };
113 mm_version& get_db_version() { return f_version; };
115 friend class storage_mgr_t;
121 Boolean v_swap_order;
123 mm_version f_version;
126 typedef abs_storage* storagePtr;