2001-05-23 15:26:42 +02:00
|
|
|
/*
|
|
|
|
* PROGRAM: JRD Access Method
|
|
|
|
* MODULE: sqz.h
|
|
|
|
* DESCRIPTION: Data compression control block
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Interbase Public
|
|
|
|
* License Version 1.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy
|
|
|
|
* of the License at http://www.Inprise.com/IPL.html
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an
|
|
|
|
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
|
|
|
* or implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code was created by Inprise Corporation
|
|
|
|
* and its predecessors. Portions created by Inprise Corporation are
|
|
|
|
* Copyright (C) Inprise Corporation.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
* Contributor(s): ______________________________________.
|
|
|
|
*/
|
|
|
|
|
2003-10-03 03:53:34 +02:00
|
|
|
#ifndef JRD_SQZ_H
|
|
|
|
#define JRD_SQZ_H
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2001-12-24 03:51:06 +01:00
|
|
|
#include "../include/fb_blk.h"
|
2009-06-10 14:41:13 +02:00
|
|
|
#include "../../common/classes/array.h"
|
2001-12-24 03:51:06 +01:00
|
|
|
|
2010-02-12 13:53:06 +01:00
|
|
|
namespace Jrd
|
|
|
|
{
|
|
|
|
class Compressor : public Firebird::AutoStorage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Compressor(size_t length, const UCHAR* data);
|
2004-03-20 15:57:40 +01:00
|
|
|
|
2010-02-12 13:53:06 +01:00
|
|
|
size_t getPackedLength() const
|
|
|
|
{
|
|
|
|
return m_length;
|
|
|
|
}
|
|
|
|
|
|
|
|
const UCHAR* getControl() const
|
|
|
|
{
|
|
|
|
return m_control.begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t getControlSize() const
|
|
|
|
{
|
|
|
|
return m_control.getCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pack(const UCHAR*, UCHAR*) const;
|
|
|
|
size_t pack(const UCHAR*, size_t, UCHAR*) const;
|
|
|
|
size_t getPartialLength(size_t, const UCHAR*) const;
|
|
|
|
|
|
|
|
static UCHAR* unpack(size_t, const UCHAR*, size_t, UCHAR*);
|
2010-02-13 09:34:08 +01:00
|
|
|
static size_t applyDiff(size_t, const UCHAR*, size_t, UCHAR* const);
|
2010-02-12 13:53:06 +01:00
|
|
|
static size_t makeDiff(size_t, const UCHAR*, size_t, UCHAR*, size_t, UCHAR*);
|
|
|
|
static size_t makeNoDiff(size_t, UCHAR*);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Firebird::HalfStaticArray<UCHAR, 2048> m_control;
|
|
|
|
size_t m_length;
|
|
|
|
};
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2004-03-20 15:57:40 +01:00
|
|
|
} //namespace Jrd
|
|
|
|
|
2004-02-20 07:43:27 +01:00
|
|
|
#endif // JRD_SQZ_H
|
2003-12-31 06:36:12 +01:00
|
|
|
|