本文整理汇总了C++中CIMInstance::removeProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMInstance::removeProperty方法的具体用法?C++ CIMInstance::removeProperty怎么用?C++ CIMInstance::removeProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMInstance
的用法示例。
在下文中一共展示了CIMInstance::removeProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteInstance
void LifecycleIndicationProvider::deleteInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
ResponseHandler & handler)
{
// cout << "LifecycleIndicationProvider::deleteInstance()" << endl;
CIMInstance localInstance;
// convert a potential fully qualified reference into a local reference
// (class name and keys only).
CIMObjectPath localReference =
CIMObjectPath(
String(),
CIMNamespaceName(),
instanceReference.getClassName(),
instanceReference.getKeyBindings());
// begin processing the request
handler.processing();
// instance index corresponds to reference index
for(Uint32 i = 0, n = _instances.size(); i < n; i++)
{
if(localReference == _instances[i].getPath())
{
localInstance = _instances[i];
// remove instance from the array
_instances.remove(i);
break;
}
}
// complete processing the request
handler.complete();
// If there is at least one subscription active for the lifecycle indication
// InstDeletion_for_Sample_LifecycleIndicationProviderClass, then generate
// that indication here, embedding the just-deleted instance as the
// SourceInstance property. See LifecycleIndicationProviderR.mof.
if (_lifecycle_indications_enabled)
{
CIMInstance indicationInstance(
CIMName(
"InstDeletion_for_Sample_LifecycleIndicationProviderClass"));
CIMObjectPath path;
path.setNameSpace("root/SampleProvider");
path.setClassName(
"InstDeletion_for_Sample_LifecycleIndicationProviderClass");
indicationInstance.setPath(path);
char buffer[32];
sprintf(buffer, "%d", _nextUID++);
indicationInstance.addProperty
(CIMProperty ("IndicationIdentifier",String(buffer)));
CIMDateTime currentDateTime = CIMDateTime::getCurrentDateTime ();
indicationInstance.addProperty
(CIMProperty ("IndicationTime", currentDateTime));
// Before we send the Lifecycle Indication for the delete of this
// instance, change the "lastOp" property value to "deleteInstance".
Uint32 ix = localInstance.findProperty(CIMName("lastOp"));
if (ix != PEG_NOT_FOUND)
{
localInstance.removeProperty(ix);
localInstance.addProperty(
CIMProperty(
CIMName("lastOp"),
String("deleteInstance")));
}
indicationInstance.addProperty
(CIMProperty ("SourceInstance",CIMObject(localInstance)));
_indication_handler->deliver (indicationInstance);
// cout << "LifecycleIndicationProvider::deleteInstance() sent "
// "InstDeletion_for_Sample_LifecycleIndicationProviderClass"
// << endl;
}
}