コード例 #1
0
IAttributeHistory * CreateDiskAttributeHistory(const boost::filesystem::path & path, const IAttribute * attribute, int version)
{
    static CacheT<std::_tstring, CDiskAttributeHistory> AttributeHistoryCache;
    CDiskAttributeHistory * attr = AttributeHistoryCache.Get(new CDiskAttributeHistory(path, const_cast<IAttribute *>(attribute), version));
    ATLASSERT(attr);
    attr->Update();
    return attr;
}
コード例 #2
0
ファイル: Module.cpp プロジェクト: dehilsterlexis/eclide-1
CModule * CreateModuleRaw(const IRepository *rep, const std::_tstring & label, bool placeholder)
{
    CModuleHelper modHelper(label);
    StdStringVector tokens;
    modHelper.GetQualifiedLabel(tokens);

    CModule * retVal = NULL;
    std::_tstring qualifiedLabel;
    for (StdStringVector::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
    {
        if (!qualifiedLabel.empty())
            qualifiedLabel += CModuleHelper::DELIMTER;
        qualifiedLabel += *itr;
        retVal = ModuleCache.Get(new CModule(rep, retVal, qualifiedLabel.c_str(), *itr, placeholder));
    }
    return retVal;
}
コード例 #3
0
ファイル: Module.cpp プロジェクト: dehilsterlexis/eclide-1
void DeleteModule(CModule * module)
{
    ModuleCache.Clear(module->GetCacheID());
}
コード例 #4
0
ファイル: Cluster.cpp プロジェクト: GordonSmith/eclide
CCluster * CreateClusterRaw(const CString & url, const CString & wuid, const std::_tstring & queue = _T(""))
{
	return ClusterCache.Get(new CCluster(static_cast<const TCHAR *>(url), static_cast<const TCHAR *>(wuid), queue));
}
コード例 #5
0
ファイル: Result.cpp プロジェクト: dehilsterlexis/eclide-1
CResult * CreateResultRaw(const CString & url, const CString & wuid, int sequence)
{
    return ResultCache.Get(new CResult(url, wuid, sequence));
}
コード例 #6
0
ファイル: Module.cpp プロジェクト: dehilsterlexis/eclide-1
void ClearModuleCache()
{
    ATLTRACE(_T("Module cache before clearing(size=%u)\r\n"), ModuleCache.Size());
    ModuleCache.Clear();
}
コード例 #7
0
ファイル: Result.cpp プロジェクト: dehilsterlexis/eclide-1
namespace Dali
{
typedef std::map<std::_tstring, std::_tstring> StringStringMap;
class CResult : public IResult, public clib::CLockableUnknown, public boost::noncopyable
{
protected:
    CString m_id;
    CString m_url;
    CString m_wuid;
    CString m_name;
    int m_sequence;
    CString m_value;
    CString m_link;
    CString m_fileName;
    bool IsSupplied;
    __int64 m_total;
    StringStringMap m_schemaMap;

public:
    IMPLEMENT_CLOCKABLEUNKNOWN;

    CResult()
    {
        ATLASSERT(false);
    }
    CResult(const CString & url, const CString & wuid, int sequence) : m_url(url), m_wuid(wuid), m_sequence(sequence)
    {
        m_id = m_url + _T("/") + m_wuid + _T("/") + boost::lexical_cast<std::_tstring>(sequence).c_str();
        m_total = 0;
    }
    virtual ~CResult()
    {
    }
    const TCHAR *GetID() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_id;
    }
    const TCHAR * GetCacheID() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_id;
    }
    const TCHAR *GetName() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_name;
    }
    int GetSequence() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_sequence;
    }
    const TCHAR *GetValue() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_value;
    }
    const TCHAR *GetLink() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_link;
    }
    const TCHAR *GetFileName() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_fileName;
    }
    __int64 GetTotal() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_total;
    }
    const TCHAR *GetECLType(const std::_tstring & colID) const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        StringStringMap::const_iterator found = m_schemaMap.find(colID);
        if (found != m_schemaMap.end()) 
        {
            return found->second.c_str();
        }
        return NULL;
    }
    unsigned GetResultData(__int64 start, int count, ITable * result) const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        __int64 total;
        unsigned retVal = GetResultData(start, count, result, total);
        if (m_total && m_total < total)
            total = m_total;
        return retVal;
    }

    unsigned GetResultData(__int64 start, int count, ITable * result, __int64 & total) const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        StlLinked<IDali> dali;
        dali = AttachDali((const TCHAR *)m_url, _T("Dali"));
        unsigned retVal = dali->GetResultData(m_wuid, m_sequence, start, count, result, total);
        if (m_total && m_total < total)
            total = m_total;
        return retVal;
    }

