本文整理汇总了C++中Dimensions::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Dimensions::clear方法的具体用法?C++ Dimensions::clear怎么用?C++ Dimensions::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dimensions
的用法示例。
在下文中一共展示了Dimensions::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testWithNodeType
void RegionTest::testWithNodeType(const std::string& nodeType)
{
Region *rP = NULL;
SHOULDFAIL ( rP = new Region("r1", "nosuchnode", "") );
Region r("r1", nodeType, "");
TEST(r.getName() == "r1");
TEST(r.getType() == nodeType);
Dimensions d = r.getDimensions();
TEST(d.isUnspecified());
d.clear();
d.push_back(3);
d.push_back(2);
r.setDimensions(d);
Dimensions d2 = r.getDimensions();
TEST(d2.size() == 2);
TEST(d2[0] == 3);
TEST(d2[1] == 2);
TEST(d2.getCount() == 6);
// Parameter testing
{
{
Int32 val = -(1 << 24);
TESTEQUAL((Int32)32, r.getParameterInt32("int32Param"));
r.setParameterInt32("int32Param", val);
TESTEQUAL(val, r.getParameterInt32("int32Param"));
}
{
UInt32 val = 1 << 24;
TESTEQUAL((UInt32)33, r.getParameterUInt32("uint32Param"));
r.setParameterUInt32("uint32Param", val);
TESTEQUAL(val, r.getParameterUInt32("uint32Param"));
}
{
Int64 val = -((Int64)1 << 44);
TESTEQUAL((Int64)64, r.getParameterInt64("int64Param"));
r.setParameterInt64("int64Param", val);
TESTEQUAL(val, r.getParameterInt64("int64Param"));
}
{
UInt64 val = (UInt64)1 << 45;
TESTEQUAL((UInt64)65, r.getParameterUInt64("uint64Param"));
r.setParameterUInt64("uint64Param", val);
TESTEQUAL(r.getParameterUInt64("uint64Param"), val);
}
{
Real32 val = 23456.7;
TESTEQUAL((Real32)32.1, r.getParameterReal32("real32Param"));
r.setParameterReal32("real32Param", val);
TESTEQUAL(r.getParameterReal32("real32Param"), val);
}
{
Real64 val = 23456.789;
TESTEQUAL((Real64)64.1, r.getParameterReal64("real64Param"));
r.setParameterReal64("real64Param", val);
TESTEQUAL(r.getParameterReal64("real64Param"), val);
}
{
Array a(NTA_BasicType_Int64);
r.getParameterArray("int64ArrayParam", a);
// check default values
TESTEQUAL((size_t)4, a.getCount());
Int64 *buf = (Int64*) a.getBuffer();
TEST(buf != NULL);
for (UInt64 i = 0; i < 4; i++)
TESTEQUAL((Int64)(i*64), buf[i]);
// set our own value
buf[0] = 100;
r.setParameterArray("int64ArrayParam", a);
// make sure we retrieve the value just set
buf[0] = 0;
r.getParameterArray("int64ArrayParam", a);
TEST(buf == a.getBuffer());
TESTEQUAL((Int64)100, buf[0]);
}
{
std::string s = r.getParameterString("stringParam");
TESTEQUAL("nodespec value", s);
s = "new value";
r.setParameterString("stringParam", s);
s = r.getParameterString("stringParam");
TESTEQUAL("new value", s);
}
//.........这里部分代码省略.........