本文整理汇总了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 );
}
示例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_);
}