#if _COMMS_VER < 68200
    void Update(const ECLResult * c)
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
#if _COMMS_VER < 700000
        m_name = CW2T(c->Name, CP_UTF8);
        m_sequence = c->Sequence;
        m_value = CW2T(c->Value, CP_UTF8);
        m_link = CW2T(c->Link, CP_UTF8);
        IsSupplied = c->IsSupplied;
        m_total = c->Total;
#else
        m_name = CW2T(c->ResultName, CP_UTF8);
        m_sequence = c->SequenceNumber;
        //m_value = CW2T(c->Value, CP_UTF8);
        //m_link = CW2T(c->Link, CP_UTF8);
        m_total = c->TotalRowCount;
#endif
        m_fileName = CW2T(c->FileName, CP_UTF8);
    }
#else
    void Update(const ns6__ECLResult * c)
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        SAFE_ASSIGN2CSTRING(m_name, c->Name);
        SAFE_ASSIGN(m_sequence, c->Sequence);
        SAFE_ASSIGN2CSTRING(m_value, c->Value);
        SAFE_ASSIGN2CSTRING(m_link, c->Link);
        SAFE_ASSIGN(IsSupplied, c->IsSupplied);
        SAFE_ASSIGN(m_total, c->Total);
        SAFE_ASSIGN2CSTRING(m_fileName, c->FileName);
        if (c->ECLSchemas)
        {
            m_schemaMap.clear();
            for(std::size_t i = 0; i < c->ECLSchemas->ECLSchemaItem.size(); ++i)
            {
                if (c->ECLSchemas->ECLSchemaItem[i]->ColumnName && c->ECLSchemas->ECLSchemaItem[i]->ColumnType) 
                {
                    m_schemaMap[*c->ECLSchemas->ECLSchemaItem[i]->ColumnName] = *c->ECLSchemas->ECLSchemaItem[i]->ColumnType;
                }
            }
        }
    }
#endif
};

    static CacheT<std::_tstring, CResult> ResultCache;

void ClearResultCache()
{
    ATLTRACE(_T("Result cache before clearing(size=%u)\r\n"), ResultCache.Size());
    ResultCache.Clear();
}

CResult * CreateResultRaw(const CString & url, const CString & wuid, int sequence)
{
    return ResultCache.Get(new CResult(url, wuid, sequence));
}

IResult * CreateResult(const CString & url, const CString & wuid, int sequence)
{
    return CreateResultRaw(url, wuid, sequence);
}

#if _COMMS_VER < 68200
IResult * CreateResult(const CString & url, const CString & wuid, const ECLResult * result)
{
#if _COMMS_VER < 700000
    CComPtr<CResult> attr = CreateResultRaw(url, wuid, result->Sequence);
#else
    CComPtr<CResult> attr = CreateResultRaw(url, wuid, result->SequenceNumber);
#endif
    ATLASSERT(attr);
    attr->Update(result);
    return attr;
}
#else
IResult * CreateResult(const CString & url, const CString & wuid, const ns6__ECLResult * result)
{
    CComPtr<CResult> attr = CreateResultRaw(url, wuid, *result->Sequence);
    ATLASSERT(attr);
    attr->Update(result);
    return attr;
}
#endif
} //namespace Dali
コード例 #8
0
ファイル: Result.cpp プロジェクト: dehilsterlexis/eclide-1
void ClearResultCache()
{
    ATLTRACE(_T("Result cache before clearing(size=%u)\r\n"), ResultCache.Size());
    ResultCache.Clear();
}
コード例 #9
0
ファイル: LocalFile.cpp プロジェクト: dehilsterlexis/eclide-1
CLocalFile * CreateLocalFileRaw(const CString & url, const CString & wuid, const CString & source)
{
    return LocalFileCache.Get(new CLocalFile(url, wuid, source));
}
コード例 #10
0
ファイル: Cluster.cpp プロジェクト: GordonSmith/eclide
void ClearClusterSingletons()
{
	ClusterCache.clear();
}
コード例 #11
0
ファイル: Cluster.cpp プロジェクト: GordonSmith/eclide
void ClearClusterCache()
{
	ClusterCache.Clear();
}
コード例 #12
0
ファイル: SMC.cpp プロジェクト: dehilsterlexis/eclide-1
    bool GetActive(IClusterVector * clusters)
    {
        CComInitialize com;
        ServerT server;
        CString url = GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_SMC);
        server.SetUrl(url);

        CStructArrayOut<ActiveWorkunit> running;
#if _COMMS_VER < 499
        bool thorQueueManagement;
        if (server.Index(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), &thorQueueManagement) == S_OK)
#elif _COMMS_VER < 505
        bool thorQueueManagement;
        CStructArrayOut<ActiveWorkunit> running;
        if (server.Index(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress(), &thorQueueManagement) == S_OK)
#elif _COMMS_VER < 50509
        CStructArrayOut<ActiveWorkunit> running;
        if (server.Index(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
#elif _COMMS_VER < 51100
        CStructArrayOut<ActiveWorkunit> running;
        if (server.Activity(false, exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
#elif _COMMS_VER < 67205
        CComBSTR build;
        CStructArrayOut<ThorCluster> thorClusters;
        CStructArrayOut<HoleCluster> holeClusters;
        CStructArrayOut<DFUJob> dfuJobs;
        ESP_EXCEPTION_LOG(EspException);
        if (server.Activity(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
        {
            if (build)
                m_version = CreateVersion(url, CString(build));

            //  Multi thor support - there could be some jobs running on a multi thor!
            for(int i = 0; i < running.GetCount(); ++i)
            {
                CComBSTR thorClusterName = running.GetItem(i)->Instance;
#elif _COMMS_VER < 700000
        CComBSTR build;
        CStructArrayOut<ThorCluster> thorClusters;
        CStructArrayOut<HoleCluster> holeClusters;
        CStructArrayOut<DFUJob> dfuJobs;
        ESP_EXCEPTION_LOG2(EspException);
        if (server.Activity(exceptions, &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
        {
            if (build)
                m_version = CreateVersion(url, CString(build));

            //  Multi thor support - there could be some jobs running on a multi thor!
            for(int i = 0; i < running.GetCount(); ++i)
            {
                CComBSTR thorClusterName = running.GetItem(i)->Instance;
#else
        ESP_STATUS_LOG;
        if (server.ListActiveOrQueuedWorkunits(running.GetArrayAddress(), running.GetCountAddress(), &status.m_statusCode, &status.m_statusMessage) == S_OK)
        {
            //  Multi thor support - there could be some jobs running on a multi thor!
            for(int i = 0; i < running.GetCount(); ++i)
            {
                CComBSTR thorClusterName = running.GetItem(i)->ServerInstance;
#endif
                CComBSTR thorClusterStatus = running.GetItem(i)->State;
                ThorCluster thorCluster;
                thorCluster.ClusterName = thorClusterName;
                thorCluster.QueueStatus = thorClusterStatus;
                StlLinked<ICluster> cluster = CreateCluster(m_url, &thorCluster, running);
                if (std::find(clusters->begin(), clusters->end(), cluster) == clusters->end())
                {
                    clusters->push_back(cluster.get());
                }
            }
            return true;
        }
        else
            _DBGLOG(m_url, LEVEL_WARNING, server.GetClientError());

        return false;
    }

    IVersion * GetBuild()
    {
        if (m_version)
            return m_version;
        IClusterVector results;
        if (GetActive(&results))
            return m_version;
        return m_unknown;
    }

    bool SetPriority(const std::_tstring &cluster, const std::_tstring &wuid, PRIORITY priority)
    {
        CComInitialize com;
        ServerT server;
        server.SetUrl(CString(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_SMC)));

        CComBSTR inCluster = CT2W(cluster.c_str(), CP_UTF8);
        CComBSTR inWuid = CT2W(wuid.c_str(), CP_UTF8);

        HRESULT result;
#if _COMMS_VER < 67205 
        ESP_EXCEPTION_LOG(EspException);
#elif _COMMS_VER < 700000 
        ESP_EXCEPTION_LOG2(EspException);
#else
        ESP_STATUS_LOG;
#endif
        switch (priority)
        {
        case PRIORITY_UP:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobUp(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobUp(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobUp(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("up");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        case PRIORITY_DOWN:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobDown(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobDown(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobDown(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("down");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        case PRIORITY_TOP:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobFront(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobFront(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobFront(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("front");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        case PRIORITY_BOTTOM:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobBack(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobBack(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobBack(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("end");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        default:
            _DBGLOG(m_url, LEVEL_WARNING, server.GetClientError());
            return false;
        }
        if(result == S_OK)
        {
            return true;
        }
        else
            _DBGLOG(m_url, LEVEL_WARNING, server.GetClientError());
        return false;
    }

    bool SetPriority(Dali::IWorkunitVector *workunits, PRIORITY priority)
    {
        switch (priority)
        {
        case PRIORITY_UP:
        case PRIORITY_TOP:
            {
                for(Dali::IWorkunitVector::iterator itr = workunits->begin(); itr != workunits->end(); ++itr)
                {
                    Dali::IWorkunitAdapt& workunit = *itr;
                    SetPriority(workunit->GetCluster(), workunit->GetWuid(), priority);
                }
            }
            break;
        case PRIORITY_DOWN:
        case PRIORITY_BOTTOM:
            {
                for (Dali::IWorkunitVector::reverse_iterator itr = workunits->rbegin(); itr != workunits->rend(); ++itr)
                {
                    Dali::IWorkunitAdapt& workunit = *itr;
                    SetPriority(workunit->GetCluster(), workunit->GetWuid(), priority);
                }
            }
            break;
        }
        return true;
    }
};
#endif

CacheT<std::_tstring, CSMC> SMCCache;
ISMC * AttachSMC(const std::_tstring & url, const std::_tstring & label)
{
    return SMCCache.Get(new CSMC(url.c_str(), label.c_str()));
}
COMMS_API ISMC * AttachSMC(const _variant_t & url, const std::_tstring & label)
{
    return SMCCache.Get(new CSMC(url, label.c_str()));
}
void ClearSingletons()
{
    ClearVersionCache();
    ClearClusterCache();
    SMCCache.clear();
}
}
コード例 #13
0
ファイル: DropZone.cpp プロジェクト: dehilsterlexis/eclide-1
namespace Topology
{
class CDropZone : public IDropZone, public CUnknown
{
protected:
    std::_tstring m_Url;
    std::_tstring m_Name;
    std::_tstring m_Path;
    std::_tstring m_Build;
    std::_tstring m_Description;
    StlLinked<CMachine> m_machine; //only 1 per drop zone I think

public:
    IMPLEMENT_CUNKNOWNQI(IDropZone);

    CDropZone(const TCHAR* url, const TCHAR* name, const TCHAR* path) 
        : m_Url(url), m_Name(name), m_Path(path)
    {
    }

    virtual ~CDropZone()
    {
    }

public: //IDropZone
    const TCHAR *GetID() const
    {
        return m_Name.c_str();
    }
    const TCHAR * GetCacheID() const
    {
        return m_Name.c_str();
    }
    const TCHAR *GetName(std::_tstring &name) const
    {
        name = m_Name;
        return name.c_str();
    }
    const TCHAR *GetDescription(std::_tstring &desc) const
    {
        desc = m_Description;
        return desc.c_str();
    }
    const TCHAR *GetPath(std::_tstring &path) const
    {
        path = m_Path;
        return path.c_str();
    }
    const TCHAR *GetBuild(std::_tstring &build) const
    {
        build = m_Build;
        return build.c_str();
    }
    IMachine *GetMachine() const
    {
        return m_machine.get();
    }

#if _COMMS_VER < 68200
    void Update(const TpDropZone * c)
    {
        m_Name = CW2T(c->Name, CP_UTF8);
        m_Description = CW2T(c->Description, CP_UTF8);
        m_Path = CW2T(c->Path, CP_UTF8);
        m_Build = CW2T( c->Build, CP_UTF8);
        m_machine = new CMachine();
#if _COMMS_VER < 60000 
        m_machine->Update(c->TpMachines);
#else
        m_machine->Update(c->TpMachines._TpMachine);
#endif
        Refresh();
    }
#elif _COMMS_VER < 700000
    void Update(const ns5__TpDropZone * c)
    {
        SAFE_ASSIGN(m_Name, c->Name);
        SAFE_ASSIGN(m_Description, c->Description);
        SAFE_ASSIGN(m_Path, c->Path);
        SAFE_ASSIGN(m_Build, c->Build);
        m_machine = new CMachine();
        m_machine->Update(c->TpMachines->TpMachine[0]);
        Refresh();
    }
#else
    void Update(const ServiceDetail * c)
    {
        m_Name = CW2T(c->Name, CP_UTF8);
        m_Description = CW2T(c->Description, CP_UTF8);
        //m_Path = CW2T(c->Path, CP_UTF8);
        m_Build = CW2T( c->Build, CP_UTF8);
        m_machine = new CMachine();
        m_machine->Update(c->Machines._Machine);
        Refresh();
    }
#endif

    void Refresh()
    {
    }
};

CacheT<std::_tstring, CDropZone> DropZoneCache;
CDropZone * CreateDropZoneRaw(const TCHAR *url, const TCHAR *name, const TCHAR *path)
{
    return DropZoneCache.Get(new CDropZone(url, name, path));
}

IDropZone * CreateDropZone(const TCHAR *url, const TCHAR *name, const TCHAR *path)
{
    return CreateDropZoneRaw(url, name, path);
}

#if _COMMS_VER < 68200
IDropZone * CreateDropZone(const CString & url, const TpDropZone * data)
{
    CDropZone * zone = CreateDropZoneRaw(url, CW2T(data->Name, CP_UTF8), CW2T(data->Path, CP_UTF8));
    ATLASSERT(zone);
    zone->Update(data);
    return zone;
}
#elif _COMMS_VER < 700000
IDropZone * CreateDropZone(const CString & url, const ns5__TpDropZone * data)
{
    CDropZone * zone = CreateDropZoneRaw(url, data->Name->c_str(), data->Path->c_str());
    ATLASSERT(zone);
    zone->Update(data);
    return zone;
}
#else
IDropZone * CreateDropZone(const CString & url, const ServiceDetail * data)
{
    CDropZone * zone = CreateDropZoneRaw(url, CW2T(data->Name, CP_UTF8), CW2T(_T(""), CP_UTF8));
    ATLASSERT(zone);
    zone->Update(data);
    return zone;
}
#endif
void ClearDropZoneSingletons()
{
    DropZoneCache.clear();
}
}
コード例 #14
0
ファイル: DropZone.cpp プロジェクト: dehilsterlexis/eclide-1
void ClearDropZoneSingletons()
{
    DropZoneCache.clear();
}
コード例 #15
0
ファイル: DropZone.cpp プロジェクト: dehilsterlexis/eclide-1
CDropZone * CreateDropZoneRaw(const TCHAR *url, const TCHAR *name, const TCHAR *path)
{
    return DropZoneCache.Get(new CDropZone(url, name, path));
}
コード例 #16
0
namespace Dali
{

class CLocalResult : public IResult, public clib::CLockableUnknown, public boost::noncopyable
{
protected:
    CString m_id;
    CString m_url;
    CString m_wuid;
    CString m_name;
    int m_sequence;
    CString m_value;
    CString m_link;
    CString m_fileName;
    bool IsSupplied;
    __int64 m_total;
    StlLinked<ITable> m_result;

public:
    IMPLEMENT_CLOCKABLEUNKNOWN;

    CLocalResult()
    {
        ATLASSERT(false);
    }
    CLocalResult(const CString & url, const CString & wuid, int sequence) : m_url(url), m_wuid(wuid), m_sequence(sequence)
    {
        m_id = m_url + _T("/") + m_wuid + _T("/") + boost::lexical_cast<std::_tstring>(sequence).c_str();
        m_total = 0;
        m_result = CreateISparseTable();
        //m_result->AddColumn(_T("Row"));
    }
    virtual ~CLocalResult()
    {
    }
    const TCHAR *GetID() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_id;
    }
    const TCHAR * GetCacheID() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_id;
    }
    const TCHAR *GetName() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_name;
    }
    int GetSequence() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_sequence;
    }
    const TCHAR *GetValue() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_value;
    }
    const TCHAR *GetLink() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_link;
    }
    const TCHAR *GetFileName() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_fileName;
    }
    __int64 GetTotal() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_total;
    }
    const TCHAR *GetECLType(const std::_tstring & colID) const
    {
        return NULL;
    }
    unsigned GetResultData(__int64 start, int count, ITable * result) const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        __int64 total;
        unsigned retVal = GetResultData(start, count, result, total);
        if (m_total && m_total < total)
            total = m_total;
        return retVal;
    }

    unsigned GetResultData(__int64 start, int count, ITable * result, __int64 & total) const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        if (m_result->GetRowCount() - start < count)
            count = m_result->GetRowCount() - start;
        for(__int64 i = start; i < start + count; ++i)
        {
            for (unsigned int j = 0; j < m_result->GetColumnCount(); ++j)
            {
                int newCol = result->FindColumn(m_result->GetColumn(j), true, m_result->GetColumnType(j));
                if (newCol >= 0)
                    result->SetCell(i, newCol, m_result->GetCell(i, j));
                else
                    result->SetCell(i, j, m_result->GetCell(i, j));
            }
        }
        return count;
    }

    void Update(const std::_tstring & name, ITable * result)
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);

        m_name = name.c_str();

        m_result->LoadFrom(result);
        m_total = result->GetRowCount();
    }
};

static CacheT<std::_tstring, CLocalResult> LocalResultCache;

void ClearLocalResultCache()
{
    ATLTRACE(_T("Result cache before clearing(size=%u)\r\n"), LocalResultCache.Size());
    LocalResultCache.Clear();
}

CLocalResult * CreateLocalResultRaw(const CString & url, const CString & wuid, int sequence)
{
    return LocalResultCache.Get(new CLocalResult(url, wuid, sequence));
}

IResult * CreateLocalResult(const CString & url, const CString & wuid, int sequence)
{
    return CreateLocalResultRaw(url, wuid, sequence);
}

#if _COMMS_VER < 68200
#else
IResult * CreateLocalResult(const CString & url, const CString & wuid, const std::_tstring & label, int sequence, ITable * result)
{
    CComPtr<CLocalResult> attr = CreateLocalResultRaw(url, wuid, sequence);
    ATLASSERT(attr);
    attr->Update(label, result);
    return attr;
}
#endif
} //namespace Dali
コード例 #17
0
ファイル: LocalFile.cpp プロジェクト: dehilsterlexis/eclide-1
namespace Dali
{
#if _COMMS_VER < 60600
#else
class CLocalFile : public ILocalFile, public clib::CLockableUnknown, public boost::noncopyable
{
protected:
    CString m_id;
    CString m_url;
    CString m_wuid;
    int m_type;
    CString m_source;
    CString m_destination;
    localfile_signal_type on_refresh;

public:
    IMPLEMENT_CLOCKABLEUNKNOWN;

    CLocalFile()
    {
        ATLASSERT(false);
    }
    CLocalFile(const CString & url, const CString & wuid, const CString & source) : m_url(url), m_wuid(wuid), m_source(source)
    {
        m_id = m_url + _T("/") + m_wuid + _T("/") + m_source;
        m_type = 0;
    }
    virtual ~CLocalFile()
    {
    }
    const TCHAR *GetID() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_id;
    }
    const TCHAR * GetCacheID() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_id;
    }
    int GetType() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_type;
    }
    const TCHAR *GetSource() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_source;
    }
    const TCHAR *GetDestination() const
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return m_destination;
    }
#if _COMMS_VER < 68200
    void Update(const LogicalFileUpload * c)
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        bool changed = false;
        if (m_source.Compare(CW2T(c->Source, CP_UTF8)) != 0 || 
            m_destination.Compare(CW2T(c->Destination, CP_UTF8)) != 0 || 
            m_type != c->Type)
        {
            changed = true;
        }
        m_type = c->Type;
        m_source = CW2T(c->Source, CP_UTF8);
        m_destination = CW2T(c->Destination, CP_UTF8);
        if (changed)
        {
            proc.unlock();
            Refresh();
        }
    }
#else
    void Update(const ns6__LogicalFileUpload * c)
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        CString prev_source = m_source;
        CString prev_destinition = m_destination;
        int prev_type = m_type;

        SAFE_ASSIGN2CSTRING(m_source, c->Source);
        SAFE_ASSIGN2CSTRING(m_destination, c->Destination);
        SAFE_ASSIGN(m_type, c->Type);
        if (m_source.Compare(prev_source) != 0 || 
            m_destination.Compare(prev_destinition) != 0 || 
            m_type != prev_type)
        {
            proc.unlock();
            Refresh();
        }
    }
#endif
    void Refresh() 
    {
        on_refresh(this);
    }
    boost::signals::connection on_refresh_connect(const localfile_slot_type& s)
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        return on_refresh.connect(s); 
    }
};

static CacheT<std::_tstring, CLocalFile> LocalFileCache;

void ClearLocalFileCache()
{
    ATLTRACE(_T("LocalFile cache before clearing(size=%u)\r\n"), LocalFileCache.Size());
    LocalFileCache.Clear();
}

CLocalFile * CreateLocalFileRaw(const CString & url, const CString & wuid, const CString & source)
{
    return LocalFileCache.Get(new CLocalFile(url, wuid, source));
}

ILocalFile * CreateLocalFile(const CString & url, const CString & wuid, const CString & source)
{
    return CreateLocalFileRaw(url, wuid, source);
}

#if _COMMS_VER < 68200
ILocalFile * CreateLocalFile(const CString & url, const CString & wuid, const LogicalFileUpload * localfile)
{
    CComPtr<CLocalFile> lf = CreateLocalFileRaw(url, wuid, localfile->Source);
    ATLASSERT(lf);
    lf->Update(localfile);
    return lf;
}
#else
ILocalFile * CreateLocalFile(const CString & url, const CString & wuid, const ns6__LogicalFileUpload * localfile)
{
    CComPtr<CLocalFile> lf = CreateLocalFileRaw(url, wuid, localfile->Source->c_str());
    ATLASSERT(lf);
    lf->Update(localfile);
    return lf;
}
#endif
#endif
} //namespace Dali
コード例 #18
0
ファイル: Cluster.cpp プロジェクト: GordonSmith/eclide
namespace Topology
{
class CCluster : public ICluster, public CUnknown
{
protected:
    std::_tstring m_Name;
    std::_tstring m_Queue;

