当前位置: 首页>>代码示例>>C++>>正文


C++ utHashTable类代码示例

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


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

示例1: loom_asset_clear

// Clears the asset name cache that is built up
// through loom_asset_lock and others
static void loom_asset_clear()
{
    utHashTableIterator<utHashTable<utHashedString, loom_asset_t *> > assetIterator(gAssetHash);
    while (assetIterator.hasMoreElements())
    {
        utHashedString key = assetIterator.peekNextKey();
        lmDelete(NULL, assetIterator.peekNextValue());
        assetIterator.next();
    }
    gAssetHash.clear();
}
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:13,代码来源:assets.cpp

示例2: lmDefineLogGroup

namespace LS
{
static utHashTable<utFastStringHash, LoomProfilerRoot *> dynamicProfilerRoots;

bool LSProfiler::enabled = false;
utStack<MethodBase *> LSProfiler::methodStack;
utHashTable<utPointerHashKey, LSProfilerTypeAllocation *> LSProfiler::allocations;
utHashTable<utPointerHashKey, MethodAllocation> *LSProfiler::sortMethods = NULL;

lmDefineLogGroup(gProfilerLogGroup, "profiler", 1, LoomLogInfo);

static inline void primeProfiler()
{
    const char       *path = ".......";
    LoomProfilerRoot **prd = dynamicProfilerRoots[path];

    if (prd == NULL)
    {
        dynamicProfilerRoots.insert(path, new LoomProfilerRoot(strdup(path)));
        prd = dynamicProfilerRoots[path];
    }

    gLoomProfiler->hashPush(*prd);
    gLoomProfiler->hashPop(*prd);
}


static inline bool shouldFilterFunction(const char *fullPath)
{
    if (!strncmp(fullPath, "system.Profiler.", 16))
    {
        return true;
    }

    if (!strncmp(fullPath, "system.debugger.", 16))
    {
        return true;
    }

    if (!strncmp(fullPath, "system.BaseDelegate.", 20))
    {
        return true;
    }

    if (!strncmp(fullPath, "system.Coroutine.", 17))
    {
        return true;
    }

    return false;
}


void LSProfiler::getCurrentStack(lua_State *L, utStack<MethodBase *>& stack)
{
    int       top = lua_gettop(L);
    lua_Debug lstack;
    int       stackFrame = 0;

    MethodBase *lastMethod = NULL;

    while (true)
    {
        // if we get a null result here, we are out of stack
        if (!lua_getstack(L, stackFrame++, &lstack))
        {
            lua_settop(L, top);
            return;
        }

        // something bad in denmark
        if (!lua_getinfo(L, "f", &lstack))
        {
            lua_settop(L, top);
            return;
        }

        bool cfunc = false;
        if (lua_iscfunction(L, -1))
        {
            cfunc = true;
        }

        lua_rawgeti(L, LUA_GLOBALSINDEX, LSINDEXMETHODLOOKUP);
        lua_pushvalue(L, -2);
        lua_rawget(L, -2);

        if (lua_isnil(L, -1))
        {
            lua_settop(L, top);
            continue;
        }

        MethodBase *methodBase = (MethodBase *)lua_topointer(L, -1);

        lua_settop(L, top);

#ifdef LOOM_ENABLE_JIT
        // We do not receive line return hooks for native calls under JIT :(
        // So, don't add to initial stack
//.........这里部分代码省略.........
开发者ID:abukosek,项目名称:LoomSDK,代码行数:101,代码来源:lsProfiler.cpp

示例3: loom_asset_registerType

void loom_asset_registerType(unsigned int type, LoomAssetDeserializeCallback deserializer, LoomAssetRecognizerCallback recognizer)
{
    lmAssert(gAssetDeserializerMap.find(type) == UT_NPOS, "Asset type already registered!");

    gAssetDeserializerMap.insert(type, deserializer);
    gRecognizerList.push_back(recognizer);
}
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:7,代码来源:assets.cpp

示例4: lmNew

static loom_asset_t *loom_asset_getAssetByName(const char *name, int create)
{
    utHashedString key        = platform_normalizePath(name);
    loom_asset_t   **assetPtr = gAssetHash.get(key);
    loom_asset_t   *asset     = assetPtr ? *assetPtr : NULL;

    if ((asset == NULL) && create)
    {
        // Create one.
        asset       = lmNew(gAssetAllocator) loom_asset_t;
        asset->name = strdup(name);
        gAssetHash.insert(key, asset);
    }

    return asset;
}
开发者ID:Bewolf2,项目名称:LoomSDK,代码行数:16,代码来源:assets.cpp

示例5: loom_asset_initialize

void loom_asset_initialize(const char *rootUri)
{
    // Set up the lock for the mutex.
    lmAssert(gAssetLock == NULL, "Double initialization!");
    gAssetLock = loom_mutex_create();

    // Note the CWD.
    char tmpBuff[1024];
    platform_getCurrentWorkingDir(tmpBuff, 1024);
    lmLog(gAssetLogGroup, "Current working directory ='%s'", tmpBuff);

    // And the allocator.
    //gAssetAllocator = loom_allocator_initializeTrackerProxyAllocator(loom_allocator_getGlobalHeap());
    gAssetAllocator = (loom_allocator_getGlobalHeap());

    // Clear, it might have been filled up before (for unit tests)
    gAssetLoadQueue.clear();
    gAssetHash.clear();

    // Asset server connection state.
    gAssetServerSocketLock = loom_mutex_create();

    // And set up some default asset types.
    loom_asset_registerType(LATText, loom_asset_textDeserializer, loom_asset_textRecognizer);
    loom_asset_registerType(LATBinary, loom_asset_binaryDeserializer, loom_asset_binaryRecognizer);

    loom_asset_registerImageAsset();
    loom_asset_registerSoundAsset();
    loom_asset_registerScriptAsset();

    // Listen to log and send it if we have a connection.
    loom_log_addListener(loom_asset_logListener, NULL);
}
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:33,代码来源:assets.cpp

示例6: regenerateSourceBreakpoints

    static void regenerateSourceBreakpoints()
    {
        sourceBreakpoints.clear();

        for (UTsize i = 0; i < breakpoints.size(); i++)
        {
            Breakpoint *bp = breakpoints.at(i);

            utFastStringHash fhash(bp->source);

            if (sourceBreakpoints.find(fhash) == UT_NPOS)
            {
                utArray<Breakpoint *> bps;
                sourceBreakpoints.insert(fhash, bps);
            }

            sourceBreakpoints.get(fhash)->push_back(bp);
        }
    }
开发者ID:24BitGames,项目名称:LoomSDK,代码行数:19,代码来源:lmDebug.cpp

示例7: strncpy

static loom_asset_t *loom_asset_getAssetByName(const char *name, int create)
{
    loom_mutex_lock(gAssetLock);
    static char normalized[4096];
    strncpy(normalized, name, sizeof(normalized));
    platform_normalizePath(normalized);
    utHashedString key        = normalized;
    loom_mutex_unlock(gAssetLock);
    loom_asset_t   **assetPtr = gAssetHash.get(key);
    loom_asset_t   *asset     = assetPtr ? *assetPtr : NULL;

    if ((asset == NULL) && create)
    {
        // Create one.
        asset       = lmNew(gAssetAllocator) loom_asset_t;
        asset->name = name;
        gAssetHash.insert(key, asset);
    }

    return asset;
}
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:21,代码来源:assets.cpp

示例8: loom_asset_shutdown

void loom_asset_shutdown()
{
    loom_asset_flushAll();

    // Clear out our queues and maps.
    gAssetDeserializerMap.clear();
    gRecognizerList.clear();

    lmAssert(gAssetLock != NULL, "Shutdown without being initialized!");
    loom_mutex_destroy(gAssetLock);
    gAssetLock = NULL;
}
开发者ID:Bewolf2,项目名称:LoomSDK,代码行数:12,代码来源:assets.cpp

示例9: lmAssert

// Helper to deserialize an asset, routing to the right function by type.
static void *loom_asset_deserializeAsset(const utString &path, int type, int size, void *ptr, LoomAssetCleanupCallback *dtor)
{
    lmAssert(gAssetDeserializerMap.find(type) != UT_NPOS, "Can't deserialize asset, no deserializer was set for type %x!", type);
    LoomAssetDeserializeCallback ladc = *gAssetDeserializerMap.get(type);

    if (ladc == NULL)
    {
        lmLogError(gAssetLogGroup, "Failed deserialize asset '%s', deserializer was not found for type '%x'!", path.c_str(), type);
        return NULL;
    }

   void *assetBits = ladc(ptr, size, dtor);

    if (assetBits == NULL)
    {
        lmLogError(gAssetLogGroup, "Failed to deserialize asset '%s', deserializer returned NULL for type '%x'!", path.c_str(), type);
        return NULL;
    }

    return assetBits;
}
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:22,代码来源:assets.cpp

示例10:

    const char *getHeaderField(const char *key)
    {
        utString *val = header.get(key);

        if (val != NULL)
        {
            return val->c_str();
        }
        else
        {
            return NULL;
        }
    }
开发者ID:chengjunjian,项目名称:LoomSDK,代码行数:13,代码来源:lmHTTPRequest.cpp

示例11: primeProfiler

static inline void primeProfiler()
{
    const char       *path = ".......";
    LoomProfilerRoot **prd = dynamicProfilerRoots[path];

    if (prd == NULL)
    {
        dynamicProfilerRoots.insert(path, new LoomProfilerRoot(strdup(path)));
        prd = dynamicProfilerRoots[path];
    }

    gLoomProfiler->hashPush(*prd);
    gLoomProfiler->hashPop(*prd);
}
开发者ID:abukosek,项目名称:LoomSDK,代码行数:14,代码来源:lsProfiler.cpp

示例12: enterMethod

void LSProfiler::enterMethod(const char *fullPath)
{
    if (!isEnabled())
    {
        return;
    }

    //printf("Entering %s\n", fullPath);

    LoomProfilerRoot **prd = dynamicProfilerRoots[fullPath];
    if (prd == NULL)
    {
        dynamicProfilerRoots.insert(fullPath, new LoomProfilerRoot(strdup(fullPath)));
        prd = dynamicProfilerRoots[fullPath];
    }

    gLoomProfiler->hashPush(*prd);
}
开发者ID:abukosek,项目名称:LoomSDK,代码行数:18,代码来源:lsProfiler.cpp

示例13: hasBreakpoint

    // tests whether the given breakpoint exists
    static bool hasBreakpoint(const char *source, int line)
    {
        utArray<Breakpoint *> *bps = sourceBreakpoints.get(utFastStringHash(source));

        if (!bps)
        {
            return false;
        }

        for (UTsize i = 0; i < bps->size(); i++)
        {
            if (bps->at(i)->line == line)
            {
                return true;
            }
        }

        return false;
    }
开发者ID:24BitGames,项目名称:LoomSDK,代码行数:20,代码来源:lmDebug.cpp

示例14: loom_asset_registerType

void loom_asset_registerType(unsigned int type, LoomAssetDeserializeCallback deserializer, LoomAssetRecognizerCallback recognizer)
{
    gAssetDeserializerMap.insert(type, deserializer);
    gRecognizerList.push_back(recognizer);
}
开发者ID:Bewolf2,项目名称:LoomSDK,代码行数:5,代码来源:assets.cpp

示例15: assetAgent_set

void DLLEXPORT assetAgent_set(const char *key, const char *value) {
    utFastStringHash hash = utFastStringHash(key);
    gOptions.set(hash, value);
}
开发者ID:Y-way,项目名称:LoomSDK,代码行数:4,代码来源:main.cpp


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