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


C++ Configure::GetValueSize方法代码示例

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


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

示例1: config

void
ConfigureTest::testConfigure()
{
    ofstream config(configFile.c_str());
    config << Configure::CacheFreeMinPercent << " : 5" << endl;
    config << Configure::CacheFreeMaxPercent << " : 10" << endl;
    config << Configure::CacheFileSizeRead << " : 1000000000" << endl;
    config << Configure::FileMaxSize << " : 8000000000" << endl;

    Configure configure;
    configure.Refresh(fileConfig);
    CPPUNIT_ASSERT(
            configure.GetValue(Configure::CacheFreeMinPercent) == "5");
    CPPUNIT_ASSERT(
            configure.GetValueSize(Configure::CacheFreeMinPercent) == 5);
    CPPUNIT_ASSERT(
            configure.GetValue(Configure::CacheFreeMaxPercent) == "10");
    CPPUNIT_ASSERT(
            configure.GetValueSize(Configure::CacheFreeMaxPercent) == 10);
    CPPUNIT_ASSERT(
            configure.GetValue(Configure::CacheFileSizeRead) == "1000000000");
    CPPUNIT_ASSERT(
            configure.GetValueSize(Configure::CacheFileSizeRead)
                == 1000000000LL );
    CPPUNIT_ASSERT(
            configure.GetValue(Configure::FileMaxSize) == "8000000000");
    CPPUNIT_ASSERT(
            configure.GetValueSize(Configure::FileMaxSize) == 8000000000LL );
}
开发者ID:BDT-GER,项目名称:SWIFT-TLC,代码行数:29,代码来源:ConfigureTest.cpp

示例2: LogWarn

    CacheMonitorServer::CacheMonitorServer()
    : folderCache_(Factory::GetCacheFolder()),
      folderMeta_(Factory::GetMetaFolder()),
      run_(true),
      minFreeSize_(0), maxFreeSize_(0),
      thread_(boost::thread(&CacheMonitorServer::ServerThread,this))
    {
        struct statfs stat;
        if ( 0 != statfs(folderCache_.string().c_str(),&stat) ) {
            LogWarn(folderCache_);
            return;
        }
        off_t sizeFileSystemOnePercent =
                (off_t)stat.f_bsize * stat.f_blocks / 100;

        Configure * config = Factory::GetConfigure();

        minFreeSize_ = config->GetValueSize(Configure::CacheFreeMinSize);
        off_t sizeMinFreePercent = sizeFileSystemOnePercent
                * config->GetValueSize(Configure::CacheFreeMinPercent);
        minFreeSize_ = max(minFreeSize_,sizeMinFreePercent);
        LogDebug(minFreeSize_);

        maxFreeSize_ = config->GetValueSize(Configure::CacheFreeMaxSize);
        off_t sizeMaxFreePercent = sizeFileSystemOnePercent
                * config->GetValueSize(Configure::CacheFreeMaxPercent);
        maxFreeSize_ = max(maxFreeSize_,sizeMaxFreePercent);
        LogDebug(maxFreeSize_);
    }
开发者ID:BDT-GER,项目名称:SWIFT-TLC,代码行数:29,代码来源:CacheMonitorServer.cpp


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