1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <sal/types.h>
23 #include <rtl/ref.hxx>
24 #include <osl/mutex.hxx>
26 #include <store/types.h>
28 #include "storbase.hxx"
35 struct SuperBlockPage
;
37 class OStorePageBIOS
: public store::OStoreObject
42 /** Conversion into Mutex&
44 inline operator osl::Mutex
& (void) const;
47 * @param pLockBytes [in]
48 * @param eAccessMode [in]
49 * @param rnPageSize [inout]
50 * @return store_E_None upon success
52 virtual storeError
initialize (
53 ILockBytes
* pLockBytes
,
54 storeAccessMode eAccessMode
,
55 sal_uInt16
& rnPageSize
);
57 rtl::Reference
< PageData::Allocator
> & allocator()
63 sal_uInt32 nAddr
, void *pData
, sal_uInt32 nSize
) const;
66 sal_uInt32 nAddr
, const void *pData
, sal_uInt32 nSize
) const;
68 inline bool isWriteable() const;
70 inline bool isValid() const;
72 storeError
acquirePage (
73 const OStorePageDescriptor
& rDescr
, storeAccessMode eMode
);
75 storeError
releasePage (const OStorePageDescriptor
& rDescr
);
77 storeError
allocate (OStorePageObject
& rPage
);
79 storeError
free (sal_uInt32 nAddr
);
83 storeError
loadObjectAt (
84 OStorePageObject
& rPage
, sal_uInt32 nAddr
);
86 storeError
saveObjectAt (
87 OStorePageObject
& rPage
, sal_uInt32 nAddr
);
90 @return store_E_None upon success.
95 @return store_E_None upon success.
100 virtual ~OStorePageBIOS() override
;
103 rtl::Reference
<ILockBytes
> m_xLockBytes
;
106 std::unique_ptr
<SuperBlockPage
> m_pSuper
;
110 rtl::Reference
< PageData::Allocator
> m_xAllocator
;
111 rtl::Reference
< PageCache
> m_xCache
;
114 /** Page Access (control).
127 static int SAL_CALL
constructor (void * obj
, void * arg
);
129 static Ace
* find (Ace
* head
, sal_uInt32 addr
);
130 static void insert (Ace
* head
, Ace
* entry
);
138 storeError
initialize_Impl (
139 ILockBytes
* pLockBytes
,
140 storeAccessMode eAccessMode
,
141 sal_uInt16
& rnPageSize
);
144 storeError
loadObjectAt_Impl (
145 OStorePageObject
& rPage
, sal_uInt32 nAddr
) const;
146 storeError
saveObjectAt_Impl (
147 OStorePageObject
& rPage
, sal_uInt32 nAddr
) const;
149 OStorePageBIOS (const OStorePageBIOS
&) = delete;
150 OStorePageBIOS
& operator= (const OStorePageBIOS
&) = delete;
153 inline OStorePageBIOS::operator osl::Mutex
& (void) const
155 return const_cast<osl::Mutex
&>(m_aMutex
);
158 inline bool OStorePageBIOS::isWriteable() const
163 inline bool OStorePageBIOS::isValid() const
165 return m_xLockBytes
.is();
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */