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


C++ IPropertyTree::queryPropTree方法代码示例

本文整理汇总了C++中IPropertyTree::queryPropTree方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree::queryPropTree方法的具体用法?C++ IPropertyTree::queryPropTree怎么用?C++ IPropertyTree::queryPropTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPropertyTree的用法示例。


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

示例1: sendRequest

void sendRequest()
{
    if (!loggingManager)
    {
        printf("No logging manager.\n");
        return;
    }

    StringBuffer action, option, status;
    testData->getProp("action", action);
    testData->getProp("option", option);
    if (action.length() && strieq(action.str(), "getTransactionSeed"))
    {
        StringBuffer transactionSeed;
        loggingManager->getTransactionSeed(transactionSeed, status);
        if (transactionSeed.length())
            printf("Got transactionSeed: <%s>\n", transactionSeed.str());
    }
    else if (action.length() && strieq(action.str(), "UpdateLog"))
    {
        IPropertyTree* logContentTree = testData->queryPropTree("LogContent");
        if (!logContentTree)
        {
            printf("can't read log content.\n");
            return;
        }
        StringBuffer logContentXML;
        toXML(logContentTree, logContentXML);
        printf("log content: <%s>.\n", logContentXML.str());

        Owned<IEspContext> espContext =  createEspContext();
        const char* userName = logContentTree->queryProp("ESPContext/UserName");
        const char* sourceIP = logContentTree->queryProp("ESPContext/SourceIP");
        short servPort = logContentTree->getPropInt("ESPContext/Port");
        espContext->setUserID(userName);
        espContext->setServAddress(sourceIP, servPort);

        const char* backEndResp = logContentTree->queryProp("BackEndResponse");
        IPropertyTree* userContextTree = logContentTree->queryPropTree("MyUserContext");
        IPropertyTree* userRequestTree = logContentTree->queryPropTree("MyUserRequest");
        IPropertyTree* userRespTree = logContentTree->queryPropTree("MyUserResponseEx");
        IPropertyTree* logDatasetsTree = logContentTree->queryPropTree("LogDatasets");
        StringBuffer userContextXML, userRequestXML, userRespXML, logDatasetsXML;
        toXML(logDatasetsTree, logDatasetsXML);
        toXML(userRespTree, userRespXML);

        toXML(userContextTree, userContextXML);
        toXML(userRequestTree, userRequestXML);
        printf("userContextXML: <%s>.\n", userContextXML.str());
        printf("userRequestXML: <%s>.\n", userRequestXML.str());
        printf("userRespXML: <%s>.\n", userRespXML.str());
        printf("backEndResp: <%s>.\n", backEndResp);

        //Sleep(5000); //Waiting for loggingManager to start
        loggingManager->updateLog(option.str(), *espContext, userContextTree, userRequestTree, backEndResp, userRespXML.str(), logDatasetsXML.str(), status);
    }
    else if (action.length() && strieq(action.str(), "UpdateLog1"))
    {
        IPropertyTree* logContentTree = testData->queryPropTree("LogContent");
        if (!logContentTree)
        {
            printf("can't read log content.\n");
            return;
        }
        StringBuffer logContentXML;
        toXML(logContentTree, logContentXML);
        printf("log content: <%s>.\n", logContentXML.str());
        //Sleep(5000); //Waiting for loggingManager to start
        loggingManager->updateLog(option.str(), logContentXML.str(), status);
    }
    else
        printf("Invalid action.\n");
}
开发者ID:kenrowland,项目名称:HPCC-Platform,代码行数:73,代码来源:logging_test.cpp

示例2: main