    std::_tstring m_Url;
    std::_tstring m_Type;
    std::_tstring m_Directory;
    std::_tstring m_Desc;
    std::_tstring m_Prefix;
    std::_tstring m_Path;
    std::_tstring m_DataModel;

public:
	IMPLEMENT_CUNKNOWN;

	CCluster(const std::_tstring & url, const std::_tstring & name, const std::_tstring & queue = _T("")) : m_Url(url), m_Name(name), m_Queue(queue)
	{
	}

	virtual ~CCluster()
	{
	}

	const TCHAR *GetID() const
	{
		return m_Name.c_str();
	}
	const TCHAR * GetCacheID() const
	{
		return m_Name.c_str();
	}
	const TCHAR *GetName() const
	{
		return m_Name.c_str();
	}
	const TCHAR *GetQueue() const
	{
		return m_Queue.c_str();
	}
	const TCHAR *GetType() const
	{
		return m_Type.c_str();
	}
	const TCHAR *GetDirectory() const
	{
		return m_Directory.c_str();
	}
	const TCHAR *GetDesc() const
	{
		return m_Desc.c_str();
	}
	const TCHAR *GetPrefix() const
	{
		return m_Prefix.c_str();
	}
	const TCHAR *GetPath() const
	{
		return m_Path.c_str();
	}
	const TCHAR *GetDataModel() const
	{
		return m_DataModel.c_str();
	}

#if _COMMS_VER < 68200
	void Update(const TpLogicalCluster * c)
	{
		m_Name = CW2T(c->Name, CP_UTF8);
#if _COMMS_VER < 55100
#else
		if(c->Queue)
		{
			m_Queue = CW2T(c->Queue, CP_UTF8);
		}
#endif
		Refresh();
	}
	void Update(const TpCluster * c)
	{
		m_Name = CW2T(c->Name, CP_UTF8);
		m_Type = CW2T(c->Type, CP_UTF8);
		m_Directory = CW2T(c->Directory, CP_UTF8);
		m_Desc = CW2T(c->Desc, CP_UTF8);
		m_Prefix = CW2T(c->Prefix, CP_UTF8);
		m_Path = CW2T(c->Path, CP_UTF8);
		m_DataModel = CW2T(c->DataModel, CP_UTF8);
		Refresh();
	}
#elif _COMMS_VER < 700000
	void Update(const ns5__TpLogicalCluster * c)
	{
		SAFE_ASSIGN(m_Name, c->Name);
		SAFE_ASSIGN(m_Queue, c->Queue);
		Refresh();
	}
#else
	void Update(const LogicalCluster * c)
	{
		m_Name = CW2T(c->Name, CP_UTF8);
		if(c->Queue)
		{
			m_Queue = CW2T(c->Queue, CP_UTF8);
		}
		Refresh();
	}
#endif

