本文整理汇总了C++中CIMInstance::filter方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMInstance::filter方法的具体用法?C++ CIMInstance::filter怎么用?C++ CIMInstance::filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMInstance
的用法示例。
在下文中一共展示了CIMInstance::filter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test04
//.........这里部分代码省略.........
pl1.clear();
pl1Array.append("blob");
pl1Array.append("ratio");
pl1.set(pl1Array);
CIMInstance newInstance = class1.buildInstance(false, true, pl1);
assert(newInstance.getPropertyCount() == 1);
assert(newInstance.findProperty("ratio") != PEG_NOT_FOUND);
assert(newInstance.findProperty("blob") == PEG_NOT_FOUND);
assert(newInstance.findProperty("message") == PEG_NOT_FOUND);
assert(newInstance.getQualifierCount() == 0);
}
///////////////////////////////////////////////////////////////////////
//
// Instance Filtering function tests
//
///////////////////////////////////////////////////////////////////////
// build instance as starting point for tests.
CIMInstance tstInstance =
class1.buildInstance(true, true, CIMPropertyList());
//
// Test complete copy, no change
//
{
if (verbose)
{
cout << "Test1" << endl;
}
CIMInstance filterInstance = tstInstance.clone();
filterInstance.filter(true, true, CIMPropertyList());
assert(tstInstance.identical(filterInstance));
assert(filterInstance.getPropertyCount() == 3);
assert(filterInstance.getQualifierCount() ==
tstInstance.getQualifierCount());
}
//
// Filter to one property, ratio
//
{
if (verbose)
{
cout << "Test2" << endl;
}
Array<CIMName> pl1Array;
pl1Array.append("ratio");
CIMPropertyList pl1(pl1Array);
CIMInstance filterInstance = tstInstance.clone();
filterInstance.filter(true, true, pl1);
if (verbose)
{
XmlWriter::printInstanceElement(filterInstance);
}
assert(filterInstance.getPropertyCount() == 1);
assert(filterInstance.findProperty("ratio") != PEG_NOT_FOUND);
assert(_propertyIdentical("ratio", filterInstance, tstInstance));