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
23 /* $XConsortium: page_cache.h /main/3 1996/06/11 17:44:27 cde-hal $ */
26 #define _page_cache_h 1
31 #define MMDB_CACHED_PAGES 100
32 #define MIN_MMDB_CACHED_PAGES 10
34 #include "dstr/bset.h"
36 class page_cache_local_part
40 int f_num_cached_pages ; // number of cached pages
42 heap f_free_space; // a heap recording free
45 bset f_page_pool_index; // index to pages in the pool
47 int f_current_page_num;
48 page* f_current_page_ptr;
51 page_cache_local_part(unsigned int exp_cached_page);
52 virtual ~page_cache_local_part();
55 Boolean init_heap(page_storage*);
56 Boolean quit_heap(page_storage*);
58 // does the cache hold page 'page_num'?
59 page* in_cache(page_storage* st, int page_num);
61 // get a non-empty page
62 fbytes_t* find_host_page(page_storage*, Boolean& new_page, int len = 0);
63 void adjust_heap(fbytes_t* v, Boolean new_page);
65 friend class page_cache_global_part ;
70 class page_cache_global_part
74 //////////////////////////////////////////////////////////////////////
75 // The default value (0) triggers the constructor to
76 // search for the value in the shell variable MMDB_CACHED_PAGES.
77 // If the varialble is undefind, the value set by const MMDB_CACHED_PAGES
79 //////////////////////////////////////////////////////////////////////
80 page_cache_global_part(unsigned int total_allowed_pages = 0);
81 virtual ~page_cache_global_part() ;
83 void remove_pages(page_storage* st);
85 // return a free page frame from cache
86 page* load_new_page(page_storage*, int page_num, Boolean byteOrder);
88 ostream& print_cached_pages(ostream&); // show cached pages.
90 friend class page_cache_local_part;
91 friend class page_storage;
92 friend void remove_from_global_cache(const void*);
95 unsigned int f_total_allowed_pages;