_resultsMap

来源:互联网 发布:sql 查询表的约束 编辑:程序博客网 时间:2024/05/22 11:55
/**
 * Class which associating active queries with warnings queues on client, so it easy to add new
 * warning from anywhere when it received from server
 */
class SciDBWarnings: public Singleton<SciDBWarnings>
{
public:
    void postWarning(QueryID queryId, const Warning &warning)
    {
    ScopedMutexLock _lock(_mapLock);
        assert(_resultsMap.find(queryId) != _resultsMap.end());
        _resultsMap[queryId]->_postWarning(warning);
    }


    void associateWarnings(QueryID queryId, QueryResult *res)
    {
    ScopedMutexLock _lock(_mapLock);
    _resultsMap[queryId] = res;
    }


    void unassociateWarnings(QueryID queryId)
    {
    ScopedMutexLock _lock(_mapLock);
    _resultsMap.erase(queryId);
    }


private:
    std::map<QueryID, QueryResult*> _resultsMap;
0 0