	void Refresh()
	{
	}
};

CacheT<std::_tstring, CCluster> ClusterCache;

void ClearClusterCache()
{
	ClusterCache.Clear();
}

CCluster * CreateClusterRaw(const CString & url, const CString & wuid, const std::_tstring & queue = _T(""))
{
	return ClusterCache.Get(new CCluster(static_cast<const TCHAR *>(url), static_cast<const TCHAR *>(wuid), queue));
}

ICluster * CreateCluster(const CString & url, const CString & wuid, const std::_tstring & queue)
{
	return CreateClusterRaw(url, wuid, queue);
}

#if _COMMS_VER < 68200
ICluster * CreateCluster(const CString & url, const TpLogicalCluster * data)
{
	CCluster * attr = CreateClusterRaw(url, data->Name);
	ATLASSERT(attr);
	attr->Update(data);
	return attr;
}
ICluster * CreateCluster(const CString & url, const TpCluster * data)
{
	ATLASSERT(!"This is not used any more - please tell Gordon");
	//CCluster * attr = CreateClusterRaw(url, data->Name);
	//ATLASSERT(attr);
	//attr->Update(data);
	return NULL;//attr;
}
#elif _COMMS_VER < 700000
ICluster * CreateCluster(const CString & url, const ns5__TpLogicalCluster * data)
{
	CCluster * attr = CreateClusterRaw(url, data->Name->c_str());
	ATLASSERT(attr);
	attr->Update(data);
	return attr;
}
ICluster * CreateCluster(const CString & url, const ns5__TpCluster * data)
{
	ATLASSERT(!"This is not used any more - please tell Gordon");
	//CCluster * attr = CreateClusterRaw(url, data->Name);
	//ATLASSERT(attr);
	//attr->Update(data);
	return NULL;//attr;
}
#else
ICluster * CreateCluster(const CString & url, const LogicalCluster * data)
{
	CCluster * attr = CreateClusterRaw(url, data->Name);
	ATLASSERT(attr);
	attr->Update(data);
	return attr;
}
ICluster * CreateCluster(const CString & url, const Cluster * data)
{
	ATLASSERT(!"This is not used any more - please tell Gordon");
	//CCluster * attr = CreateClusterRaw(url, data->Name);
	//ATLASSERT(attr);
	//attr->Update(data);
	return NULL;//attr;
}
#endif
void ClearClusterSingletons()
{
	ClusterCache.clear();
}
}
コード例 #19
0
ファイル: LocalFile.cpp プロジェクト: dehilsterlexis/eclide-1
void ClearLocalFileCache()
{
    ATLTRACE(_T("LocalFile cache before clearing(size=%u)\r\n"), LocalFileCache.Size());
    LocalFileCache.Clear();
}