int main(int argc,char **argv) 
{
    InitModuleObjects();
    EnableSEHtoExceptionMapping();
#ifndef __64BIT__
    // Restrict stack sizes on 32-bit systems
    Thread::setDefaultStackSize(0x10000);   // 64K stack (also set in windows DSP)
#endif
    Owned<IFile> sentinelFile = createSentinelTarget();
    removeSentinelFile(sentinelFile);

    SocketEndpoint listenep;
    unsigned sendbufsize = 0;
    unsigned recvbufsize = 0;
    int i = 1;
    bool isdaemon = (memicmp(argv[0]+strlen(argv[0])-4,".exe",4)==0);
    // bit of a kludge for windows - if .exe not specified then not daemon
    bool locallisten = false;
    const char *logdir=NULL;
    bool requireauthenticate = false;
    StringBuffer logDir;
    StringBuffer instanceName;

   //Get SSL Settings
    const char *    sslCertFile;
    bool            useSSL;
    unsigned short  dafsPort;//DAFILESRV_PORT or SECURE_DAFILESRV_PORT
    querySecuritySettings(&useSSL, &dafsPort, &sslCertFile, NULL);

    unsigned maxThreads = DEFAULT_THREADLIMIT;
    unsigned maxThreadsDelayMs = DEFAULT_THREADLIMITDELAYMS;
    unsigned maxAsyncCopy = DEFAULT_ASYNCCOPYMAX;
    unsigned parallelRequestLimit = DEFAULT_STDCMD_PARALLELREQUESTLIMIT;
    unsigned throttleDelayMs = DEFAULT_STDCMD_THROTTLEDELAYMS;
    unsigned throttleCPULimit = DEFAULT_STDCMD_THROTTLECPULIMIT;
    unsigned throttleQueueLimit = DEFAULT_STDCMD_THROTTLEQUEUELIMIT;
    unsigned parallelSlowRequestLimit = DEFAULT_SLOWCMD_PARALLELREQUESTLIMIT;
    unsigned throttleSlowDelayMs = DEFAULT_SLOWCMD_THROTTLEDELAYMS;
    unsigned throttleSlowCPULimit = DEFAULT_SLOWCMD_THROTTLECPULIMIT;
    unsigned throttleSlowQueueLimit = DEFAULT_SLOWCMD_THROTTLEQUEUELIMIT;

    Owned<IPropertyTree> env = getHPCCEnvironment();
    if (env)
    {
        StringBuffer dafilesrvPath("Software/DafilesrvProcess");
        if (instanceName.length())
            dafilesrvPath.appendf("[@name=\"%s\"]", instanceName.str());
        IPropertyTree *daFileSrv = env->queryPropTree(dafilesrvPath);
        if (daFileSrv)
        {
            // global DaFileSrv settings:

            maxThreads = daFileSrv->getPropInt("@maxThreads", DEFAULT_THREADLIMIT);
            maxThreadsDelayMs = daFileSrv->getPropInt("@maxThreadsDelayMs", DEFAULT_THREADLIMITDELAYMS);
            maxAsyncCopy = daFileSrv->getPropInt("@maxAsyncCopy", DEFAULT_ASYNCCOPYMAX);

            parallelRequestLimit = daFileSrv->getPropInt("@parallelRequestLimit", DEFAULT_STDCMD_PARALLELREQUESTLIMIT);
            throttleDelayMs = daFileSrv->getPropInt("@throttleDelayMs", DEFAULT_STDCMD_THROTTLEDELAYMS);
            throttleCPULimit = daFileSrv->getPropInt("@throttleCPULimit", DEFAULT_STDCMD_THROTTLECPULIMIT);
            throttleQueueLimit = daFileSrv->getPropInt("@throttleQueueLimit", DEFAULT_STDCMD_THROTTLEQUEUELIMIT);

            parallelSlowRequestLimit = daFileSrv->getPropInt("@parallelSlowRequestLimit", DEFAULT_SLOWCMD_PARALLELREQUESTLIMIT);
            throttleSlowDelayMs = daFileSrv->getPropInt("@throttleSlowDelayMs", DEFAULT_SLOWCMD_THROTTLEDELAYMS);
            throttleSlowCPULimit = daFileSrv->getPropInt("@throttleSlowCPULimit", DEFAULT_SLOWCMD_THROTTLECPULIMIT);
            throttleSlowQueueLimit = daFileSrv->getPropInt("@throttleSlowQueueLimit", DEFAULT_SLOWCMD_THROTTLEQUEUELIMIT);

            // any overrides by Instance definitions?
            // NB: This won't work if netAddress is "." or if we start supporting hostnames there
            StringBuffer ipStr;
            queryHostIP().getIpText(ipStr);
            VStringBuffer daFileSrvPath("Instance[@netAddress=\"%s\"]", ipStr.str());
            IPropertyTree *dafileSrvInstance = daFileSrv->queryPropTree(daFileSrvPath);
            if (dafileSrvInstance)
            {
                maxThreads = dafileSrvInstance->getPropInt("@maxThreads", maxThreads);
                maxThreadsDelayMs = dafileSrvInstance->getPropInt("@maxThreadsDelayMs", maxThreadsDelayMs);
                maxAsyncCopy = dafileSrvInstance->getPropInt("@maxAsyncCopy", maxAsyncCopy);

                parallelRequestLimit = dafileSrvInstance->getPropInt("@parallelRequestLimit", parallelRequestLimit);
                throttleDelayMs = dafileSrvInstance->getPropInt("@throttleDelayMs", throttleDelayMs);
                throttleCPULimit = dafileSrvInstance->getPropInt("@throttleCPULimit", throttleCPULimit);
                throttleQueueLimit = dafileSrvInstance->getPropInt("@throttleQueueLimit", throttleQueueLimit);

                parallelSlowRequestLimit = dafileSrvInstance->getPropInt("@parallelSlowRequestLimit", parallelSlowRequestLimit);
                throttleSlowDelayMs = dafileSrvInstance->getPropInt("@throttleSlowDelayMs", throttleSlowDelayMs);
                throttleSlowCPULimit = dafileSrvInstance->getPropInt("@throttleSlowCPULimit", throttleSlowCPULimit);
                throttleSlowQueueLimit = dafileSrvInstance->getPropInt("@throttleSlowQueueLimit", throttleSlowQueueLimit);
            }
        }
    }

    while (argc>i) {
        if (stricmp(argv[i],"-D")==0) {
            i++;
            isdaemon = true;
        }
        else if (stricmp(argv[i],"-R")==0) { // for remote run
            i++;
#ifdef _WIN32
            isdaemon = false;
//.........这里部分代码省略.........
开发者ID:PaulCharlton,项目名称:HPCC-Platform,代码行数:101,代码来源:dafilesrv.cpp


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