xref: /aoo41x/main/store/source/storcach.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _STORE_STORCACH_HXX
29 #define _STORE_STORCACH_HXX "$Revision: 1.6.8.2 $"
30 
31 #include "sal/types.h"
32 #include "rtl/ref.hxx"
33 
34 #include "store/types.h"
35 #include "storbase.hxx"
36 
37 namespace store
38 {
39 
40 /*========================================================================
41  *
42  * PageCache interface.
43  *
44  *======================================================================*/
45 
46 class PageCache : public rtl::IReference
47 {
48 public:
49 	/** load.
50      */
51     storeError lookupPageAt (
52         PageHolder & rxPage,
53         sal_uInt32   nOffset);
54 
55 	/** insert.
56      */
57     storeError insertPageAt (
58         PageHolder const & rxPage,
59         sal_uInt32         nOffset);
60 
61 	/** update, or insert.
62      */
63     storeError updatePageAt (
64         PageHolder const & rxPage,
65         sal_uInt32         nOffset);
66 
67 	/** remove (invalidate).
68      */
69     storeError removePageAt (
70         sal_uInt32 nOffset);
71 
72 private:
73     /** Implementation (abstract).
74      */
75     virtual storeError lookupPageAt_Impl (
76         PageHolder & rxPage,
77         sal_uInt32   nOffset) = 0;
78 
79     virtual storeError insertPageAt_Impl (
80         PageHolder const & rxPage,
81         sal_uInt32         nOffset) = 0;
82 
83     virtual storeError updatePageAt_Impl (
84         PageHolder const & rxPage,
85         sal_uInt32         nOffset) = 0;
86 
87     virtual storeError removePageAt_Impl (
88         sal_uInt32 nOffset) = 0;
89 };
90 
91 /*========================================================================
92  *
93  * PageCache factory.
94  *
95  *======================================================================*/
96 
97 storeError
98 PageCache_createInstance (
99     rtl::Reference< store::PageCache > & rxCache,
100     sal_uInt16                           nPageSize
101 );
102 
103 /*========================================================================
104  *
105  * The End.
106  *
107  *======================================================================*/
108 
109 } // namespace store
110 
111 #endif /* !_STORE_STORCACH_HXX */
112 
113