本文整理汇总了C++中CIMObjectPath::makeHashCode方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMObjectPath::makeHashCode方法的具体用法?C++ CIMObjectPath::makeHashCode怎么用?C++ CIMObjectPath::makeHashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMObjectPath
的用法示例。
在下文中一共展示了CIMObjectPath::makeHashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test02
void test02()
{
const CIMNamespaceName NAMESPACE = CIMNamespaceName("/zzz");
CIMClass cimClass(CIMName("MyClass"));
cimClass
.addProperty(CIMProperty(CIMName("Last"), String())
.addQualifier(CIMQualifier(CIMName("key"), true)))
.addProperty(CIMProperty(CIMName("First"), String())
.addQualifier(CIMQualifier(CIMName("key"), true)))
.addProperty(CIMProperty(CIMName("Age"), String())
.addQualifier(CIMQualifier(CIMName("key"), true)));
CIMInstance cimInstance(CIMName("MyClass"));
cimInstance.addProperty(CIMProperty(CIMName("first"), String("John")));
cimInstance.addProperty(CIMProperty(CIMName("last"), String("Smith")));
cimInstance.addProperty(CIMProperty(CIMName("age"), Uint8(101)));
assert(cimInstance.findProperty(CIMName("first")) != PEG_NOT_FOUND);
assert(cimInstance.findProperty(CIMName("last")) != PEG_NOT_FOUND);
assert(cimInstance.findProperty(CIMName("age")) != PEG_NOT_FOUND);
assert(cimInstance.getPropertyCount() == 3);
CIMObjectPath instanceName =
cimInstance.buildPath(CIMConstClass(cimClass));
CIMObjectPath tmp("myclass.age=101,first=\"John\",last=\"Smith\"");
assert(tmp.makeHashCode() == instanceName.makeHashCode());
// Test CIMInstance::buildPath with incomplete keys in the instance
Boolean caughtNoSuchPropertyException = false;
try
{
CIMInstance badInstance(CIMName("MyClass"));
badInstance.addProperty(CIMProperty(CIMName("first"), String("John")));
badInstance.addProperty(CIMProperty(CIMName("last"), String("Smith")));
CIMObjectPath instanceName =
badInstance.buildPath(CIMConstClass(cimClass));
}
catch (const NoSuchProperty&)
{
caughtNoSuchPropertyException = true;
}
assert(caughtNoSuchPropertyException);
}