📄 absbtree.hpp
字号:
class DELPHICLASS TABSBTreeNodeController;
class PASCALIMPLEMENTATION TABSBTreeNodeController : public TABSBTreePageController
{
typedef TABSBTreePageController inherited;
private:
bool __fastcall FindByConditionOnOneOfPages(int SessionID, bool First, int StartEntryNo, int EndEntryNo, char * Key, Abstypes::TABSSearchCondition Operator, TABSKeyPath* Position);
bool __fastcall FindEntryOnOneOfPages(int SessionID, int StartEntryNo, int EndEntryNo, char * Key, char * Reference, TABSKeyPath* Position);
void __fastcall GetChildPagesToCheck(int SessionID, char * Key, Abstypes::TABSSearchCondition SearchCondition, int &StartEntryNo, int &EndEntryNo);
void __fastcall DecreaseTreeDepth(int SessionID);
protected:
virtual int __fastcall CompareEntries(bool MayUseFullKeys, int SessionID, char * Key1, char * Reference1, Word Entry2Index);
public:
virtual void __fastcall InsertLeafEntry(int SessionID, char * Key, char * Reference, TABSKeyPath* KeyPath);
void __fastcall InsertNodeEntry(int SessionID, char * Key, char * Reference, TABSKeyPath* KeyPath);
virtual bool __fastcall DeleteLeafEntry(int SessionID, char * Key, char * Reference, TABSKeyPath* KeyPath);
void __fastcall DeleteNodeEntry(int SessionID, TABSKeyPath* KeyPath, bool MergeWithLeft);
virtual void __fastcall GetFirstKey(int SessionID, char * Key);
virtual void __fastcall GetLastKey(int SessionID, char * Key);
virtual void __fastcall GetFirstEntry(int SessionID, char * Key, char * Reference);
virtual void __fastcall GetLastEntry(int SessionID, char * Key, char * Reference);
virtual bool __fastcall FindEntry(int SessionID, char * Key, char * Reference, TABSKeyPath* Position);
virtual bool __fastcall GetFirstPosition(int SessionID, TABSKeyPath* Position);
virtual bool __fastcall GetLastPosition(int SessionID, TABSKeyPath* Position);
virtual bool __fastcall FindByCondition(int SessionID, bool First, char * Key, Abstypes::TABSSearchCondition Operator, TABSKeyPath* Position);
virtual void __fastcall FreeAllPages(int SessionID, bool KeepRootPage);
virtual void __fastcall CheckIntegrity(int SessionID, TABSKeyPath* KeyPath);
public:
#pragma option push -w-inl
/* TABSBTreePageController.Create */ inline __fastcall TABSBTreeNodeController(TABSBTreePage* aPage) : TABSBTreePageController(aPage) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TABSBTreeNodeController(void) { }
#pragma option pop
};
class PASCALIMPLEMENTATION TABSBTreePage : public Abspage::TABSPageController
{
typedef Abspage::TABSPageController inherited;
private:
TABSBTreeKeyRef* LKeyRef;
Abspage::TABSPageManager* LPageManager;
TABSBTreeLeafController* FLeafController;
TABSBTreeNodeController* FNodeController;
bool __fastcall GetIsRoot(void);
void __fastcall SetIsRoot(bool Value);
bool __fastcall GetIsLeaf(void);
void __fastcall SetIsLeaf(bool Value);
int __fastcall GetLeftPageNo(void);
void __fastcall SetLeftPageNo(int Value);
int __fastcall GetRightPageNo(void);
void __fastcall SetRightPageNo(int Value);
bool __fastcall GetHasKeys(void);
void __fastcall SetHasKeys(bool Value);
bool __fastcall GetHasSuffixes(void);
void __fastcall SetHasSuffixes(bool Value);
Word __fastcall GetKeyPrefixSize(void);
void __fastcall SetKeyPrefixSize(Word Value);
int __fastcall GetEntryCount(void);
void __fastcall SetEntryCount(int Value);
Word __fastcall GetPagePrefixSize(void);
void __fastcall SetPagePrefixSize(Word Value);
int __fastcall GetEntrySize(void);
int __fastcall GetReferenceSize(void);
int __fastcall GetEntriesOffset(void);
int __fastcall GetSuffixPtrSize(void);
public:
__fastcall TABSBTreePage(Abspage::TABSPageManager* PageManager, TABSBTreeKeyRef* KeyRef);
__fastcall virtual ~TABSBTreePage(void);
void __fastcall AddIndexPage(int SessionID, TABSBTreePage* &Page);
void __fastcall RemoveIndexPage(int SessionID, int PageNo);
void __fastcall GetIndexPage(int SessionID, int PageNo, TABSBTreePage* &Page);
void __fastcall PutIndexPage(TABSBTreePage* Page);
void __fastcall Init(void);
void __fastcall InitAsRoot(void);
void __fastcall CopyFrom(TABSBTreePage* Source, int StartNo, int Count);
void __fastcall AppendFrom(TABSBTreePage* Source, int StartNo, int Count);
void __fastcall InsertFrom(TABSBTreePage* Source, int StartNo, int Count);
void __fastcall InsertLeafEntry(int SessionID, char * Key, char * Reference, TABSKeyPath* KeyPath);
void __fastcall InsertNodeEntry(int SessionID, char * Key, char * Reference, TABSKeyPath* KeyPath);
bool __fastcall DeleteLeafEntry(int SessionID, char * Key, char * Reference, TABSKeyPath* KeyPath);
void __fastcall DeleteNodeEntry(int SessionID, TABSKeyPath* KeyPath, bool MergeWithLeft);
bool __fastcall FindEntry(int SessionID, char * Key, char * Reference, TABSKeyPath* Position);
bool __fastcall GetFirstPosition(int SessionID, TABSKeyPath* Position);
bool __fastcall GetLastPosition(int SessionID, TABSKeyPath* Position);
bool __fastcall FindByCondition(int SessionID, bool First, char * Key, Abstypes::TABSSearchCondition Operator, TABSKeyPath* Position);
void __fastcall FreeAllPages(int SessionID, bool KeepRootPage);
void __fastcall CheckIntegrity(int SessionID, TABSKeyPath* KeyPath);
char * __fastcall GetPKey(int KeyPosition);
char * __fastcall GetPReference(int RefPosition);
void __fastcall GetFirstKey(int SessionID, char * Key);
void __fastcall GetLastKey(int SessionID, char * Key);
void __fastcall GetFirstEntry(int SessionID, char * Key, char * Reference);
void __fastcall GetLastEntry(int SessionID, char * Key, char * Reference);
void __fastcall UpdateKey(int Position, char * Key);
void __fastcall UpdateReference(int Position, char * Reference);
__property bool IsRoot = {read=GetIsRoot, write=SetIsRoot, nodefault};
__property bool IsLeaf = {read=GetIsLeaf, write=SetIsLeaf, nodefault};
__property int LeftPageNo = {read=GetLeftPageNo, write=SetLeftPageNo, nodefault};
__property int RightPageNo = {read=GetRightPageNo, write=SetRightPageNo, nodefault};
__property bool HasKeys = {read=GetHasKeys, write=SetHasKeys, nodefault};
__property bool HasSuffixes = {read=GetHasSuffixes, write=SetHasSuffixes, nodefault};
__property Word KeyPrefixSize = {read=GetKeyPrefixSize, write=SetKeyPrefixSize, nodefault};
__property int EntryCount = {read=GetEntryCount, write=SetEntryCount, nodefault};
__property Word PagePrefixSize = {read=GetPagePrefixSize, write=SetPagePrefixSize, nodefault};
__property int EntrySize = {read=GetEntrySize, nodefault};
__property int ReferenceSize = {read=GetReferenceSize, nodefault};
__property int EntriesOffset = {read=GetEntriesOffset, nodefault};
__property int SuffixPtrSize = {read=GetSuffixPtrSize, nodefault};
__property TABSBTreeKeyRef* KeyRef = {read=LKeyRef, write=LKeyRef};
};
#pragma pack(push,1)
struct TABSBTreeSearchInfo
{
public:
bool GoForward;
bool IsFilled;
TABSKeyPath* EndKeyPath;
TABSKeyPath* CurrentKeyPath;
} ;
#pragma pack(pop)
typedef TABSBTreeSearchInfo *PABSBTreeSearchInfo;
class DELPHICLASS TABSBTreeRecordIndex;
class PASCALIMPLEMENTATION TABSBTreeRecordIndex : public Absbaseengine::TABSIndex
{
typedef Absbaseengine::TABSIndex inherited;
private:
TABSBTreePage* FRootPage;
TABSRecordKeyRef* FKeyRef;
TABSBTreePage* __fastcall AddIndexPage(int SessionID);
TABSBTreePage* __fastcall GetIndexPage(int SessionID, int PageNo);
void __fastcall PutIndexPage(TABSBTreePage* Page);
Abstypes::TABSPageItemID __fastcall GetRecordID(int SessionID, TABSKeyPath* Position);
bool __fastcall GetFirstPosition(int SessionID, TABSKeyPath* Position);
bool __fastcall GetLastPosition(int SessionID, TABSKeyPath* Position);
bool __fastcall GetNextPosition(int SessionID, TABSKeyPath* Position);
bool __fastcall GetPriorPosition(int SessionID, TABSKeyPath* Position);
bool __fastcall GetPosition(int SessionID, bool Restart, bool GoForward, TABSKeyPath* Position);
public:
__fastcall TABSBTreeRecordIndex(Absbaseengine::TABSBaseIndexManager* aIndexManager);
__fastcall virtual ~TABSBTreeRecordIndex(void);
virtual void __fastcall CreateIndex(Absbase::TABSCursor* Cursor, Absbase::TABSIndexDef* aIndexDef);
virtual void __fastcall DropIndex(int SessionID);
virtual void __fastcall EmptyIndex(int SessionID);
virtual void __fastcall OpenIndex(Absbase::TABSIndexDef* aIndexDef);
virtual void __fastcall RebuildTemporaryIndex(Absbase::TABSCursor* Cursor);
virtual void __fastcall GetRecordBuffer(int SessionID, Abstypes::TABSNavigationInfo &NavigationInfo, Abstypes::TABSIndexPositionCache* IndexPositionCache, int TableState);
virtual void __fastcall GetClosestRecordBuffer(int SessionID, Abstypes::TABSNavigationInfo &NavigationInfo, Abstypes::TABSIndexPositionCache* IndexPositionCache, int TableState);
virtual System::TObject* __fastcall CreateIndexPosition(void);
virtual void __fastcall FreeIndexPosition(System::TObject* &IndexPosition);
virtual bool __fastcall GetIndexPosition(int SessionID, const Abstypes::TABSPageItemID &RecordID, char * RecordBuffer, System::TObject* IndexPosition);
virtual int __fastcall CompareRecordPositionsInIndex(System::TObject* RecordPosition1, System::TObject* RecordPosition2);
virtual __int64 __fastcall GetRecNoByRecordID(int SessionID, const Abstypes::TABSPageItemID &RecordID, char * RecordBuffer);
virtual Abstypes::TABSPageItemID __fastcall GetRecordIDByRecNo(int SessionID, __int64 RecNo);
virtual void __fastcall ApplyDistinctToRecordBitmap(int SessionID, Absbaseengine::TABSRecordBitmap* Bitmap, int DistinctFieldCount);
virtual void * __fastcall CreateSearchInfo(void);
virtual void __fastcall FreeSearchInfo(void * SearchInfo);
private:
bool __fastcall GetCurrentPosition(int SessionID, bool Restart, bool GoForward, Abstypes::TABSScanSearchCondition* StartScanCondition, char * RecordBuffer, const Abstypes::TABSPageItemID &RecordID, void * SearchInfo);
bool __fastcall GetEndPosition(int SessionID, bool GoForward, Abstypes::TABSScanSearchCondition* StartScanCondition, Abstypes::TABSScanSearchCondition* EndScanCondition, void * SearchInfo);
public:
virtual bool __fastcall FindRecord(int SessionID, bool Restart, bool GoForward, Abstypes::TABSScanSearchCondition* StartScanCondition, Abstypes::TABSScanSearchCondition* EndScanCondition, char * RecordBuffer, Abstypes::TABSPageItemID &RecordID, void * SearchInfo);
virtual int __fastcall CompareRecordBuffersByIndex(char * Buffer1, char * Buffer2, int IndexFieldCount);
virtual int __fastcall CompareConditions(Abstypes::TABSScanSearchCondition* Condition1, Abstypes::TABSScanSearchCondition* Condition2);
virtual __int64 __fastcall GetApproxRangeRecordCount(int SessionID, __int64 TableRecordCount, Abstypes::TABSScanSearchCondition* RangeCondition1, Abstypes::TABSScanSearchCondition* RangeCondition2);
virtual bool __fastcall CanInsertRecord(int SessionID, char * RecordBuffer);
virtual bool __fastcall CanUpdateRecord(int SessionID, char * OldRecordBuffer, char * NewRecordBuffer);
virtual void __fastcall InsertRecord(Absbase::TABSCursor* Cursor);
virtual void __fastcall UpdateRecord(Absbase::TABSCursor* Cursor, bool BeforeNewRecordIsStored);
virtual void __fastcall DeleteRecord(Absbase::TABSCursor* Cursor);
virtual int __fastcall GetMaxEntriesPerPage(void);
virtual void __fastcall GetRecordIDByIndexPosition(int SessionID, System::TObject* IndexPos, Abstypes::TABSPageItemID &RecordID);
__property TABSRecordKeyRef* KeyRef = {read=FKeyRef};
};
class DELPHICLASS TABSBTreePageIndex;
class PASCALIMPLEMENTATION TABSBTreePageIndex : public System::TObject
{
typedef System::TObject inherited;
protected:
int FRootPageNo;
TABSPageKeyRef* FKeyRef;
Abspage::TABSPageManager* LPageManager;
int FMaxRecordsOnPage;
TABSBTreePage* __fastcall AddIndexPage(int SessionID);
TABSBTreePage* __fastcall GetIndexPage(int SessionID, int PageNo);
void __fastcall PutIndexPage(TABSBTreePage* Page);
bool __fastcall GetFirstPosition(int SessionID, TABSKeyPath* Position);
bool __fastcall GetLastPosition(int SessionID, TABSKeyPath* Position);
bool __fastcall GetNextPosition(int SessionID, TABSKeyPath* Position);
bool __fastcall GetPriorPosition(int SessionID, TABSKeyPath* Position);
bool __fastcall GetPosition(int SessionID, int PageNo, TABSKeyPath* Position);
Word __fastcall GetPageValue(int SessionID, TABSKeyPath* Position);
void __fastcall SetPageValue(int SessionID, TABSKeyPath* Position, Word Value);
int __fastcall GetPageNo(int SessionID, TABSKeyPath* Position);
virtual bool __fastcall CanAddNewItem(int OldValue, int NewItemSize) = 0 ;
bool __fastcall FindPageForNewItem(int SessionID, int ItemSize, int &PageNo);
void __fastcall AddPageItem(int SessionID, int ItemSize, int PageNo);
void __fastcall DeletePageItem(int SessionID, int ItemSize, int PageNo, int NewItemCount);
public:
__fastcall TABSBTreePageIndex(Abspage::TABSPageManager* PageManager);
__fastcall virtual ~TABSBTreePageIndex(void);
void __fastcall CreateIndex(int SessionID);
void __fastcall DropIndex(int SessionID);
void __fastcall EmptyIndex(int SessionID);
void __fastcall OpenIndex(int RootPageNo);
__property TABSPageKeyRef* KeyRef = {read=FKeyRef};
__property int RootPageNo = {read=FRootPageNo, nodefault};
};
class DELPHICLASS TABSBTreeRecordPageIndex;
class PASCALIMPLEMENTATION TABSBTreeRecordPageIndex : public TABSBTreePageIndex
{
typedef TABSBTreePageIndex inherited;
private:
int FMaxRecordsOnPage;
Word __fastcall GetPageRecordCount(int SessionID, TABSKeyPath* Position);
protected:
virtual bool __fastcall CanAddNewItem(int OldValue, int NewItemSize);
public:
bool __fastcall FindPageForNewRecord(int SessionID, int &PageNo);
void __fastcall AddRecord(int SessionID, int PageNo, int AddCount = 0x1);
void __fastcall DeleteRecord(int SessionID, int PageNo, int NewItemCount);
bool __fastcall GetFirstRecordPage(int SessionID, int &PageNo);
bool __fastcall GetLastRecordPage(int SessionID, int &PageNo);
bool __fastcall GetNextRecordPage(int SessionID, int CurrentPageNo, int &NextPageNo);
bool __fastcall GetPriorRecordPage(int SessionID, int CurrentPageNo, int &PriorPageNo);
void __fastcall GetRecordByRecNo(int SessionID, __int64 RecNo, int &PageNo, int &RecNoOnPage);
void __fastcall GetRecNoByRecord(int SessionID, int PageNo, int RecNoOnPage, __int64 &RecNo);
void __fastcall Validate(int SessionID, int StoredRecordCount);
__property int MaxRecordsOnPage = {read=FMaxRecordsOnPage, write=FMaxRecordsOnPage, nodefault};
public:
#pragma option push -w-inl
/* TABSBTreePageIndex.Create */ inline __fastcall TABSBTreeRecordPageIndex(Abspage::TABSPageManager* PageManager) : TABSBTreePageIndex(PageManager) { }
#pragma option pop
#pragma option push -w-inl
/* TABSBTreePageIndex.Destroy */ inline __fastcall virtual ~TABSBTreeRecordPageIndex(void) { }
#pragma option pop
};
class DELPHICLASS TABSBTreeBlobPageIndex;
class PASCALIMPLEMENTATION TABSBTreeBlobPageIndex : public TABSBTreePageIndex
{
typedef TABSBTreePageIndex inherited;
protected:
virtual bool __fastcall CanAddNewItem(int OldValue, int NewItemSize);
public:
bool __fastcall FindPageForNewBlob(int SessionID, int BlobSize, int &PageNo);
void __fastcall AddBlob(int SessionID, int BlobSize, int PageNo);
void __fastcall DeleteBlob(int SessionID, int BlobSize, int PageNo);
int __fastcall GetBlobPageAllocatedSpace(int SessionID, int PageNo);
public:
#pragma option push -w-inl
/* TABSBTreePageIndex.Create */ inline __fastcall TABSBTreeBlobPageIndex(Abspage::TABSPageManager* PageManager) : TABSBTreePageIndex(PageManager) { }
#pragma option pop
#pragma option push -w-inl
/* TABSBTreePageIndex.Destroy */ inline __fastcall virtual ~TABSBTreeBlobPageIndex(void) { }
#pragma option pop
};
//-- var, const, procedure ---------------------------------------------------
} /* namespace Absbtree */
using namespace Absbtree;
#pragma pack(pop)
#pragma option pop
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // Absbtree
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -