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


C++ PropertiesPtr类代码示例

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


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

示例1:

void
RegistryI::setupThreadPool(const PropertiesPtr& properties, const string& name, int size, int sizeMax)
{
    if(properties->getPropertyAsIntWithDefault(name + ".Size", 0) < size)
    {
        ostringstream os;
        os << size;
        properties->setProperty(name + ".Size", os.str());
    }
    else
    {
        size = properties->getPropertyAsInt(name + ".Size");
    }

    if(sizeMax > 0 && properties->getPropertyAsIntWithDefault(name + ".SizeMax", 0) < sizeMax)
    {
        if(size >= sizeMax)
        {
            sizeMax = size * 10;
        }
        
        ostringstream os;
        os << sizeMax;
        properties->setProperty(name + ".SizeMax", os.str());
    }
}
开发者ID:updowndown,项目名称:myffff,代码行数:26,代码来源:RegistryI.cpp

示例2: communicator

void
IceSSL::SSLEngine::initialize()
{
    const string propPrefix = "IceSSL.";
    const PropertiesPtr properties = communicator()->getProperties();

    //
    // CheckCertName determines whether we compare the name in a peer's
    // certificate against its hostname.
    //
    _checkCertName = properties->getPropertyAsIntWithDefault(propPrefix + "CheckCertName", 0) > 0;

    //
    // VerifyDepthMax establishes the maximum length of a peer's certificate
    // chain, including the peer's certificate. A value of 0 means there is
    // no maximum.
    //
    _verifyDepthMax = properties->getPropertyAsIntWithDefault(propPrefix + "VerifyDepthMax", 3);

    //
    // VerifyPeer determines whether certificate validation failures abort a connection.
    //
    _verifyPeer = properties->getPropertyAsIntWithDefault(propPrefix + "VerifyPeer", 2);

    if(_verifyPeer < 0 || _verifyPeer > 2)
    {
        throw PluginInitializationException(__FILE__, __LINE__, "IceSSL: invalid value for " + propPrefix +
                                            "VerifyPeer");
    }

    _securityTraceLevel = properties->getPropertyAsInt("IceSSL.Trace.Security");
    _securityTraceCategory = "Security";
}
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:33,代码来源:SSLEngine.cpp

示例3: MCE_INFO

void MonitorAnalyzerI::reload(const Current& current) {
  MCE_INFO("MonitorAnalyzerI::reload");
  PropertiesPtr properties = Ice::createProperties();
  properties->load(CONFIG);
  mashineavailablememoryanalyzer_->reload(properties);
  mashineloadanalyzer_->reload(properties);
  mashinediskanalyzer_->reload(properties);
}
开发者ID:gunner14,项目名称:old_rr_code,代码行数:8,代码来源:MonitorAnalyzerI.cpp

示例4: if

MetricsMapI::MetricsMapI(const std::string& mapPrefix, const PropertiesPtr& properties) :
    _properties(properties->getPropertiesForPrefix(mapPrefix)),
    _retain(properties->getPropertyAsIntWithDefault(mapPrefix + "RetainDetached", 10)),
    _accept(parseRule(properties, mapPrefix + "Accept")),
    _reject(parseRule(properties, mapPrefix + "Reject"))
{
    validateProperties(mapPrefix, properties);

    string groupBy = properties->getPropertyWithDefault(mapPrefix + "GroupBy", "id");
    vector<string>& groupByAttributes = const_cast<vector<string>&>(_groupByAttributes);
    vector<string>& groupBySeparators = const_cast<vector<string>&>(_groupBySeparators);
    if(!groupBy.empty())
    {
        string v;
        bool attribute = IceUtilInternal::isAlpha(groupBy[0]) || IceUtilInternal::isDigit(groupBy[0]);
        if(!attribute)
        {
            groupByAttributes.push_back("");
        }
        
        for(string::const_iterator p = groupBy.begin(); p != groupBy.end(); ++p)
        {
            bool isAlphaNum = IceUtilInternal::isAlpha(*p) || IceUtilInternal::isDigit(*p) || *p == '.';
            if(attribute && !isAlphaNum)
            {
                groupByAttributes.push_back(v);
                v = *p;
                attribute = false;
            }
            else if(!attribute && isAlphaNum)
            {
                groupBySeparators.push_back(v);
                v = *p;
                attribute = true;
            }
            else
            {
                v += *p;
            }
        }

        if(attribute)
        {
            groupByAttributes.push_back(v);
        }
        else
        {
            groupBySeparators.push_back(v);
        }
    }
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:51,代码来源:MetricsAdminI.cpp

示例5: createProperties

Ice::PropertiesPtr
IceBox::ServiceManagerI::createServiceProperties(const string& service)
{
    PropertiesPtr properties;
    PropertiesPtr communicatorProperties = _communicator->getProperties();
    if(communicatorProperties->getPropertyAsInt("IceBox.InheritProperties") > 0)
    {
        properties = communicatorProperties->clone();
        properties->setProperty("Ice.Admin.Endpoints", ""); // Inherit all except Ice.Admin.Endpoints!
    }
    else
    {
        properties = createProperties();
    }
    
    string programName = communicatorProperties->getProperty("Ice.ProgramName");
    if(programName.empty())
    {
        properties->setProperty("Ice.ProgramName", service);
    }
    else
    {
        properties->setProperty("Ice.ProgramName", programName + "-" + service);
    }
    return properties;
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:26,代码来源:ServiceManagerI.cpp

示例6: getModelFileFromConfig

// look for ServiceNamex.TrainedModel
// Note that the x is significant
string ServiceManagerI::getModelFileFromConfig()
{
    CommunicatorPtr comm = mAdapter->getCommunicator();
    if ( comm )
    {
        PropertiesPtr props = comm->getProperties();
        if (props==true)
        {
            string propname = mServiceName + "x.TrainedModel";
            string propval = props->getProperty( propname );
            return propval;
        }
    }
    return "";
}
开发者ID:AlgorithemJourney,项目名称:CVAC,代码行数:17,代码来源:ServiceMan.cpp

示例7: initialize

    bool CPacketizer::initialize(PropertiesPtr properties)
    {
        Properties::iterator ret;
        ret=properties->find(std::string("hdrLength"));
        if (ret == properties->end())
        {
            LOG_ERROR("hdrLength not present in config file");
            return false;
        }
        else
        {
            int* hdr=boost::any_cast<int>(&(ret->second));
            if (hdr == NULL)
            {
                LOG_ERROR("hdrLength not an integer value");
            return false;
            }

            hdrLength_=*hdr;
        }

#if 0
        ret=(*serverDetails)->find(std::string("bodyLength"));
        if (ret == (*serverDetails)->end())
        {
            LOG_ERROR("bodyLength not present in config file");
            return false;
        }
        else
        {
            int* bodyLen=boost::any_cast<int>(&(ret->second));
            if (bodyLen == NULL)
            {
                LOG_ERROR("bodyLength not an integer value");
                return false;
            }

            bodyLength_=*bodyLen;
        }
#endif

        std::ostringstream tmp;
        tmp << "Cpacketize initialized with header length " << hdrLength_;
        LOG_DEBUG(tmp.str());
        return true;
    }
开发者ID:openglass,项目名称:openglass,代码行数:46,代码来源:Packetizer.cpp

示例8: network

IceInternal::TraceLevels::TraceLevels(const PropertiesPtr& properties) :
    network(0),
    networkCat("Network"),
    protocol(0),
    protocolCat("Protocol"),
    retry(0),
    retryCat("Retry"),
    location(0),
    locationCat("Locator"),
    slicing(0),
    slicingCat("Slicing"),
    gc(0),
    gcCat("GC"),
    threadPool(0),
    threadPoolCat("ThreadPool")
{
    const string keyBase = "Ice.Trace.";
    const_cast<int&>(network) = properties->getPropertyAsInt(keyBase + networkCat);
    const_cast<int&>(protocol) = properties->getPropertyAsInt(keyBase + protocolCat);
    const_cast<int&>(retry) = properties->getPropertyAsInt(keyBase + retryCat);
    const_cast<int&>(location) = properties->getPropertyAsInt(keyBase + locationCat);
    const_cast<int&>(slicing) = properties->getPropertyAsInt(keyBase + slicingCat);
    const_cast<int&>(gc) = properties->getPropertyAsInt(keyBase + gcCat);
    const_cast<int&>(threadPool) = properties->getPropertyAsInt(keyBase + threadPoolCat);
}
开发者ID:465060874,项目名称:ice,代码行数:25,代码来源:TraceLevels.cpp

示例9: run

int
run(int, char* argv[], const CommunicatorPtr& communicator)
{
    PropertiesPtr properties = communicator->getProperties();
    const char* managerProxyProperty = "IceStormAdmin.TopicManager.Default";
    string managerProxy = properties->getProperty(managerProxyProperty);
    if(managerProxy.empty())
    {
        cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
        return EXIT_FAILURE;
    }

    IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
        communicator->stringToProxy(managerProxy));
    if(!manager)
    {
        cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
        return EXIT_FAILURE;
    }

    TopicPrx topic;
    try
    {
        topic = manager->retrieve("single");
    }
    catch(const NoSuchTopic& e)
    {
        cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
        return EXIT_FAILURE;
        
    }
    assert(topic);

    //
    // Get a publisher object, create a twoway proxy and then cast to
    // a Single object.
    //
    SinglePrx single = SinglePrx::uncheckedCast(topic->getPublisher()->ice_twoway());
    for(int i = 0; i < 1000; ++i)
    {
        single->event(i);
    }

    return EXIT_SUCCESS;
}
开发者ID:pedia,项目名称:zeroc-ice,代码行数:45,代码来源:Publisher.cpp

示例10: getDataDir

std::string ServiceManagerI::getDataDir()
{
	PropertiesPtr props =
            mAdapter->getCommunicator()->getProperties();
	getVLogger().setLocalVerbosityLevel(props->getProperty("CVAC.ServicesVerbosity"));

	// Load the CVAC property: 'CVAC.DataDir'.  Used for the xml filename path,
        // and to provide a prefix to Runset paths
	std::string dataDir = props->getProperty("CVAC.DataDir");
	if(dataDir.empty()) 
	{
            localAndClientMsg(VLogger::WARN, NULL,
                              "Unable to locate CVAC Data directory, specified: "
                              "'CVAC.DataDir = path/to/dataDir' in config.service\n");
	}
	localAndClientMsg(VLogger::DEBUG, NULL,
                          "CVAC Data directory configured as: %s \n", dataDir.c_str());
    return dataDir;
}
开发者ID:AlgorithemJourney,项目名称:CVAC,代码行数:19,代码来源:ServiceMan.cpp

示例11: _feedback

IcePatch2::Patcher::Patcher(const CommunicatorPtr& communicator, const PatcherFeedbackPtr& feedback) :
    _feedback(feedback),
    _dataDir(getDataDir(communicator, ".")),
    _thorough(getThorough(communicator, 0) > 0),
    _chunkSize(getChunkSize(communicator, 100)),
    _remove(getRemove(communicator, 1)),
    _log(0)
{
    const PropertiesPtr properties = communicator->getProperties();
    const char* clientProxyProperty = "IcePatch2Client.Proxy";
    std::string clientProxy = properties->getProperty(clientProxyProperty);
    if(clientProxy.empty())
    {
        const char* endpointsProperty = "IcePatch2.Endpoints";
        string endpoints = properties->getProperty(endpointsProperty);
        if(endpoints.empty())
        {
            ostringstream os;
            os << "No proxy to IcePatch2 server. Please set `" << clientProxyProperty 
               << "' or `" << endpointsProperty << "'.";
            throw os.str();
        }
        ostringstream os;
        os << "The property " << endpointsProperty << " is deprecated, use " << clientProxyProperty << " instead.";
        communicator->getLogger()->warning(os.str());
        Identity id;
        id.category = properties->getPropertyWithDefault("IcePatch2.InstanceName", "IcePatch2");
        id.name = "server";
        
        clientProxy = "\"" + communicator->identityToString(id) + "\" :" + endpoints;
    }
    ObjectPrx serverBase = communicator->stringToProxy(clientProxy);
    
    FileServerPrx server = FileServerPrx::checkedCast(serverBase);
    if(!server)
    {
        throw "proxy `" + clientProxy + "' is not a file server.";
    }

    init(server);
}
开发者ID:sbesson,项目名称:zeroc-ice,代码行数:41,代码来源:ClientUtil.cpp

示例12: reload

void Analyzer::reload(const PropertiesPtr& properties) {
  MCE_INFO("Analyzer::reload type: " << type_);
  int defaultmin = properties->getPropertyAsIntWithDefault("Analyzer."+type_+".Default.Min", INT_MIN);
  int defaultmax = properties->getPropertyAsIntWithDefault("Analyzer."+type_+".Default.Max", INT_MAX);
  int defaultmoremin = properties->getPropertyAsIntWithDefault("Analyzer."+type_+".Default.MoreMin", INT_MIN);
  int defaultmoremax = properties->getPropertyAsIntWithDefault("Analyzer."+type_+".Default.MoreMax", INT_MAX);
  LimiterPtr defaulter = new Limiter(defaultmoremin, defaultmin, defaultmax, defaultmoremax);

  map<string, LimiterPtr> limits;
  PropertyDict patterns = properties->getPropertiesForPrefix("Analyzer."+type_+".Patterns");
  for (PropertyDict::iterator pattern = patterns.begin(); pattern != patterns.end(); ++pattern) {
    vector<string> strings;
    boost::algorithm::split(strings, pattern->second, boost::algorithm::is_any_of(" "));
    limits[strings.at(0)]=new Limiter(lexical_cast<int>(strings.at(1)),lexical_cast<int>(strings.at(2)),lexical_cast<int>(strings.at(3)),lexical_cast<int>(strings.at(4)));
  }
  {
    RWRecMutex::WLock lock(mutex_);
    limits_ = limits;
    default_ = defaulter;
  }
  MCE_DEBUG("Analyzer::reload done");
}
开发者ID:gunner14,项目名称:old_rr_code,代码行数:22,代码来源:MonitorAnalyzerI.cpp

示例13: readString

 void JsonSchema::readString(cJSON *childProperties, PropertiesPtr property)
 {
     cJSON *stringMax = cJSON_GetObjectItem(childProperties, "maxLength");
     if (stringMax)
     {
         cJSON *exclusiveMax = cJSON_GetObjectItem(childProperties, "exclusiveMaximum");
         if (exclusiveMax)
         {
             if (exclusiveMax->type == cJSON_True)
                 property->setMax (--(stringMax->valueint));
             else
                 property->setMax(stringMax->valueint);
         }
         else
             property->setMax(stringMax->valueint);
     }
     cJSON *stringMin = cJSON_GetObjectItem(childProperties, "minLength");
     if (stringMin)
     {
         cJSON *exclusiveMin = cJSON_GetObjectItem(childProperties, "exclusiveMinimum");
         if (exclusiveMin)
         {
             if (exclusiveMin->type == cJSON_True)
                 property->setMin( ++(stringMin->valueint));
             else
                 property->setMin(stringMin->valueint);
         }
         else
             property->setMin(stringMin->valueint);
     }
     cJSON *stringFormat = cJSON_GetObjectItem(childProperties, "format");
     if (stringFormat)
     {
         property->setFormat(stringFormat->valuestring);
     }
     cJSON *stringPattern = cJSON_GetObjectItem(childProperties, "pattern");
     if (stringPattern)
     {
         property->setPattern(stringPattern->valuestring);
     }
 }
开发者ID:TianyouLi,项目名称:iotivity,代码行数:41,代码来源:JsonSchema.cpp

示例14: if

Glacier2::FilterManagerPtr
Glacier2::FilterManager::create(const InstancePtr& instance, const string& userId, const bool allowAddUser)
{
    PropertiesPtr props = instance->properties();
    string allow = props->getProperty("Glacier2.Filter.Category.Accept");
    vector<string> allowSeq;
    stringToSeq(allow, allowSeq);

    if(allowAddUser)
    {
        int addUserMode = 0;
        if(!props->getProperty("Glacier2.Filter.Category.AcceptUser").empty())
        {
            addUserMode = props->getPropertyAsInt("Glacier2.Filter.Category.AcceptUser");
        }
       
        if(addUserMode > 0 && !userId.empty())
        {
            if(addUserMode == 1)
            {
                allowSeq.push_back(userId); // Add user id to allowed categories.
            }
            else if(addUserMode == 2)
            {
                allowSeq.push_back('_' + userId); // Add user id with prepended underscore to allowed categories.
            }
        }       
    }
    Glacier2::StringSetIPtr categoryFilter = new Glacier2::StringSetI(allowSeq);

    //
    // TODO: refactor initialization of filters.
    //
    allow = props->getProperty("Glacier2.Filter.AdapterId.Accept");
    stringToSeq(allow, allowSeq);
    Glacier2::StringSetIPtr adapterIdFilter = new Glacier2::StringSetI(allowSeq);

    //
    // TODO: Object id's from configurations?
    // 
    IdentitySeq allowIdSeq;
    allow = props->getProperty("Glacier2.Filter.Identity.Accept");
    stringToSeq(instance->communicator(), allow, allowIdSeq);
    Glacier2::IdentitySetIPtr identityFilter = new Glacier2::IdentitySetI(allowIdSeq);

    return new Glacier2::FilterManager(instance, categoryFilter, adapterIdFilter, identityFilter);
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:47,代码来源:FilterManager.cpp

示例15: readDouble

    void JsonSchema::readDouble(cJSON *childProperties,  PropertiesPtr property)
    {
        cJSON *Max = cJSON_GetObjectItem(childProperties, "maximum");
        if (Max)
        {
            cJSON *exclusiveMax = cJSON_GetObjectItem(childProperties, "exclusiveMaximum");
            if (exclusiveMax)
            {
                if (exclusiveMax->type == cJSON_True)
                    property->setMaxDouble( --(Max->valuedouble));
                else
                    property->setMaxDouble(Max->valuedouble);
            }
            else
                property->setMaxDouble(Max->valuedouble);
        }
        cJSON *Min = cJSON_GetObjectItem(childProperties, "minimum");
        if (Min)
        {
            cJSON *exclusiveMin = cJSON_GetObjectItem(childProperties, "exclusiveMinimum");
            if (exclusiveMin)
            {
                if (exclusiveMin->type == cJSON_True)
                    property->setMinDouble( ++(Min->valuedouble));
                else
                    property->setMinDouble(Min->valuedouble);
            }
            else
                property->setMinDouble(Min->valuedouble);
        }
        cJSON *multipleOf = cJSON_GetObjectItem(childProperties, "multipleOf");
        if (multipleOf)
        {
            property->setMultipleOf(multipleOf->valueint);
        }

    }
开发者ID:TianyouLi,项目名称:iotivity,代码行数:37,代码来源:JsonSchema.cpp


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