• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MapSet函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MapSet函数的典型用法代码示例。如果您正苦于以下问题:C++ MapSet函数的具体用法?C++ MapSet怎么用?C++ MapSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MapSet函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MapFind

///////////////////////////////////////////////////////////////
//
// CClientPerfStatLuaTimingImpl::UpdateLuaTiming
//
//
//
///////////////////////////////////////////////////////////////
void CClientPerfStatLuaTimingImpl::UpdateLuaTiming ( CLuaMain* pLuaMain, const char* szEventName, TIMEUS timeUs )
{
    CLuaMainTiming* pLuaMainTiming = MapFind ( AllLuaTiming.LuaMainTimingMap, pLuaMain );
    if ( !pLuaMainTiming )
    {
        MapSet ( AllLuaTiming.LuaMainTimingMap, pLuaMain, CLuaMainTiming() );
        pLuaMainTiming = MapFind ( AllLuaTiming.LuaMainTimingMap, pLuaMain );
    }

    {
        CTiming& acc = pLuaMainTiming->ResourceTiming.s5.acc;
        acc.total_us += timeUs;
    }

    CTimingBlock* pEventTiming = MapFind ( pLuaMainTiming->EventTimingMap, szEventName );
    if ( !pEventTiming )
    {
        MapSet (pLuaMainTiming->EventTimingMap, szEventName, CTimingBlock() );
        pEventTiming = MapFind ( pLuaMainTiming->EventTimingMap, szEventName );
    }

    {
        CTiming& acc = pEventTiming->s5.acc;
        acc.calls++;
        acc.total_us += timeUs;
        acc.max_us = std::max ( acc.max_us, timeUs );
    }
}
开发者ID:Jusonex,项目名称:mtasa-blue,代码行数:35,代码来源:CClientPerfStat.LuaTiming.cpp


示例2: MapRemove

void CEntitySA::SetCollidableWith( CEntity *entity, bool enabled )
{
    CEntitySA *intEnt = dynamic_cast <CEntitySA*> ( entity );

    if ( intEnt == this )
        return;

    // quit if no change
    if ( MapContains( m_disabledColl, intEnt->GetInterface() ) != enabled )
        return;

    if ( enabled )
    {
        MapRemove( m_disabledColl, intEnt->GetInterface() );

        if ( m_disabledColl.empty() )
            MapRemove( pGame->m_disabledColl, this );
    }
    else
    {
        MapSet( m_disabledColl, intEnt->GetInterface(), true );
        MapSet( pGame->m_disabledColl, this, true );
    }

    // Set in the other entity as well
    intEnt->SetCollidableWith( this, enabled );
}
开发者ID:qaisjp,项目名称:green-candy,代码行数:27,代码来源:CEntitySA.cpp


示例3: assert

///////////////////////////////////////////////////////////////
//
// CGameEntityXRefManagerImpl::AddEntityXRef
//
// Add a new reference between a game entity and a client entity
//
///////////////////////////////////////////////////////////////
void CGameEntityXRefManagerImpl::AddEntityXRef ( CClientEntity* pEntity, CEntity* pEntitySA )
{
    CEntitySAInterface* pEntitySAInterface = pEntitySA->GetInterface ();

    assert ( !MapContains ( m_ClientToGameMap, pEntity ) );
    assert ( !MapContains ( m_GameToClientMap, pEntitySA ) );
    assert ( !MapContains ( m_InterfaceToClientMap, pEntitySAInterface ) );

    MapSet ( m_ClientToGameMap, pEntity, pEntitySA );
    MapSet ( m_GameToClientMap, pEntitySA, pEntity );
    MapSet ( m_InterfaceToClientMap, pEntitySAInterface, pEntity );
}
开发者ID:ntauthority,项目名称:openvice,代码行数:19,代码来源:CGameEntityXRefManager.cpp


示例4: MapFindRef

