本文整理汇总了C++中CIMInstance类的典型用法代码示例。如果您正苦于以下问题:C++ CIMInstance类的具体用法?C++ CIMInstance怎么用?C++ CIMInstance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CIMInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void _checkUint16Property
(CIMInstance & instance, const String & name, Uint16 value)
{
Uint32 pos = instance.findProperty (name);
PEGASUS_TEST_ASSERT (pos != PEG_NOT_FOUND);
CIMProperty theProperty = instance.getProperty (pos);
CIMValue theValue = theProperty.getValue ();
PEGASUS_TEST_ASSERT (theValue.getType () == CIMTYPE_UINT16);
PEGASUS_TEST_ASSERT (!theValue.isArray ());
PEGASUS_TEST_ASSERT (!theValue.isNull ());
Uint16 result;
theValue.get (result);
if (verbose)
{
if (result != value)
{
cerr << "Property value comparison failed. ";
cerr << "Expected " << value << "; ";
cerr << "Actual property value was " << result << "." << endl;
}
}
PEGASUS_TEST_ASSERT (result == value);
}
示例2: setPropertyValue
void setPropertyValue(CIMInstance& instance, const CIMName& propertyName,
const Uint32 value)
{
Uint32 pos;
PEGASUS_ASSERT(pos = instance.findProperty(propertyName) != PEG_NOT_FOUND);
instance.getProperty(pos).setValue(CIMValue(value));
}
示例3: filters
/**
***************************************************************************
_filterAssociationInstances is used to filter the set of possible return
instances against the filters (resultClass and resultRole) provided with
the associators and associatorNames operations. It returns the ObjectPaths
of the set of objects that pass the filter tests.
@param assocInstance - The target association class instance
@param sourceObjectPath - The source ObjectPath
@param resultClass - The result class. If there is no resultClass,
this is String::EMPTY.
@param resultRole - The result role. If there is no role, this is
String::EMPTY
@return the ObjectPaths of the set of association instances that pass
the filter tests.
***************************************************************************
*/
Array<CIMObjectPath> RUEpProvider::_filterAssociationInstances(
CIMInstance& assocInstance,
const CIMObjectPath& sourceObjectPath,
CIMName resultClass,
String resultRole)
{
Array<CIMObjectPath> returnPaths;
// get all Reference properties
for (Uint32 i = 0, n = assocInstance.getPropertyCount(); i < n; i++)
{
CIMProperty p = assocInstance.getProperty(i);
if (p.getType() == CIMTYPE_REFERENCE)
{
CIMValue v = p.getValue();
CIMObjectPath path;
v.get(path);
if (!sourceObjectPath.identical(path))
{
if (resultClass.isNull() || resultClass == path.getClassName())
{
if (resultRole == String::EMPTY ||
(p.getName() == CIMName(resultRole)))
{
returnPaths.append(path);
}
}
}
}
}
return returnPaths;
}
示例4: checkBlocked
static void checkBlocked(CIMInstance &pm)
{
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "checkBlocked");
Array<Uint16> operationalStatus;
Uint32 pos = pm.findProperty(CIMName ("OperationalStatus"));
if(pos == PEG_NOT_FOUND) {
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
"OperationalStatus not found.");
PEG_METHOD_EXIT();
//l10n
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "provider lookup failed.");
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
"ProviderManager.ProviderManagerService.PROVIDER_LOOKUP_FAILED",
"provider lookup failed."));
}
pm.getProperty(pos).getValue().get(operationalStatus);
for(Uint32 i = 0; i < operationalStatus.size(); i++) {
if(operationalStatus[i] == _MODULE_STOPPED ||
operationalStatus[i] == _MODULE_STOPPING) {
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
"Provider blocked.");
PEG_METHOD_EXIT();
//l10n
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, "provider blocked.");
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED, MessageLoaderParms(
"ProviderManager.ProviderManagerService.PROVIDER_BLOCKED",
"provider blocked."));
}
}
}
示例5: getInstance
CIMInstance CIMClient::getInstance(
const CIMNamespaceName& nameSpace,
const CIMObjectPath& instanceName,
Boolean localOnly,
Boolean includeQualifiers,
Boolean includeClassOrigin,
const CIMPropertyList& propertyList)
{
CIMInstance inst = _rep->getInstance(
nameSpace,
instanceName,
localOnly,
includeQualifiers,
includeClassOrigin,
propertyList).getInstance();
if (!inst.isUninitialized())
{
// remove key bindings, name space and host name form object path.
CIMObjectPath& p =
const_cast<CIMObjectPath&>(inst.getPath());
CIMName cls = p.getClassName();
p.clear();
p.setClassName(cls);
}
return inst;
}
示例6: getPropertyValue
CIMValue CIMHelper::getPropertyValue(const CIMInstance &instanceObject, String name)
{
CIMName cname(name);
Uint32 index = instanceObject.findProperty(cname);
if (index == PEG_NOT_FOUND) return CIMValue();
CIMConstProperty property = instanceObject.getProperty(index);
return property.getValue();
}
示例7: exportIndication
void CIMExportClient::exportIndication(
const String& url,
const CIMInstance& instanceName,
const ContentLanguageList& contentLanguages)
{
PEG_METHOD_ENTER (TRC_EXPORT_CLIENT, "CIMExportClient::exportIndication()");
try
{
// encode request
CIMRequestMessage* request = new CIMExportIndicationRequestMessage(
String::EMPTY,
url,
instanceName,
QueueIdStack(),
String::EMPTY,
String::EMPTY);
request->operationContext.set
(ContentLanguageListContainer(contentLanguages));
PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
"Exporting %s Indication for destination %s:%d%s",
(const char*)(instanceName.getClassName().getString().
getCString()),
(const char*)(_connectHost.getCString()), _connectPortNumber,
(const char*)(url.getCString())));
Message* message = _doRequest(request,
CIM_EXPORT_INDICATION_RESPONSE_MESSAGE);
PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
"%s Indication for destination %s:%d%s exported successfully",
(const char*)(instanceName.getClassName().getString().
getCString()),
(const char*)(_connectHost.getCString()), _connectPortNumber,
(const char*)(url.getCString())));
CIMExportIndicationResponseMessage* response =
(CIMExportIndicationResponseMessage*)message;
AutoPtr<CIMExportIndicationResponseMessage> ap(response);
}
catch (const Exception& e)
{
PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
"Failed to export indication: %s",
(const char*)e.getMessage().getCString()));
throw;
}
catch (...)
{
PEG_TRACE_CSTRING (TRC_DISCARDED_DATA, Tracer::LEVEL1,
"Failed to export indication");
throw;
}
PEG_METHOD_EXIT();
}
示例8: _checkValue
static Boolean _checkValue(
CIMInstance &instance,
const String &prop,
T value)
{
T lvalue;
instance.getProperty(instance.findProperty(prop)).getValue().get(lvalue);
return lvalue == value;
}
示例9: _testPropertyValue
void _testPropertyValue(
CIMInstance& instance,
const CIMName& propertyName,
const CIMValue & testValue)
{
CIMValue value =
instance.getProperty(instance.findProperty(propertyName)).getValue();
PEGASUS_TEST_ASSERT(testValue == value);
}
示例10: gatherProperties
/**
gatherProperties method of the nisinfo Test Client
*/
void NISInfo::gatherProperties(CIMInstance &inst)
{
#ifdef DEBUG
cout << "NISInfo::gatherProperties()" << endl;
#endif
// don't have a try here - want it to be caught by caller
// loop through the properties
for (Uint32 j=0; j < inst.getPropertyCount(); j++)
{
CIMName propertyName = inst.getProperty(j).getName();
// only pull out those properties of interest (do not remove)
if (propertyName.equal (CIMName ("SystemCreationClassName")))
{
inst.getProperty(j).getValue().get(nisSystemCreationClassName);
} // end if SystemCreationClassName
if (propertyName.equal (CIMName ("SystemName")))
{
inst.getProperty(j).getValue().get(nisSystemName);
} // end if SystemName
if (propertyName.equal (CIMName ("CreationClassName")))
{
inst.getProperty(j).getValue().get(nisCreationClassName);
} // end if CreationClassName
if (propertyName.equal (CIMName ("Name")))
{
inst.getProperty(j).getValue().get(nisName);
} // end if Name
if (propertyName.equal (CIMName ("Caption")))
{
inst.getProperty(j).getValue().get(nisCaption);
} // end if Caption
if (propertyName.equal (CIMName ("Description")))
{
inst.getProperty(j).getValue().get(nisDescription);
} // end if Description
if (propertyName.equal (CIMName ("ServerType")))
{
inst.getProperty(j).getValue().get(nisServerType);
} // end if ServerType
if (propertyName.equal (CIMName ("ServerWaitFlag")))
{
inst.getProperty(j).getValue().get(nisServerWaitFlag);
} // end if ServerWaitFlag
} // end of for looping through properties
}
示例11: _propertyIdentical
Boolean _propertyIdentical(
const char* propertyName,
CIMInstance& instance1,
CIMInstance& instance2)
{
Uint32 pos = instance1.findProperty(propertyName);
CIMConstProperty p1 = instance1.getProperty(pos);
pos = instance2.findProperty(propertyName);
CIMConstProperty p2 = instance2.getProperty(pos);
return (p1.identical(p2));
}
示例12: gatherProperties
/**
gatherProperties method of the dnsinfo Test Client
*/
void DNSInfo::gatherProperties(CIMInstance &inst, Boolean cimFormat)
{
#ifdef DEBUG
cout << "DNSInfo::gatherProperties()" << endl;
#endif
// don't have a try here - want it to be caught by caller
// loop through the properties
for (Uint32 j=0; j < inst.getPropertyCount(); j++)
{
CIMName propertyName = inst.getProperty(j).getName();
// only pull out those properties of interest
if (propertyName.equal (CIMName ("SystemName")))
{
inst.getProperty(j).getValue().get(dnsSystemName);
} // end if SystemName
if (propertyName.equal (CIMName ("SystemCreationClassName")))
{
inst.getProperty(j).getValue().get(dnsSystemCreationClassName);
} // end if SystemCreationClassName
if (propertyName.equal (CIMName ("Name")))
{
inst.getProperty(j).getValue().get(dnsName);
} // end if Name
if (propertyName.equal (CIMName ("CreationClassName")))
{
inst.getProperty(j).getValue().get(dnsCreationClassName);
} // end if CreationClassName
if (propertyName.equal (CIMName ("Caption")))
{
inst.getProperty(j).getValue().get(dnsCaption);
} // end if Caption
if (propertyName.equal (CIMName ("Description")))
{
inst.getProperty(j).getValue().get(dnsDescription);
} // end if Description
if (propertyName.equal (CIMName ("SearchList")))
{
inst.getProperty(j).getValue().get(dnsSearchList);
} // end if SearchList
if (propertyName.equal (CIMName ("Addresses")))
{
inst.getProperty(j).getValue().get(dnsAddresses);
} // end if ServerAddress
} // end of for looping through properties
}
示例13: setPropertyValue
bool setPropertyValue(CIMInstance& instance, const CIMName& propertyName,
const CIMValue & value)
{
unsigned int pos = instance.findProperty(propertyName);
if(pos != PEG_NOT_FOUND)
{
instance.getProperty(pos).setValue(value);
return true;
}
return false;
}
示例14: handler
CIMObjectPath _createHandler
(CIMClient & client,
const String & name,
const String & destination)
{
CIMInstance handler (HANDLER_CLASSNAME);
handler.addProperty (CIMProperty (CIMName ("Name"), name));
handler.addProperty (CIMProperty (CIMName ("Destination"), destination));
CIMObjectPath path = client.createInstance (INTEROPNAMESPACE, handler);
return path;
}
示例15: PEG_METHOD_ENTER
/////////////////////////////////////////////////////////////////////////////
// WMIInstanceProvider::getProperty
//
// ///////////////////////////////////////////////////////////////////////////
CIMValue WMIInstanceProvider::getProperty(
const String& nameSpace,
const String& userName,
const String& password,
const CIMObjectPath& instanceName,
const String& propertyName)
{
CIMInstance cimInstance;
Array<CIMName> propertyNames;
PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIInstanceProvider::getProperty()");
setup(nameSpace,userName,password);
if (!m_bInitialized)
{
throw CIMException(CIM_ERR_FAILED, "[getProperty] m_bInitialized");
}
CIMName propName = propertyName;
propertyNames.append(propName);
CIMPropertyList propertyList = CIMPropertyList(propertyNames);
// get the relevant CIMInstance object
cimInstance = getCIMInstance(nameSpace,
userName,
password,
instanceName,
propertyList);
// now fetch the property
Uint32 pos = cimInstance.findProperty(propName);
if (PEG_NOT_FOUND == pos)
{
throw CIMException(CIM_ERR_NO_SUCH_PROPERTY,
"[getProperty] findproperty");
}
CIMProperty property = cimInstance.getProperty(pos);
// and return the value
CIMValue value = property.getValue();
PEG_METHOD_EXIT();
return value;
}