本文整理汇总了C++中Computer::getStorage方法的典型用法代码示例。如果您正苦于以下问题:C++ Computer::getStorage方法的具体用法?C++ Computer::getStorage怎么用?C++ Computer::getStorage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Computer
的用法示例。
在下文中一共展示了Computer::getStorage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateResource
bool Manager::updateResource(GenericResource* resource)
{
YarpBroker broker;
broker.init();
Computer* comp = dynamic_cast<Computer*>(resource);
if(!comp || !strlen(comp->getName()))
return false;
if(compareString(comp->getName(), "localhost"))
return false;
yarp::os::SystemInfoSerializer info;
string strServer = comp->getName();
if(strServer[0] != '/')
strServer = string("/") + strServer;
if(!broker.getSystemInfo(strServer.c_str(), info))
{
logger->addError(broker.error());
comp->setAvailability(false);
}
else
{
comp->setAvailability(true);
comp->getMemory().setTotalSpace(info.memory.totalSpace*1024);
comp->getMemory().setFreeSpace(info.memory.freeSpace*1024);
comp->getStorage().setTotalSpace(info.storage.totalSpace*1024);
comp->getStorage().setFreeSpace(info.storage.freeSpace*1024);
//comp->getNetwork().setIP4(info.network.ip4.c_str());
//comp->getNetwork().setIP6(info.network.ip6.c_str());
//comp->getNetwork().setMAC(info.network.mac.c_str());
comp->getProcessor().setArchitecture(info.processor.architecture.c_str());
comp->getProcessor().setCores(info.processor.cores);
comp->getProcessor().setSiblings(info.processor.siblings);
comp->getProcessor().setFrequency(info.processor.frequency);
comp->getProcessor().setModel(info.processor.model.c_str());
LoadAvg load;
load.loadAverageInstant = (double)info.load.cpuLoadInstant;
load.loadAverage1 = info.load.cpuLoad1;
load.loadAverage5 = info.load.cpuLoad5;
load.loadAverage15 = info.load.cpuLoad15;
comp->getProcessor().setCPULoad(load);
comp->getPlatform().setName(info.platform.name.c_str());
comp->getPlatform().setDistribution(info.platform.distribution.c_str());
comp->getPlatform().setRelease(info.platform.release.c_str());
}
return true;
}