1
// Spatial Index Library
3
// Copyright (C) 2002 Navel Ltd.
5
// This library is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation; either
8
// version 2.1 of the License, or (at your option) any later version.
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Lesser General Public License for more details.
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with this library; if not, write to the Free Software
17
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
#ifndef __storagemanager_buffer_h
23
#define __storagemanager_buffer_h
27
namespace SpatialIndex
29
namespace StorageManager
31
class Buffer : public IBuffer
34
Buffer( IStorageManager& sm, Tools::PropertySet& ps );
35
// String Value Description
36
// ----------------------------------------------
37
// Capacity VT_ULONG Buffer maximum capacity.
38
// WriteThrough VT_BOOL Enable or disable write through policy.
42
virtual void loadByteArray( const long id, unsigned long& len, byte** data );
43
virtual void storeByteArray( long& id, const unsigned long len, const byte* const data );
44
virtual void deleteByteArray( const long id );
47
virtual unsigned long getHits();
53
Entry( unsigned long l, const byte* const d ) : m_pData( 0 ), m_length( l ), m_bDirty( false )
55
m_pData = new byte[m_length];
56
memcpy( m_pData, d, m_length );
59
~Entry() { delete[] m_pData; }
62
unsigned long m_length;
66
virtual void addEntry( long id, Entry* pEntry ) = 0;
67
virtual void removeEntry() = 0;
69
unsigned long m_capacity;
71
IStorageManager* m_pStorageManager;
72
std::map<long, Entry*> m_buffer;
78
#endif /*__storagemanager_buffer_h*/