////////////////////////////////////////////////////////////////
//
// CEffectClonerImpl::CreateD3DEffect
//
//
//
////////////////////////////////////////////////////////////////
ID3DXEffect* CEffectClonerImpl::CreateD3DEffect ( const SString& strFilename, const SString& strRootPath, SString& strOutStatus, bool bDebug )
{
    // Do we have a match with the initial path
    CEffectTemplate* pEffectTemplate = MapFindRef ( m_ValidMap, ConformPathForSorting ( strFilename ) );
    if ( pEffectTemplate )
    {
        // Have files changed since create?
        if ( pEffectTemplate->HaveFilesChanged () )
        {
            // EffectTemplate is no good for cloning now, so move it to the old list 
            MapRemove ( m_ValidMap, ConformPathForSorting ( strFilename ) );
            m_OldList.push_back ( pEffectTemplate );
            pEffectTemplate = NULL;
        }
    }

    // Need to create new EffectTemplate?
    if ( !pEffectTemplate )
    {
        pEffectTemplate = NewEffectTemplate ( m_pManager, strFilename, strRootPath, strOutStatus, bDebug );
        if ( !pEffectTemplate->IsValid () )
        {
            SAFE_RELEASE( pEffectTemplate );
            return NULL;
        }

        OutputDebugLine ( SString ( "[Shader] CEffectClonerImpl::CreateD3DEffect - New EffectTemplate for %s", *strFilename ) );
        // Add to active map
        MapSet ( m_ValidMap, ConformPathForSorting ( strFilename ), pEffectTemplate );
    }


    //
    // Now we have a valid EffectTemplate to clone the effect from
    //

    // Clone D3DXEffect
    ID3DXEffect* pNewD3DEffect = pEffectTemplate->CloneD3DEffect ( &strOutStatus );

    if( !pNewD3DEffect )
    {
        if ( strOutStatus.empty () )
            strOutStatus = "Error: Clone failed";
        return NULL;
    }

    // Cross ref clone with original
    MapSet ( m_CloneMap, pNewD3DEffect, pEffectTemplate );

    // Return result
    return pNewD3DEffect;
}
开发者ID:EagleShen,项目名称:MTA,代码行数:59,代码来源:CRenderItem.EffectCloner.cpp


示例5: m_uiJobCountWarnThresh

///////////////////////////////////////////////////////////////
//
// CDatabaseJobQueueImpl::CDatabaseJobQueueImpl
//
// Init known database types and start the job service thread
//
///////////////////////////////////////////////////////////////
CDatabaseJobQueueImpl::CDatabaseJobQueueImpl ( void )
    : m_uiJobCountWarnThresh ( 200 )
    , m_uiConnectionCountWarnThresh ( 20 )
{
    // Add known database types
    CDatabaseType* pDatabaseTypeSqlite = NewDatabaseTypeSqlite ();
    MapSet ( m_DatabaseTypeMap, pDatabaseTypeSqlite->GetDataSourceTag (), pDatabaseTypeSqlite );

    // Add known database types
    CDatabaseType* pDatabaseTypeMySql = NewDatabaseTypeMySql ();
    MapSet ( m_DatabaseTypeMap, pDatabaseTypeMySql->GetDataSourceTag (), pDatabaseTypeMySql );

    // Start the job queue processing thread
    m_pServiceThreadHandle = new CThreadHandle ( CDatabaseJobQueueImpl::StaticThreadProc, this );
}
开发者ID:tousuke,项目名称:mtasa-blue,代码行数:22,代码来源:CDatabaseJobQueue.cpp


示例6: MapSet

