本文整理汇总了C++中DataPtr::asDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ DataPtr::asDouble方法的具体用法?C++ DataPtr::asDouble怎么用?C++ DataPtr::asDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataPtr
的用法示例。
在下文中一共展示了DataPtr::asDouble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: index
BOOST_FIXTURE_TEST_CASE(manyReferenceTimesAndValidTimesCreatesTimeOffsetVariable, TimeHandlerFixture)
{
add("2011-05-29 00:00:00", "2011-05-29 00:00:00");
add("2011-05-30 00:00:00", "2011-05-29 00:00:00");
add("2011-05-30 00:00:00", "2011-05-30 00:00:00");
add("2011-05-31 00:00:00", "2011-05-30 00:00:00");
WdbIndex index(gridData());
TimeHandler timeHandler(index);
timeHandler.addToCdm(cdm);
const CDMVariable & offsetVar = cdm.getVariable(TimeHandler::timeOffsetName);
DataPtr d = timeHandler.getData(offsetVar, 0);
BOOST_REQUIRE_EQUAL(2, d->size());
boost::shared_array<double> array = d->asDouble();
BOOST_CHECK_EQUAL(0, array[0]);
BOOST_CHECK_EQUAL(24*60*60, array[1]);
const std::vector<std::string> & shape = offsetVar.getShape();
BOOST_REQUIRE_EQUAL(1, shape.size());
BOOST_CHECK_EQUAL(TimeHandler::timeOffsetName, shape[0]);
CHECK_ATTRIBUTE(TimeHandler::timeOffsetName, "long_name", "offset since referenceTime");
CHECK_ATTRIBUTE(TimeHandler::timeOffsetName, "units", "seconds");
const CDMDimension & dim = cdm.getDimension(TimeHandler::timeOffsetName);
BOOST_CHECK_EQUAL(2, dim.getLength());
}