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


C++ PropertyDict::find方法代码示例

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


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

示例1: ex


//.........这里部分代码省略.........
    {
    case PROCESSOR_ARCHITECTURE_AMD64:
        _machine = "x64";
        break;
    case PROCESSOR_ARCHITECTURE_IA64:
        _machine = "IA64";
        break;
    case PROCESSOR_ARCHITECTURE_INTEL:
        _machine = "x86";
        break;
    default:
        _machine = "unknown";
        break;
    };
#else
    struct utsname utsinfo;
    uname(&utsinfo);
    _os = utsinfo.sysname;
    _hostname = utsinfo.nodename;
    _release = utsinfo.release;
    _version = utsinfo.version;
    _machine = utsinfo.machine;
#endif

    Ice::PropertiesPtr properties = communicator->getProperties();

    //
    // Try to obtain the number of processor sockets.
    //
    _nProcessorSockets = properties->getPropertyAsIntWithDefault("IceGrid.Node.ProcessorSocketCount", 0);
    if(_nProcessorSockets == 0)
    {
#if defined(_WIN32)
        _nProcessorSockets = getSocketCount(_traceLevels->logger);
#elif defined(__linux)
        IceUtilInternal::ifstream is(string("/proc/cpuinfo"));
        set<string> ids;
        
        int nprocessor = 0;
        while(is)
        {
            string line;
            getline(is, line);
            if(line.find("processor") == 0)
            {
                nprocessor++;
            }
            else if(line.find("physical id") == 0)
            {
                nprocessor--;
                ids.insert(line);
            }
        }
        _nProcessorSockets = nprocessor + ids.size();
#else
        // Not supported
        _nProcessorSockets = 1;
#endif
    }

    string endpointsPrefix;
    if(prefix == "IceGrid.Registry")
    {
        _name = properties->getPropertyWithDefault("IceGrid.Registry.ReplicaName", "Master");
        endpointsPrefix = prefix + ".Client";
    }
    else
    {
        _name = properties->getProperty(prefix + ".Name");
        endpointsPrefix = prefix;
    }

    Ice::PropertyDict props = properties->getPropertiesForPrefix(endpointsPrefix);
    Ice::PropertyDict::const_iterator p = props.find(endpointsPrefix + ".PublishedEndpoints");
    if(p != props.end())
    {
        _endpoints = p->second;
    }
    else
    {
        _endpoints = properties->getProperty(endpointsPrefix + ".Endpoints");
    }

    string cwd;
    if(IceUtilInternal::getcwd(cwd) != 0)
    {
        throw "cannot get the current directory:\n" + IceUtilInternal::lastErrorToString();
    }
    _cwd = string(cwd);

    _dataDir = properties->getProperty(prefix + ".Data");    
    if(!IceUtilInternal::isAbsolutePath(_dataDir))
    {
        _dataDir = _cwd + '/' + _dataDir;
    }
    if(_dataDir[_dataDir.length() - 1] == '/')
    {
        _dataDir = _dataDir.substr(0, _dataDir.length() - 1);
    }
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:101,代码来源:PlatformInfo.cpp


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