//
// CHudSA::InitComponentList
//
void CHudSA::InitComponentList ( void )
{
    SHudComponent componentList[] = {
                { 1, HUD_AMMO, 1, FUNC_DrawAmmo, 1, 0xCC, 0xC3 },
                { 1, HUD_WEAPON, 1, FUNC_DrawWeaponIcon, 1, 0xCC, 0xC3 },
                { 1, HUD_HEALTH, 1, FUNC_PrintHealthForPlayer, 1, 0xCC, 0xC3 },
                { 1, HUD_BREATH, 1, FUNC_PrintBreathForPlayer, 1, 0xCC, 0xC3 },
                { 1, HUD_ARMOUR, 1, FUNC_PrintArmourForPlayer, 1, 0xCC, 0xC3 },
                { 1, HUD_MONEY, 1, CODE_ShowMoney, 2, 0xCCCC, 0xE990 },
                { 1, HUD_VEHICLE_NAME, 1, FUNC_DrawVehicleName, 1, 0xCC, 0xC3 },
                { 1, HUD_AREA_NAME, 1, FUNC_DrawAreaName, 1, 0xCC, 0xC3 },
                { 1, HUD_RADAR, 1, FUNC_DrawRadar, 1, 0xCC, 0xC3 },
                { 1, HUD_CLOCK, 0, VAR_DisableClock, 1, 1, 0 },
                { 1, HUD_RADIO, 1, FUNC_DrawRadioName, 1, 0xCC, 0xC3 },
                { 1, HUD_WANTED, 1, FUNC_DrawWantedLevel, 1, 0xCC, 0xC3 },
                { 1, HUD_CROSSHAIR, 1, FUNC_DrawCrosshair, 1, 0xCC, 0xC3 },
                { 1, HUD_VITAL_STATS, 1, FUNC_DrawVitalStats, 1, 0xCC, 0xC3 },
                { 0, HUD_HELP_TEXT, 1, FUNC_DrawHelpText, 1, 0xCC, 0xC3 },
            };

    for ( uint i = 0 ; i < NUMELMS( componentList ) ; i++ )
    {
        const SHudComponent& component = componentList[i]; 
        MapSet ( m_HudComponentMap, component.type, component );
    }
}
开发者ID:0x688,项目名称:gtasa_crashfix,代码行数:29,代码来源:CHudSA.cpp


示例7: ClearReadCache

bool CAccessControlListManager::CanObjectUseRight ( const char* szObjectName,
                                                    CAccessControlListGroupObject::EObjectType eObjectType,
                                                    const char* szRightName,
                                                    CAccessControlListRight::ERightType eRightType,
                                                    bool bDefaultAccessRight )
{
    // Clear cache if required
    if ( m_bReadCacheDirty )
        ClearReadCache ();

    // If object is resource, try cache
    if ( eObjectType == CAccessControlListGroupObject::OBJECT_TYPE_RESOURCE )
    {
        // Make unique key for this query
        SString strKey ( "%s %s %d %d", szObjectName, szRightName, eRightType, bDefaultAccessRight );
        // Check if this query has been done before
        bool* pResult = MapFind( m_ReadCacheMap, strKey );
        if ( !pResult )
        {
            // If not, do query now and add result to the cache
            bool bResult = InternalCanObjectUseRight ( szObjectName, eObjectType, szRightName, eRightType, bDefaultAccessRight );
            MapSet ( m_ReadCacheMap, strKey, bResult );
            pResult = MapFind( m_ReadCacheMap, strKey );
        }
        // Return cached result
        return *pResult;
    }
    return InternalCanObjectUseRight ( szObjectName, eObjectType, szRightName, eRightType, bDefaultAccessRight );
}
开发者ID:pombredanne,项目名称:openvice,代码行数:29,代码来源:CAccessControlListManager.cpp


示例8: dassert

void CPlayer::MovePlayerToFarList ( CPlayer* pOther )
{
    dassert ( MapContains ( m_NearPlayerList, pOther ) && !MapContains ( m_FarPlayerList, pOther ) );
    SNearInfo* pInfo = MapFind ( m_NearPlayerList, pOther );
    MapSet ( m_FarPlayerList, pOther, *pInfo );
    MapRemove ( m_NearPlayerList, pOther );
}
开发者ID:qaisjp,项目名称:green-candy,代码行数:7,代码来源:CPlayer.cpp


示例9: LokInsert

