本文整理汇总了C++中CIMInstance::getProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMInstance::getProperty方法的具体用法?C++ CIMInstance::getProperty怎么用?C++ CIMInstance::getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMInstance
的用法示例。
在下文中一共展示了CIMInstance::getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _gatherProperties
////////////////////////////////////////////////////////////////////////////////
// Gather Properities for Next Hop IP Route Info
////////////////////////////////////////////////////////////////////////////////
void NextHopIPRouteInfo::_gatherProperties(CIMInstance &inst)
{
_ipInstanceID = String::EMPTY;
_ipIPDestAddr = String::EMPTY;
_ipIPDestMask = String::EMPTY;
_ipAddrType = 0; // Unknown
_ipCaption = String::EMPTY;
_ipDescription = String::EMPTY;
_ipName = String::EMPTY;
for (Uint32 j=0; j < inst.getPropertyCount(); j++)
{
CIMName propertyName = inst.getProperty(j).getName();
// Properties that are also keys
if (propertyName.equal("InstanceID"))
{
inst.getProperty(j).getValue().get(_ipInstanceID);
}
// Other properties
else if (propertyName.equal("Caption"))
{
inst.getProperty(j).getValue().get(_ipCaption);
}
else if (propertyName.equal("Description"))
{
inst.getProperty(j).getValue().get(_ipDescription);
}
else if (propertyName.equal("Name"))
{
inst.getProperty(j).getValue().get(_ipName);
}
else if (propertyName.equal("DestinationAddress"))
{
inst.getProperty(j).getValue().get(_ipIPDestAddr);
}
else if (propertyName.equal("DestinationMask"))
{
inst.getProperty(j).getValue().get(_ipIPDestMask);
}
else if (propertyName.equal("AddressType"))
{
inst.getProperty(j).getValue().get(_ipAddrType);
}
else if (propertyName.equal("PrefixLength"))
{
inst.getProperty(j).getValue().get(_ipPrefixLength);
}
else if (propertyName.equal(PROPERTY_NEXT_HOP))
{
inst.getProperty(j).getValue().get(_ipNextHop);
}
} // end for loop through properties
}
示例2: _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));
}
示例3: setInstance
void CIMError::setInstance(const CIMInstance& instance)
{
for (Uint32 i = 0; i < instance.getPropertyCount(); i++)
{
CIMConstProperty p = instance.getProperty(i);
_Check("ErrorType", p, (Uint16*)0);
_Check("OtherErrorType", p, (String*)0);
_Check("OwningEntity", p, (String*)0);
_Check("MessageID", p, (String*)0);
_Check("Message", p, (String*)0);
_Check("MessageArguments", p, (Array<String>*)0);
_Check("PerceivedSeverity", p, (Uint16*)0);
_Check("ProbableCause", p, (Uint16*)0);
_Check("ProbableCauseDescription", p, (String*)0);
_Check("RecommendedActions", p, (Array<String>*)0);
_Check("ErrorSource", p, (String*)0);
_Check("ErrorSourceFormat", p, (Uint16*)0);
_Check("OtherErrorSourceFormat", p, (String*)0);
_Check("CIMStatusCode", p, (Uint32*)0);
_Check("CIMStatusCodeDescription", p, (String*)0);
}
// Verify that the instance contains all of the required properties.
for (Uint32 i = 0; i < _numRequiredProperties; i++)
{
// Does inst have this property?
Uint32 pos = instance.findProperty(_requiredProperties[i]);
if (pos == PEG_NOT_FOUND)
{
char buffer[80];
sprintf(buffer, "required property does not exist: %s",
_requiredProperties[i]);
throw CIMException(CIM_ERR_NO_SUCH_PROPERTY, buffer);
}
// is required property non-null?
CIMConstProperty p = instance.getProperty(pos);
CIMValue v = p.getValue();
if (v.isNull())
{
char buffer[80];
sprintf(buffer, "required property MUST NOT be Null: %s",
_requiredProperties[i]);
throw CIMException(CIM_ERR_FAILED, buffer);
}
}
_inst = instance;
}
示例4: 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
}
示例5: 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
}
示例6: Run
void UNIX_ApplicationSystemDirectoryFixture::Run()
{
CIMName className("UNIX_ApplicationSystemDirectory");
CIMNamespaceName nameSpace("root/cimv2");
UNIX_ApplicationSystemDirectory _p;
UNIX_ApplicationSystemDirectoryProvider _provider;
Uint32 propertyCount;
CIMOMHandle omHandle;
_provider.initialize(omHandle);
_p.initialize();
for(int pIndex = 0; _p.load(pIndex); pIndex++)
{
CIMInstance instance = _provider.constructInstance(className,
nameSpace,
_p);
CIMObjectPath path = instance.getPath();
cout << path.toString() << endl;
propertyCount = instance.getPropertyCount();
for(Uint32 i = 0; i < propertyCount; i++)
{
CIMProperty propertyItem = instance.getProperty(i);
if (propertyItem.getType() == CIMTYPE_REFERENCE) {
CIMValue subValue = propertyItem.getValue();
CIMInstance subInstance;
subValue.get(subInstance);
CIMObjectPath subPath = subInstance.getPath();
cout << " Name: " << propertyItem.getName().getString() << ": " << subPath.toString() << endl;
Uint32 subPropertyCount = subInstance.getPropertyCount();
for(Uint32 j = 0; j < subPropertyCount; j++)
{
CIMProperty subPropertyItem = subInstance.getProperty(j);
cout << " Name: " << subPropertyItem.getName().getString() << " - Value: " << subPropertyItem.getValue().toString() << endl;
}
}
else {
cout << " Name: " << propertyItem.getName().getString() << " - Value: " << propertyItem.getValue().toString() << endl;
}
}
cout << "------------------------------------" << endl;
cout << endl;
}
_p.finalize();
}
示例7: _getPropertyValue
/*
Return the value in a property.
If the property cannot be found, return false
*/
Boolean _getPropertyValue(const CIMInstance& inst,
const CIMName name,
CIMValue& val)
{
#ifdef ENABLE_LOCAL_DIAGNOSTICS
DCOUT << "Instance from which to retrieve "
<< inst.getClassName().getString() << " propertyName "
<< name.getString() << endl;
#endif
unsigned int pos = inst.findProperty(name);
if (pos==PEG_NOT_FOUND)
{
#ifdef ENABLE_LOCAL_DIAGNOSTICS
DCOUT << "property " << name.getString() << " pos " << pos
<< " NOT found" << endl;
#endif
return false;
}
#ifdef ENABLE_LOCAL_DIAGNOSTICS
DCOUT << "property " << name.getString() << " FOUND" << endl;
#endif
val=inst.getProperty(pos).getValue();
return true;
}
示例8: 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."));
}
}
}
示例9: 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));
}
示例10: loadInstance
Boolean UNIX_BGPPeerUsesRouteMap::loadInstance(const CIMInstance &instance)
{
clearInstance();
Uint32 propertyCount = instance.getPropertyCount();
for(Uint32 i = 0; i < propertyCount; i++) {
CIMConstProperty property = instance.getProperty(i);
if (String::equal(property.getName().getString(), "Collection"))
{
CIMInstance collectionValue;
property.getValue().get(collectionValue);
setCollection(collectionValue);
}
else if (String::equal(property.getName().getString(), "Member"))
{
CIMInstance memberValue;
property.getValue().get(memberValue);
setMember(memberValue);
}
else if (String::equal(property.getName().getString(), "MapSequence"))
{
Uint16 mapSequenceValue;
property.getValue().get(mapSequenceValue);
setMapSequence(mapSequenceValue);
}
}
return true;
}
示例11: loadInstance
Boolean UNIX_AssociatedSupplyCurrentSensor::loadInstance(const CIMInstance &instance)
{
clearInstance();
Uint32 propertyCount = instance.getPropertyCount();
for(Uint32 i = 0; i < propertyCount; i++) {
CIMConstProperty property = instance.getProperty(i);
if (String::equal(property.getName().getString(), "Antecedent"))
{
CIMInstance antecedentValue;
property.getValue().get(antecedentValue);
setAntecedent(antecedentValue);
}
else if (String::equal(property.getName().getString(), "Dependent"))
{
CIMInstance dependentValue;
property.getValue().get(dependentValue);
setDependent(dependentValue);
}
else if (String::equal(property.getName().getString(), "MonitoringRange"))
{
Uint16 monitoringRangeValue;
property.getValue().get(monitoringRangeValue);
setMonitoringRange(monitoringRangeValue);
}
}
return true;
}
示例12: getPropertiesFromCIMServer
void getPropertiesFromCIMServer(
CIMClient& client,
const CIMName& propName,
Array <String>& propValues)
{
CIMProperty prop;
Array<CIMKeyBinding> kbArray;
CIMKeyBinding kb;
String _hostName;
kb.setName(PROPERTY_NAME);
kb.setValue(propName.getString());
kb.setType(CIMKeyBinding::STRING);
_hostName.assign(System::getHostName());
kbArray.append(kb);
CIMObjectPath reference(_hostName, PEGASUS_NAMESPACENAME_CONFIG,
PEGASUS_CLASSNAME_CONFIGSETTING, kbArray);
CIMInstance cimInstance = client.getInstance(PEGASUS_NAMESPACENAME_CONFIG,
reference);
Uint32 pos = cimInstance.findProperty(PROPERTY_NAME);
prop = (CIMProperty)cimInstance.getProperty(pos);
propValues.append(prop.getValue().toString());
pos = cimInstance.findProperty(DEFAULT_VALUE);
prop = (CIMProperty)cimInstance.getProperty(pos);
propValues.append(prop.getValue().toString());
pos = cimInstance.findProperty(CURRENT_VALUE);
prop = (CIMProperty)cimInstance.getProperty(pos);
propValues.append(prop.getValue().toString());
pos = cimInstance.findProperty(PLANNED_VALUE);
prop = (CIMProperty)cimInstance.getProperty(pos);
propValues.append(prop.getValue().toString());
pos = cimInstance.findProperty(DYNAMIC_PROPERTY);
prop = (CIMProperty)cimInstance.getProperty(pos);
propValues.append(prop.getValue().toString());
}
示例13: 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();
}
示例14: _checkValue
static Boolean _checkValue(
CIMInstance &instance,
const String &prop,
T value)
{
T lvalue;
instance.getProperty(instance.findProperty(prop)).getValue().get(lvalue);
return lvalue == value;
}
示例15: findConsumerProvider
ProviderName ProviderRegistrar::findConsumerProvider(const String & destinationPath)
{
CIMInstance provider;
CIMInstance providerModule;
ProviderName temp;
if (_prm->lookupIndicationConsumer(destinationPath,provider,providerModule))
return ProviderName(
provider.getProperty(provider.findProperty
("Name")).getValue ().toString (),
providerModule.getProperty(providerModule.findProperty
("Location")).getValue().toString(),
providerModule.getProperty(providerModule.findProperty
("InterfaceType")).getValue().toString(),
0);
return temp;
}