本文整理汇总了C++中GiSTentry::SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ GiSTentry::SetPosition方法的具体用法?C++ GiSTentry::SetPosition怎么用?C++ GiSTentry::SetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GiSTentry
的用法示例。
在下文中一共展示了GiSTentry::SetPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NumEntries
// insert before the original number according to the sequence instead of index
void
MTnode::InsertBefore (const GiSTentry& newEntry, int index)
{
int n = NumEntries ();
assert (index>=0 && index<=n);
BOOL bOrder = TRUE;
if (index > 0) {
bOrder = (*this)[index-1]->Compare(newEntry) <= 0;
}
if (index < n) {
bOrder = bOrder && (*this)[index]->Compare(newEntry) >= 0;
}
if (bOrder) { // yes, the position is right for this entry
GiSTentry *entry = (GiSTentry *) newEntry.Copy ();
entry->SetLevel(Level());
entry->SetPosition(index);
entry->SetNode(this);
// Move everything else over
for (int i=n; i>index; i--) {
GiSTentry *e = (*this)[i-1];
e->SetPosition(i);
(*this)[i] = e;
}
// Stick the entry in
(*this)[index] = entry;
// Bump up the count
SetNumEntries (n+1);
} else {
Insert (newEntry); // find the right place
}
}
示例2: Reset
void
GiSTnode::Unpack(const char *page)
{
const GiSTheader *h = (const GiSTheader *) page;
Reset();
SetLevel(h->level);
SetSibling(h->sibling);
if (!packedNode)
packedNode = new char[tree->Store()->PageSize()];
memcpy(packedNode, page, tree->Store()->PageSize());
Expand(h->numEntries);
SetNumEntries(h->numEntries);
for (int i=0; i<h->numEntries; i++) {
GiSTcompressedEntry tmpentry = Entry(i);
GiSTentry *e = CreateEntry();
e->SetLevel(Level());
e->SetPosition(i);
e->SetNode(this);
e->Decompress(tmpentry);
// be tidy
if (tmpentry.key)
delete tmpentry.key;
// Append the body with the entry
entries[i] = e;
}
}
示例3: NumEntries
void
GiSTnode::InsertBefore (const GiSTentry& entry, int index)
{
assert (index <= NumEntries());
GiSTentry *e = (GiSTentry*)entry.Copy();
e->SetLevel (Level());
e->SetPosition (index);
e->SetNode (this);
// Move everything else over
for (int i=NumEntries(); i>index; i--) {
GiSTentry *e = (*this)[i-1];
e->SetPosition (i);
(*this)[i] = e;
}
// Stick the entry in
(*this)[index] = e;
// Bump up the count
numEntries++;
}