/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: RefHash2KeysTableOf.c 679340 2008-07-24 10:28:29Z borisk $
*/
// ---------------------------------------------------------------------------
// Include
// ---------------------------------------------------------------------------
#if defined(XERCES_TMPLSINC)
#include <xercesc/util/RefHash2KeysTableOf.hpp>
#endif
#include <xercesc/util/Janitor.hpp>
#include <xercesc/util/NullPointerException.hpp>
#include <assert.h>
#include <new>
XERCES_CPP_NAMESPACE_BEGIN
// ---------------------------------------------------------------------------
// RefHash2KeysTableOf: Constructors and Destructor
// ---------------------------------------------------------------------------
template <class TVal, class THasher>
RefHash2KeysTableOf<TVal, THasher>::RefHash2KeysTableOf(
const XMLSize_t modulus,
MemoryManager* const manager)
: fMemoryManager(manager)
, fAdoptedElems(true)
, fBucketList(0)
, fHashModulus(modulus)
, fCount(0)
{
initialize(modulus);
}
template <class TVal, class THasher>
RefHash2KeysTableOf<TVal, THasher>::RefHash2KeysTableOf(
const XMLSize_t modulus,
const THasher& hasher,
MemoryManager* const manager)
: fMemoryManager(manager)
, fAdoptedElems(true)
, fBucketList(0)
, fHashModulus(modulus)
, fCount(0)
, fHasher (hasher)
{
initialize(modulus);
}
template <class TVal, class THasher>
RefHash2KeysTableOf<TVal, THasher>::RefHash2KeysTableOf(
const XMLSize_t modulus,
const bool adoptElems,
MemoryManager* const manager)
: fMemoryManager(manager)
, fAdoptedElems(adoptElems)
, fBucketList(0)
, fHashModulus(modulus)
, fCount(0)
{
initialize(modulus);
}
template <class TVal, class THasher>
RefHash2KeysTableOf<TVal, THasher>::RefHash2KeysTableOf(
const XMLSize_t modulus,
const bool adoptElems,
const THasher& hasher,
MemoryManager* const manager)
: fMemoryManager(manager)
, fAdoptedElems(adoptElems)
, fBucketList(0)
, fHashModulus(modulus)
, fCount(0)
, fHasher (hasher)
{
initialize(modulus);
}
template <class TVal, class THasher>
void RefHash2KeysTableOf<TVal, THasher>::initialize(const XMLSize_t modulus)
{
if (modulus == 0)
ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager);
// Allocate the bucket list and zero them
fBucketList = (RefHash2KeysTableBucketElem<TVal>**) fMemoryManager->allocate
(
fHashModulus * sizeof(RefHash2KeysTableBucketElem<TVal>*)
); //new RefHash2KeysTableBucketElem<TVal>*[fHashModulus];
memset(fBucketList, 0, sizeof(fBucketList[0]) * fHashModulus);
}
template <class TVal, class THasher>
RefHash2KeysTableOf<TVal, THasher>::~RefHash2KeysTableOf()
{
removeAll();
// Then delete the bucket list & hasher
fMemoryManager->deallocate(fBucketList); //delete [] fBucketList;
fBucketList = 0;
}
// ---------------------------------------------------------------------------
// RefHash2KeysTableOf: Element management
// ---------------------------------------------------------------------------
template <class TVal, class THasher>
bool RefHash2KeysTableOf<TVal, THasher>::isEmpty() const
{
return (fCount==0);
}
template <class TVal, class THasher>
bool RefHash2KeysTableOf<TVal, THasher>::
containsKey(const void* const key1, const int key2) const
{
XMLSize_t hashVal;
const RefHash2KeysTableBucketElem<TVal>* findIt = findBucketElem(key1, key2, hashVal);
return (findIt != 0);
}
template <class TVal, class THasher>
void RefHash2KeysTableOf<TVal, THasher>::
removeKey(const void* const key1, const int key2)
{
// Hash the key
XMLSize_t hashVal = fHasher.getHashVal(key1, fHashModulus);
assert(hashVal < fHashModulus);
//
// Search the given bucket for this key. Keep up with the previous
// element so we can patch around it.
//
RefHash2KeysTableBucketElem<TVal>* curElem = fBucketList[hashVal];
RefHash2KeysTableBucketElem<TVal>* lastElem = 0;
while (curElem)
{
if((key2==curElem->fKey2) && (fHasher.equals(key1, curElem->fKey1)))
{
if (!lastElem)
{
// It was the first in the bucket
fBucketList[hashVal] = curElem->fNext;
}
else
{
// Patch around the current element
lastElem->fNext = curElem->fNext;
}
// If we adopted the elements, then delete the data
if (fAdoptedElems)
delete curElem->fData;
// Delete the current element
// delete curElem;
// destructor is empty...
// curElem->~RefHash2KeysTableBucketElem();
fMemoryManager->deallocate(curElem);
fCount--;
return;
}
// Move both pointers upwards
lastElem = curElem;
curElem = curElem->fNext;
}
// We never found that key
ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::HshTbl_NoSuchKeyExists, fMemoryManager);
}
template <class TVal, class THasher>
void RefHash2KeysTableOf<TVal, THasher>::
removeKey(const void* const key1)
{
// Hash the key
XMLSize_t hashVal = fHasher.getHashVal(key1, fHashModulus);
assert(hashVal < fHashModulus);
//
// Search the given bucket for this key. Keep up with the previous
// element so we can patch around it.
//
RefHash2KeysTableBucketElem<TVal>* curElem = fBucketList[hashVal];
RefHash2KeysTableBucketElem<TVal>* lastElem = 0;
while (curElem)
{
if(fHasher.equals(key1, curElem->fKey1))
{
if (!lastElem)
{
// It was the first in the bucket
fBucketList[hashVal] = curElem->fNext;
}
else
{
// Patch around the current element
lastElem->fNext = curElem->fNext;
}
// If we adopted the elements, then delete the data
if (fAdoptedElems)
delete curElem->fData;
RefHash2KeysTableBucketElem<TVal>* toBeDeleted=curElem;
curElem = curElem->fNext;
// Delete the current element
// delete curElem;
// destructor is empty...
// curElem->~RefHash2KeysTableBucketElem();
fMemoryManager->deallocate(toBeDeleted);
fCount--;
}
else
{
// Move both pointers upwards
lastElem = curElem;
curElem = curElem->fNext;
}
}
}
template <class TVal, class THasher>
void RefHash2KeysTableOf<TVal, THasher>::removeAll()
{
if(isEmpty())
return;
// Clean up the buckets first
for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++)
{
// Get the bucket list head for this entry
RefHash2KeysTableBucketElem<TVal>* curElem = fBucketList[buckInd];
RefHash2KeysTableBucketElem<TVal>* nextElem;
while (curElem)
{
// Save the next element before we hose this one
nextElem = curElem->fNext;
// If we adopted the data, t
没有合适的资源?快使用搜索试试~ 我知道了~
GIS-UE-GDAL-空间数据库-连接查询-代码插件-RTSV2308241700
共2000个文件
h:1496个
hpp:464个
c:23个
需积分: 0 5 下载量 104 浏览量
2023-08-26
23:19:16
上传
评论
收藏 72.53MB ZIP 举报
温馨提示
基于GDAL连接多型(包文件型)GIS空间数据库(开源),查询矢量。 可(展望)用于GIS数字孪生App下矢量数据导入成库、局部更新,同时自动生成本地缓存(UEMesh)(详见三方) 详见博文:《UE5下GDAL连接GIS空间库_基本思路_代码插件》 https://blog.csdn.net/siutna/article/details/132516295
资源推荐
资源详情
资源评论
收起资源包目录
GIS-UE-GDAL-空间数据库-连接查询-代码插件-RTSV2308241700 (2000个子文件)
RefHash2KeysTableOf.c 21KB
RefHashTableOf.c 19KB
RefHash3KeysIdPool.c 18KB
Hash2KeysSetOf.c 17KB
ValueHashTableOf.c 15KB
DOMDeepNodeListPool.c 15KB
BaseRefVectorOf.c 10KB
NameIdPool.c 9KB
ValueVectorOf.c 9KB
LogicalPath.c 8KB
RefArrayOf.c 8KB
ValueArrayOf.c 7KB
RefStackOf.c 5KB
Janitor.c 5KB
ValueStackOf.c 4KB
XSNamedMap.c 4KB
RefArrayVectorOf.c 4KB
KeyRefPair.c 3KB
KeyValuePair.c 3KB
TransENameMap.c 3KB
CountedPointer.c 3KB
FlagJanitor.c 2KB
RefVectorOf.c 2KB
O_RGPG_Feat.cpp 9KB
O_RGPG_Featst.cpp 3KB
O_RGPG_Flocvr.cpp 3KB
O_RSGDPG_Conetr.cpp 2KB
RSGDAL.cpp 2KB
O_RGPG_Dsrc.cpp 1KB
CpNsEy.cpp 189B
O_RSGD_PGISr.cpp 110B
O_RGPG_GePy.cpp 109B
O_RGPG_GeLn.cpp 109B
O_RGPG_GePt.cpp 109B
O_RGPG_Dbsp.cpp 109B
O_RGPG_Geom.cpp 109B
UORSGDr.cpp 105B
ORSGDr.cpp 104B
CpNsEyGameModeBase.cpp 91B
SIP_RSGDPG_Conn.cpp 33B
sqlite3.h 404KB
sqlite3.h 404KB
mapaxisorder.h 318KB
freetype.h 244KB
UnicodeDecompTables.h 235KB
safestack.h 180KB
png.h 149KB
obj_mac.h 133KB
mapserver.h 126KB
NameToUnicodeTable.h 119KB
gg_advanced.h 117KB
cairo.h 107KB
ssl.h 101KB
H5overflow.h 98KB
curl.h 85KB
tttypes.h 85KB
psi.h 84KB
ftimage.h 81KB
ftobjs.h 78KB
jisx0208.h 73KB
H5private.h 71KB
H5Tpkg.h 71KB
ogr_geometry.h 70KB
my_uctype.h 68KB
gg_core.h 66KB
UnicodeCClassTables.h 65KB
geos_c.h 63KB
gdal_priv.h 61KB
ttnameid.h 60KB
ftcache.h 59KB
netcdf.h 59KB
gg_formats.h 59KB
UnicodeCompTables.h 57KB
sfnt.h 57KB
gdal.h 56KB
GfxState.h 54KB
openjpeg.h 52KB
spatialite.h 52KB
evp.h 52KB
hdfi.h 51KB
ftoption.h 51KB
asn1.h 51KB
vrtdataset.h 47KB
ec.h 45KB
ogr_srs_api.h 45KB
jpeglib.h 45KB
H5Cprivate.h 45KB
x509.h 44KB
pngconf.h 44KB
cpl_port.h 44KB
pixman.h 44KB
Annot.h 43KB
H5HFpkg.h 43KB
mysqld_error.h 42KB
expat.h 41KB
tttables.h 40KB
engine.h 40KB
ftserv.h 39KB
ftglyph.h 39KB
mysql_file.h 38KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
WindRippleTrig
- 粉丝: 3
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功