本文整理汇总了C++中MakeKey函数的典型用法代码示例。如果您正苦于以下问题:C++ MakeKey函数的具体用法?C++ MakeKey怎么用?C++ MakeKey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MakeKey函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: MakeKey
std::vector<float> LexicalReorderingTableCompact::GetScore(const Phrase& f,
const Phrase& e,
const Phrase& c)
{
std::string key;
Scores scores;
if(0 == c.GetSize())
key = MakeKey(f, e, c);
else
for(size_t i = 0; i <= c.GetSize(); ++i)
{
Phrase sub_c(c.GetSubString(WordsRange(i,c.GetSize()-1)));
key = MakeKey(f,e,sub_c);
}
size_t index = m_hash[key];
if(m_hash.GetSize() != index)
{
std::string scoresString;
if(m_inMemory)
scoresString = m_scoresMemory[index];
else
scoresString = m_scoresMapped[index];
BitWrapper<> bitStream(scoresString);
for(size_t i = 0; i < m_numScoreComponent; i++)
scores.push_back(m_scoreTrees[m_multipleScoreTrees ? i : 0]->Read(bitStream));
return scores;
}
return Scores();
}
开发者ID:Avmb,项目名称:mosesdecoder,代码行数:34,代码来源:LexicalReorderingTableCompact.cpp
示例2: MakeKey
std::vector<float> LexicalReorderingTableMemory::GetScore(const Phrase& f,
const Phrase& e,
const Phrase& c)
{
//rather complicated because of const can't use []... as [] might enter new things into std::map
//also can't have to be careful with words range if c is empty can't use c.GetSize()-1 will underflow and be large
TableType::const_iterator r;
std::string key;
if(0 == c.GetSize()) {
key = MakeKey(f,e,c);
r = m_Table.find(key);
if(m_Table.end() != r) {
return r->second;
}
} else {
//right try from large to smaller context
for(size_t i = 0; i <= c.GetSize(); ++i) {
Phrase sub_c(c.GetSubString(WordsRange(i,c.GetSize()-1)));
key = MakeKey(f,e,sub_c);
r = m_Table.find(key);
if(m_Table.end() != r) {
return r->second;
}
}
}
return Scores();
}
开发者ID:lolobaro,项目名称:mosesdecoder-stackrescore,代码行数:27,代码来源:LexicalReorderingTable.cpp
示例3: UInt
bool DisplayPostProcess::CreateFromLuaConfig(CreateInfoRef _rInfo)
{
LuaObjectRef rLuaObject = *_rInfo.m_pLuaObject;
LuaObject oRenderTargets = rLuaObject["render_targets"];
const UInt uRTCount = UInt(oRenderTargets.GetCount());
string strMaterialName;
Scripting::Lua::Get(rLuaObject, "name", m_strName, m_strName);
Scripting::Lua::Get(rLuaObject, "immediate_write", m_bImmediateWrite, m_bImmediateWrite);
Scripting::Lua::Get(rLuaObject, "material", strMaterialName, strMaterialName);
m_uMaterialNameKey = MakeKey(strMaterialName);
bool bResult = true;
if (false != bResult)
{
if (0 < uRTCount)
{
m_vRTTypes.resize(uRTCount);
m_vRTNames.resize(uRTCount);
m_vRTIndexes.resize(uRTCount);
for (UInt i = 0 ; uRTCount > i ; ++i)
{
LuaObject oRenderTarget = oRenderTargets[i + 1];
const string strRTType = oRenderTarget["type"].GetString();
const Key uRTTypeKey = MakeKey(strRTType);
if (s_uTypeTex2DKey == uRTTypeKey)
{
const UInt uRTIndex = UInt(oRenderTarget["index"].GetInteger());
const string strRTName = oRenderTarget["name"].GetString();
const Key uRTNameKey = MakeKey(strRTName);
DisplayTexturePtr pTexture = m_rDisplay.GetTextureManager()->Get(uRTNameKey);
m_mTextures[uRTNameKey] = pTexture;
bResult = (NULL != pTexture);
m_vRTTypes[i] = uRTTypeKey;
m_vRTNames[i] = uRTNameKey;
m_vRTIndexes[i] = uRTIndex;
}
else if (s_uTypeGBufferKey == uRTTypeKey)
{
const UInt uRTIndex = UInt(oRenderTarget["index"].GetInteger());
m_vRTTypes[i] = uRTTypeKey;
m_vRTNames[i] = uRTIndex;
m_vRTIndexes[i] = uRTIndex;
}
if (false == bResult)
{
break;
}
}
}
}
return bResult;
}
开发者ID:mentaldease,项目名称:bastionlandscape,代码行数:55,代码来源:PostProcess.cpp
示例4: GetSocketNode
TSocketNode* CMainCtrl::GetSocketNode(unsigned int unClientIP, unsigned short usClientPort,char* szSrcMQ)
{
char szKey[1024];
ssize_t iKeyLen = (ssize_t)MakeKey(unClientIP,usClientPort,szSrcMQ,szKey);
ssize_t iObjIdx = -1;
return (TSocketNode*)m_stSocketNodeHash.GetObjectByKey((void *)szKey,iKeyLen,iObjIdx);
}
开发者ID:yafngzh,项目名称:easyMq,代码行数:7,代码来源:mainctrl.cpp
示例5: CalcFreqs
unsigned int SummaryCommand :: CalcFreqs() {
mFreqMap.clear();
unsigned int mode = 0;
for ( unsigned int i = 0; i < mRows.size(); i++ ) {
string key = MakeKey( mRows.at(i) );
FreqMap::iterator it = mFreqMap.find( key );
if ( it == mFreqMap.end() ) {
mFreqMap.insert( std::make_pair( key, FreqMapEntry( i )));
if ( mode == 0 ) {
mode = 1;
}
}
else {
it->second.mFreq++;
it->second.mIndex.push_back( i );
if ( mode < it->second.mFreq ) {
mode = it->second.mFreq ;
}
}
}
return mode;
}
开发者ID:bminossi,项目名称:csvfix,代码行数:25,代码来源:csved_sum.cpp
示例6: MakeKey
DisplaySurfacePtr DisplaySurfaceManager::Get(const string& _strName)
{
const Key uKey = MakeKey(_strName);
DisplaySurfacePtrMap::iterator iPair = m_mSurfaces.find(uKey);
DisplaySurfacePtr pResult = (m_mSurfaces.end() != iPair) ? iPair->second : NULL;
return pResult;
}
开发者ID:mentaldease,项目名称:bastionlandscape,代码行数:7,代码来源:Surface.cpp
示例7: InitBuckets
int FName::NameManager::FindName (const char *text, bool noCreate)
{
if (!Inited)
{
InitBuckets ();
}
if (text == NULL)
{
return 0;
}
unsigned int hash = MakeKey (text);
unsigned int bucket = hash % HASH_SIZE;
int scanner = Buckets[bucket];
// See if the name already exists.
while (scanner >= 0)
{
if (NameArray[scanner].Hash == hash && stricmp (NameArray[scanner].Text, text) == 0)
{
return scanner;
}
scanner = NameArray[scanner].NextHash;
}
// If we get here, then the name does not exist.
if (noCreate)
{
return 0;
}
return AddName (text, hash, bucket);
}
开发者ID:Edward850,项目名称:zdoom,代码行数:34,代码来源:name.cpp
示例8: WriteJoinRows
void JoinCommand :: WriteJoinRows( IOManager & io, const CSVRow & row ) {
string key = MakeKey( row, true );
MapType::const_iterator pos = mRowMap.lower_bound( key );
MapType::const_iterator last = mRowMap.upper_bound( key );
if ( mOuterJoin && pos == last ) {
io.WriteRow( row );
}
else if ( mInvert ) {
if ( pos == last ) {
io.WriteRow( row );
}
return;
}
else {
while( pos != last ) {
const CSVRow & jr = pos->second;
CSVRow newrow = row;
for ( unsigned int i = 0; i < jr.size(); i++ ) {
newrow.push_back( jr[i] );
}
io.WriteRow( newrow );
++pos;
}
}
}
开发者ID:bminossi,项目名称:csvfix,代码行数:28,代码来源:csved_join.cpp
示例9: DesEncrypt
static void
DesEncrypt( u_char *clear, /* IN 8 octets */
u_char *key, /* IN 7 octets */
u_char *cipher /* OUT 8 octets */)
{
u_char des_key[8];
u_char crypt_key[66];
u_char des_input[66];
MakeKey(key, des_key);
Expand(des_key, crypt_key);
setkey((char*)crypt_key);
#if 0
CHAPDEBUG(LOG_INFO, ("DesEncrypt: 8 octet input : %02X%02X%02X%02X%02X%02X%02X%02X\n",
clear[0], clear[1], clear[2], clear[3], clear[4], clear[5], clear[6], clear[7]));
#endif
Expand(clear, des_input);
encrypt((char*)des_input, 0);
Collapse(des_input, cipher);
#if 0
CHAPDEBUG(LOG_INFO, ("DesEncrypt: 8 octet output: %02X%02X%02X%02X%02X%02X%02X%02X\n",
cipher[0], cipher[1], cipher[2], cipher[3], cipher[4], cipher[5], cipher[6], cipher[7]));
#endif
}
开发者ID:KonstantinVoip,项目名称:mSdk,代码行数:28,代码来源:chpms.c
示例10: MakeKey
BOOL CVqf::SetField(char id1,char id2,char id3,char id4,const unsigned char *szData,DWORD dwSize)
{
DWORD id = MakeKey(id1,id2,id3,id4);
m_fields.erase(id);
if(dwSize == 0)
{
return TRUE;
}
//mapに追加
m_fields.insert(pair<DWORD,CVqfTag>(id,CVqfTag()));
map<DWORD,CVqfTag>::iterator p = m_fields.find(id);
if(p != m_fields.end())
{
p->second.SetData(szData,dwSize);
unsigned char *data = p->second.GetData();
if(!data)
{
//空のフィールドは作らない
m_fields.erase(id);
}
}
else
{
return FALSE;
}
return TRUE;
}
开发者ID:iskwa,项目名称:mm_STEP_M,代码行数:29,代码来源:Vqf.cpp
示例11: memset
void FWadCollection::InitHashChains (void)
{
char name[8];
unsigned int i, j;
// Mark all buckets as empty
memset (FirstLumpIndex, 255, NumLumps*sizeof(FirstLumpIndex[0]));
memset (NextLumpIndex, 255, NumLumps*sizeof(NextLumpIndex[0]));
memset (FirstLumpIndex_FullName, 255, NumLumps*sizeof(FirstLumpIndex_FullName[0]));
memset (NextLumpIndex_FullName, 255, NumLumps*sizeof(NextLumpIndex_FullName[0]));
// Now set up the chains
for (i = 0; i < (unsigned)NumLumps; i++)
{
uppercopy (name, LumpInfo[i].lump->Name);
j = LumpNameHash (name) % NumLumps;
NextLumpIndex[i] = FirstLumpIndex[j];
FirstLumpIndex[j] = i;
// Do the same for the full paths
if (LumpInfo[i].lump->FullName.IsNotEmpty())
{
j = MakeKey(LumpInfo[i].lump->FullName) % NumLumps;
NextLumpIndex_FullName[i] = FirstLumpIndex_FullName[j];
FirstLumpIndex_FullName[j] = i;
}
}
}
开发者ID:emileb,项目名称:gzdoom,代码行数:28,代码来源:w_wad.cpp
示例12: DesEncrypt
static void DesEncrypt(
u_char *clear, /* IN 8 octets */
u_char *key, /* IN 7 octets */
u_char *cipher /* OUT 8 octets */
)
{
des_cblock des_key;
des_key_schedule key_schedule;
MakeKey(key, des_key);
des_set_key(&des_key, key_schedule);
#if 0
CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet input : %02X%02X%02X%02X%02X%02X%02X%02X\n",
clear[0], clear[1], clear[2], clear[3], clear[4], clear[5], clear[6], clear[7]));
#endif
des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
#if 0
CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet output: %02X%02X%02X%02X%02X%02X%02X%02X\n",
cipher[0], cipher[1], cipher[2], cipher[3], cipher[4], cipher[5], cipher[6], cipher[7]));
#endif
}
开发者ID:BlueSkyGjj,项目名称:nRF52,代码行数:25,代码来源:chpms.c
示例13: MakeKey
//创建频道对象
int32_t CChannelMgt::CreateChannel(const ChannelID channelID, ChannelPool::CIndex*& pIndex)
{
//创建对象
pIndex = m_channelPool.CreateObject();
if (NULL == pIndex)
{
return E_RS_CREATECHANNEL;
}
//建立索引
ChannelList::Key key = MakeKey(channelID);
ChannelList::CIndex* pListIndex = m_channelList.Insert(key, pIndex->Index());
if (NULL == pListIndex)
{
m_channelPool.DestroyObject(pIndex);
pIndex = NULL;
return E_RS_CREATECHANNELINDEX;
}
//将索引保存到附加数据表中
int32_t ret = pIndex->SetAdditionalData(enmAdditionalIndex_HashListIndex, (uint32_t)pListIndex->Index());
if (0 > ret)
{
m_channelList.Erase(pListIndex);
m_channelPool.DestroyObject(pIndex);
pIndex = NULL;
return ret;
}
return S_OK;
}
开发者ID:brianserv,项目名称:roomserver,代码行数:32,代码来源:channel_mgt.cpp
示例14: MakeKey
int ConfigFile::ValueHandler(void* user, const char* section, const char* name, const char* value)
{
ConfigFile* reader = (ConfigFile*)user;
// Add the value to the lookup map
std::string key = MakeKey(section, name);
if (reader->Values[key].size() > 0)
reader->Values[key] += "\n";
reader->Values[key] += value;
// Insert the section in the sections set
reader->Sections.insert(section);
// Add the value to the values set
std::string sectionKey = section;
std::transform(sectionKey.begin(), sectionKey.end(), sectionKey.begin(), ::tolower);
std::set<std::string>* fieldsSet;
std::map<std::string, std::set<std::string>*>::iterator fieldSetIt = reader->Fields.find(sectionKey);
if (fieldSetIt == reader->Fields.end())
{
fieldsSet = new std::set<std::string>();
reader->Fields.insert(std::pair<std::string, std::set<std::string>*>(sectionKey, fieldsSet));
}
else {
fieldsSet = fieldSetIt->second;
}
fieldsSet->insert(name);
return 1;
}
开发者ID:piaoasd123,项目名称:ServerTest,代码行数:31,代码来源:Config.cpp
示例15: MakeKey
bool CChannel::IsRoomInChannel(const RoomIndex nRoomIndex)
{
RoomIndexList::Key key = MakeKey(nRoomIndex);
RoomIndexList::CIndex *pIndex = m_sRoomIndexList.Find(key);
return NULL == pIndex;
}
开发者ID:brianserv,项目名称:roomserver,代码行数:7,代码来源:dal_channel.cpp
示例16: FindCell
bool FindCell(int x, int y) const
{
int theX = (x + m_width) % m_width;
int theY = (y + m_height) % m_height;
const auto& it = m_cellMap.find(MakeKey(theX, theY));
return it != m_cellMap.end();
}
开发者ID:spacecatprime,项目名称:dump,代码行数:7,代码来源:sparselife.cpp
示例17: int
FTextureID FTextureManager::AddTexture (FTexture *texture)
{
int bucket;
int hash;
if (texture == NULL) return FTextureID(-1);
// Later textures take precedence over earlier ones
// Textures without name can't be looked for
if (texture->Name[0] != 0)
{
bucket = int(MakeKey (texture->Name) % HASH_SIZE);
hash = HashFirst[bucket];
}
else
{
bucket = -1;
hash = -1;
}
TextureHash hasher = { texture, hash };
int trans = Textures.Push (hasher);
Translation.Push (trans);
if (bucket >= 0) HashFirst[bucket] = trans;
return (texture->id = FTextureID(trans));
}
开发者ID:JohnnyonFlame,项目名称:ecwolf,代码行数:27,代码来源:texturemanager.cpp
示例18: MakeKey
// Find a string by name. pentry1 is a pointer to a pointer to it, and entry1 is a
// pointer to it. Return NULL for entry1 if it wasn't found.
void FStringTable::FindString (const char *name, StringEntry **&pentry1, StringEntry *&entry1)
{
DWORD bucket = MakeKey (name) & (HASH_SIZE - 1);
StringEntry **pentry = &Buckets[bucket], *entry = *pentry;
while (entry != NULL)
{
int cmpval = stricmp (entry->Name, name);
if (cmpval == 0)
{
pentry1 = pentry;
entry1 = entry;
return;
}
if (cmpval == 1)
{
pentry1 = pentry;
entry1 = NULL;
return;
}
pentry = &entry->Next;
entry = *pentry;
}
pentry1 = pentry;
entry1 = entry;
}
开发者ID:Xeomuz,项目名称:Doom-Port-Source-Code,代码行数:28,代码来源:stringtable.cpp
示例19: MakeKey
OpenSSLKeyPair* OpenSSLKeyPair::Generate() {
EVP_PKEY* pkey = MakeKey();
if (!pkey) {
LogSSLErrors("Generating key pair");
return NULL;
}
return new OpenSSLKeyPair(pkey);
}
开发者ID:Abhi347,项目名称:s3eTxmpp,代码行数:8,代码来源:opensslidentity.cpp
示例20: MakeKey
int INIReader::ValueHandler(void* user, const char* section, const char* name, const char* value)
{
INIReader* reader = (INIReader*)user;
std::string key = MakeKey(section, name);
if (reader->_values[key].size() > 0)
reader->_values[key] += "\n";
reader->_values[key] += value;
return 1;
}
开发者ID:tantaishan,项目名称:MyEcho,代码行数:9,代码来源:INIReader.cpp
注:本文中的MakeKey函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论