void LokInsert(LokStruct *Data, LokInfo *Lok)
{  char *Name;
   LokInfo *OldLok;

   Name = LokInfoGetName(Lok);
   if (strlen(Name) > 0)
   {
      OldLok = (LokInfo *)MapGet(LokGetLokDb(Data), (MapKeyType)Name);
      if (OldLok != (LokInfo *)NULL)
      {
         if (!LokIsEqual(OldLok, Lok))
         {
            LokSetIsChanged(Data, TRUE);
            memcpy(OldLok, Lok, sizeof(LokInfo));
         }
         LokInfoSetIsDeleted(OldLok, FALSE);
      }
      else
      {
         OldLok = (LokInfo *)malloc(sizeof(LokInfo));
         if (OldLok != (LokInfo *)NULL)
         {
            LokSetIsChanged(Data, TRUE);
            memcpy(OldLok, Lok, sizeof(LokInfo));
            LokInfoSetIsDeleted(OldLok, FALSE);
            MapSet(LokGetLokDb(Data),
                   (MapKeyType)LokInfoGetName(OldLok),
                   (MapDataType)OldLok);
            LokSetNumLoks(Data, LokGetNumLoks(Data) + 1);
         }
      }
   }
}
开发者ID:GBert,项目名称:railroad,代码行数:33,代码来源:lok.c


示例10: strKey

//
// CFunctionUseLogger::OnFunctionUse
//
void CFunctionUseLogger::OnFunctionUse( lua_State* luaVM, const char* szFunctionName, const char* szArgs, uint uiArgsSize )
{
    if ( m_strLogFilename.empty() )
        return;

    CResource* pResource = g_pGame->GetResourceManager()->GetResourceFromLuaState( luaVM );
    SString strResourceName = pResource ? pResource->GetName() : "Unknown";

    SString strKey( "%s-%s", szFunctionName, *strResourceName );

    SFuncCallRecord* pItem = MapFind( m_FuncCallRecordMap, strKey );
    if ( !pItem )
    {
        // Create new entry for this resource/function combo
        MapSet( m_FuncCallRecordMap, strKey, SFuncCallRecord() );
        pItem = MapFind( m_FuncCallRecordMap, strKey );
        pItem->strFunctionName = szFunctionName;
        pItem->strResourceName = strResourceName;
        pItem->uiCallCount = 0;
        pItem->timeFirstUsed = CTickCount::Now();
    }
    pItem->uiCallCount++;

    if ( pItem->strExampleArgs.empty() )
        pItem->strExampleArgs = SStringX( szArgs ).Left( 40 );
}
开发者ID:pombredanne,项目名称:openvice,代码行数:29,代码来源:CFunctionUseLogger.cpp


示例11: switch

/////////////////////////////////////////////////////////////
//
// CProxyDirect3DVertexDeclaration::CProxyDirect3DVertexDeclaration
//
//
//
/////////////////////////////////////////////////////////////
CProxyDirect3DVertexDeclaration::CProxyDirect3DVertexDeclaration ( IDirect3DDevice9* InD3DDevice9,IDirect3DVertexDeclaration9* pOriginal, CONST D3DVERTEXELEMENT9* pVertexElements )
{
	m_pOriginal = pOriginal;

    CProxyDirect3DDevice9::SD3DVertexDeclState info;

    // Calc and cache info
    for ( uint i = 0 ; i < MAXD3DDECLLENGTH ; i++ )
    {
        const D3DVERTEXELEMENT9& element = pVertexElements[ i ];
        if ( element.Stream == 0xFF )
            break;

        switch ( element.Stream)
        {
            case 0:        info.bUsesStreamAtIndex[0] = true;  break;
            case 1:        info.bUsesStreamAtIndex[1] = true;  break;
        }

        switch ( element.Usage + element.UsageIndex * 16 )
        {
            case D3DDECLUSAGE_POSITION:         info.Position = 1;   break;
            case D3DDECLUSAGE_POSITIONT:        info.PositionT = 1;  break;
            case D3DDECLUSAGE_NORMAL:           info.Normal = 1;     break;
            case D3DDECLUSAGE_COLOR:            info.Color0 = 1;     break;
            case D3DDECLUSAGE_COLOR + 16:       info.Color1 = 1;     break;
            case D3DDECLUSAGE_TEXCOORD:         info.TexCoord0 = 1;  break;
            case D3DDECLUSAGE_TEXCOORD + 16:    info.TexCoord1 = 1;  break;
        }
    }

    // Add to cached info map
    MapSet ( g_pProxyDevice->m_VertexDeclMap, this, info );
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:41,代码来源:CProxyDirect3DVertexDeclaration.cpp


示例12: RemoveData

// Return true if data was changed
bool CAccount::SetData(const std::string& strKey, const std::string& strValue, int iType)
{
    if (strValue == "false" && iType == LUA_TBOOLEAN)
    {
        if (HasData(strKey))
        {
            RemoveData(strKey);
            return true;
        }
    }
    else
    {
        CAccountData* pData = GetDataPointer(strKey);

        if (pData)
        {
            if (pData->GetType() != iType || pData->GetStrValue() != strValue)
            {
                pData->SetStrValue(strValue);
                pData->SetType(iType);
                return true;
            }
        }
        else
        {
            MapSet(m_Data, strKey, CAccountData(strKey, strValue, iType));
            return true;
        }
    }
    return false;
}
开发者ID:Audifire,项目名称:mtasa-blue,代码行数:32,代码来源:CAccount.cpp


示例13: GleisbildInsert

void GleisbildInsert(GleisbildStruct *Data, GleisbildInfo *Gleisbild)
{  int Id;
   GleisbildInfo *OldGleisbild;

   Id = GleisbildInfoGetId(Gleisbild);
   OldGleisbild = (GleisbildInfo *)MapGet(GleisbildGetGleisbildDb(Data),
                                          (MapKeyType)Id);
   if (OldGleisbild != (GleisbildInfo *)NULL)
   {
      GleisbildInfoSetId(OldGleisbild, GleisbildInfoGetId(Gleisbild));
      GleisbildInfoSetName(OldGleisbild, GleisbildInfoGetName(Gleisbild));
      GleisbildInfoSetZustand(OldGleisbild, GleisbildInfoGetZustand(Gleisbild));
   }
   else
   {
      OldGleisbild = (GleisbildInfo *)malloc(sizeof(GleisbildInfo));
      if (OldGleisbild != (GleisbildInfo *)NULL)
      {
         GleisbildInfoSetId(OldGleisbild, GleisbildInfoGetId(Gleisbild));
         GleisbildInfoSetName(OldGleisbild, GleisbildInfoGetName(Gleisbild));
         GleisbildInfoSetZustand(OldGleisbild,
	                         GleisbildInfoGetZustand(Gleisbild));
         MapSet(GleisbildGetGleisbildDb(Data),
                (MapKeyType)Id, (MapDataType)OldGleisbild);
      }
   }
}
开发者ID:GBert,项目名称:railroad,代码行数:27,代码来源:gleisbild.c


示例14: PathJoin

///////////////////////////////////////////////////////////////
//
// CServerIdManagerImpl::LoadServerIdMap
//
// Load server id data from xml file
//
///////////////////////////////////////////////////////////////
bool CServerIdManagerImpl::LoadServerIdMap ( void )
{
    // Load config XML file
    CXMLFile* pConfigFile = g_pCore->GetXML ()->CreateXML ( PathJoin ( g_pClientGame->GetFileCacheRoot(), MTA_SERVERID_LOOKUP_XML ) );
    if ( !pConfigFile )
        return false;
    pConfigFile->Parse ();

    CXMLNode* pRoot = pConfigFile->GetRootNode ();
    if ( !pRoot )
        pRoot = pConfigFile->CreateRootNode ( "root" );

    m_ServerIdMap.clear ();

    // Read each node
    for ( uint i = 0 ; i < pRoot->GetSubNodeCount () ; i++ )
    {
        CXMLNode* pSubNode = pRoot->GetSubNode ( i );

        CServerIdKey key;
        CServerIdInfo info;
        key.strId = pSubNode->GetTagContent ();
        if ( CXMLAttribute* pAttribute = pSubNode->GetAttributes().Find ( "dir" ) )
            info.strDir = pAttribute->GetValue ();

        if ( !info.strDir.empty () )
            MapSet ( m_ServerIdMap, key, info );
    }

    // Maybe one day remove unwanted directories

    delete pConfigFile;
    return true;
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:41,代码来源:CServerIdManager.cpp


示例15: luaM_toref

// Custom Lua stack argument->reference function
CLuaFunctionRef luaM_toref ( lua_State *luaVM, int iArgument )
{
    CLuaMain* pLuaMain = g_pGame->GetLuaManager ()->GetVirtualMachine ( luaVM );
    assert ( pLuaMain );

    const void* pFuncPtr = lua_topointer ( luaVM, iArgument );

    if ( CRefInfo* pInfo = MapFind ( pLuaMain->m_CallbackTable, pFuncPtr ) )
    {
        // Re-use the lua ref we already have to this function
        pInfo->ulUseCount++;
        return CLuaFunctionRef ( luaVM, pInfo->iFunction, pFuncPtr );
    }
    else
    {
        // Get a lua ref to this function
        lua_settop ( luaVM, iArgument );
        int ref = lua_ref ( luaVM, 1 );

        // Save ref info
        CRefInfo info;
        info.ulUseCount = 1;
        info.iFunction = ref;
        MapSet ( pLuaMain->m_CallbackTable, pFuncPtr, info );

        return CLuaFunctionRef ( luaVM, ref, pFuncPtr );
    }
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:29,代码来源:CLuaFunctionRef.cpp


示例16: STexInfo

////////////////////////////////////////////////////////////////
//
// CRenderWareSA::CreateTexInfo
//
//
//
////////////////////////////////////////////////////////////////
STexInfo* CRenderWareSA::CreateTexInfo ( ushort usTxdId, const SString& strTextureName, CD3DDUMMY* pD3DData )
{
    // Create texinfo
    m_TexInfoList.push_back ( STexInfo ( usTxdId, strTextureName, pD3DData ) );
    STexInfo* pTexInfo = &m_TexInfoList.back ();

    // Add to lookup maps
    SString strUniqueKey ( "%d_%s", pTexInfo->usTxdId, *pTexInfo->strTextureName );
    if ( MapContains ( m_UniqueTexInfoMap, strUniqueKey ) )
        AddReportLog ( 5132, SString ( "CreateTexInfo duplicate %s", *strUniqueKey ) );
    MapSet ( m_UniqueTexInfoMap, strUniqueKey, pTexInfo );

	// This assert fails when using engine txd replace functions - TODO find out why
    //assert ( !MapContains ( m_D3DDataTexInfoMap, pTexInfo->pD3DData ) );
    MapSet ( m_D3DDataTexInfoMap, pTexInfo->pD3DData, pTexInfo );
    return pTexInfo;
}
开发者ID:EagleShen,项目名称:MTA,代码行数:24,代码来源:CRenderWareSA.ShaderSupport.cpp


示例17: CDbJobData

///////////////////////////////////////////////////////////////
//
// CDatabaseJobQueueImpl::GetNextJobHandle
//
// Return a new job data object
//
///////////////////////////////////////////////////////////////
CDbJobData* CDatabaseJobQueueImpl::GetNewJobData ( void )
{
    g_pStats->iDbJobDataCount++;
    CDbJobData* pJobData = new CDbJobData ();
    assert ( !MapContains ( m_ActiveJobHandles, pJobData->GetId () ) );
    MapSet ( m_ActiveJobHandles, pJobData->GetId (), pJobData );
    return pJobData;
}
开发者ID:tousuke,项目名称:mtasa-blue,代码行数:15,代码来源:CDatabaseJobQueue.cpp


示例18: OutputDebugLine

void CPlayer::MovePlayerToNearList ( CPlayer* pOther )
{
    OutputDebugLine ( SString ( "[Sync] ++ %s: Move %s to nearlist", GetNick (), pOther->GetNick () ) );

    dassert ( !MapContains ( m_NearPlayerList, pOther ) && MapContains ( m_FarPlayerList, pOther ) );
    SViewerInfo* pInfo = MapFind ( m_FarPlayerList, pOther );
    MapSet ( m_NearPlayerList, pOther, *pInfo );
    MapRemove ( m_FarPlayerList, pOther );
}
开发者ID:pombredanne,项目名称:openvice,代码行数:9,代码来源:CPlayer.cpp


示例19: Error

///////////////////////////////////////////////////////////////
//
// CDatabaseJobQueueImpl::ProcessConnect
//
//
//
///////////////////////////////////////////////////////////////
void CDatabaseJobQueueImpl::ProcessConnect ( CDbJobData* pJobData )
{
    // Determine which type manager to use
    std::vector < SString > parts;
    pJobData->command.strData.Split ( "\1", parts );
    if ( parts.size () < 5 )
    {
        pJobData->result.status = EJobResult::FAIL;
        pJobData->result.strReason = "Internal Error (JobQueueServer:ProcessConnect #1)";
        return;
    }

    CDatabaseType* pTypeManager = MapFindRef ( m_DatabaseTypeMap, parts[0] );
    if ( !pTypeManager )
    {
        pJobData->result.status = EJobResult::FAIL;
        pJobData->result.strReason = "Not valid type";
        return;
    }

    // Get type manager to return a CDatabaseConnection*
    CDatabaseConnection* pConnection = pTypeManager->Connect ( parts[1], parts[2], parts[3], parts[4] );
    if ( !pConnection )
    {
        pJobData->result.status = EJobResult::FAIL;
        pJobData->result.strReason = "Could not connect";
        return;
    }

    if ( !pConnection->IsValid () )
    {
        pJobData->result.status = EJobResult::FAIL;
        pJobData->result.strReason = pConnection->GetLastErrorMessage ();
        pConnection->Release ();
        return;
    }

    // Extract some options
    GetOption < CDbOptionsMap > ( parts[4], "log", pConnection->m_bLoggingEnabled, 0 );
    GetOption < CDbOptionsMap > ( parts[4], "tag", pConnection->m_strLogTag );
    GetOption < CDbOptionsMap > ( parts[4], "suppress", ",", pConnection->m_SuppressedErrorCodes );

    // Only allow error codes to be suppress with mysql, as sqlite only has one error code
    if ( pTypeManager->GetDataSourceTag () != "mysql" )
        pConnection->m_SuppressedErrorCodes.clear ();

    // Associate handle with CDatabaseConnection*
    shared.m_Mutex.Lock();
    MapSet( shared.m_HandleConnectionMap, pJobData->command.connectionHandle, pConnection );
    shared.m_Mutex.Unlock();

    // Set result
    pJobData->result.status = EJobResult::SUCCESS;
}
开发者ID:tousuke,项目名称:mtasa-blue,代码行数:61,代码来源:CDatabaseJobQueue.cpp


示例20: MapFind

///////////////////////////////////////////////////////////////
//
// CClientModelCacheManagerImpl::InsertIntoNeedCacheList
//
// Update model id closest distance
//
///////////////////////////////////////////////////////////////
void CClientModelCacheManagerImpl::InsertIntoNeedCacheList(std::map<ushort, float>& outNeedCacheList, ushort usModelId, float fDistSq)
{
    float* pfDistSqCurrent = MapFind(outNeedCacheList, usModelId);
    if (!pfDistSqCurrent)
    {
        MapSet(outNeedCacheList, usModelId, fDistSq);
        return;
    }
    if (fDistSq < *pfDistSqCurrent)
        *pfDistSqCurrent = fDistSq;
}
开发者ID:Audifire,项目名称:mtasa-blue,代码行数:18,代码来源:CClientModelCacheManager.cpp



注:本文中的MapSet函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MapViewOfFile函数代码示例发布时间:2022-05-30
下一篇:
C++ MapNode函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap