本文整理汇总了C++中CIMName类的典型用法代码示例。如果您正苦于以下问题:C++ CIMName类的具体用法?C++ CIMName怎么用?C++ CIMName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CIMName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testInstanceCollection
void testInstanceCollection()
{
Buffer expected;
FileSystem::loadFileToMemory(expected, "./instanceCollection.json");
if (verbose) cout << "Expected: " << expected.getData() << endl;
Buffer outputBuffer;
JSONWriter writer(outputBuffer);
CIMName className = "className";
Array<CIMObject> instances;
for (Uint32 i = 0; i < 10; i++)
{
CIMInstance x(className);
x.addProperty(CIMProperty(CIMName("boolProp"), CIMValue(true)));
x.addProperty(CIMProperty(CIMName("intProp"), CIMValue(i)));
x.addProperty(CIMProperty(
CIMName("stringProp"),
CIMValue(String("hello world"))));
Buffer objPath;
objPath << className.getString() << ".intProp=" << i;
x.setPath(CIMObjectPath(objPath.getData()));
instances.append(x);
}
writer._append(instances);
if (verbose) cout << "Got: " << outputBuffer.getData() << endl;
PEGASUS_TEST_ASSERT(
System::strcasecmp(
expected.getData(),
outputBuffer.getData()) == 0);
}
示例2: testEnumInstanceNames
void testEnumInstanceNames(CIMClient& client,const char *ns)
{
Array<CIMObjectPath> refs;
refs = client.enumerateInstanceNames(ns,CIM_QUERYCAPCLASS_NAME);
if(refs.size() != 1) throw Exception("references.size() incorrect");
Array<CIMKeyBinding> keys = refs[0].getKeyBindings();
//-- make sure we're the right instance
CIMName keyName;
String keyValue;
if (keys.size() != NUM_KEY_PROPERTIES)
throw Exception("Wrong number of keys");
keyName = keys[0].getName();
keyValue = keys[0].getValue();
if(keyName.getString() != String(PROPERTY_NAME_INSTANCEID) )
throw Exception("Incorrect Key");
if(keyValue != String(INSTANCEID_VALUE))
throw Exception(keyValue);
}
示例3: find
Boolean UNIX_BGPPeerUsesRouteMap::find(const Array<CIMKeyBinding> &kbArray)
{
CIMKeyBinding kb;
String collectionKey;
String memberKey;
for(Uint32 i = 0; i < kbArray.size(); i++)
{
kb = kbArray[i];
CIMName keyName = kb.getName();
if (keyName.equal(PROPERTY_COLLECTION)) collectionKey = kb.getValue();
else if (keyName.equal(PROPERTY_MEMBER)) memberKey = kb.getValue();
}
/* Execute find with extracted keys */
for(int i = 0; load(i); i++) {
if ((String::equalNoCase(getCollection().getPath().toString(), collectionKey)) &&
(String::equalNoCase(getMember().getPath().toString(), memberKey)))
{
return true;
}
}
return false;
}
示例4: CIMNotSupportedException
void TestGroupingProvider2::invokeMethod(
const OperationContext& context,
const CIMObjectPath& objectReference,
const CIMName& methodName,
const Array<CIMParamValue>& inParameters,
MethodResultResponseHandler& handler)
{
if (!objectReference.getClassName().equal("Test_GroupingClass2"))
{
throw CIMNotSupportedException(
objectReference.getClassName().getString());
}
handler.processing();
if (methodName.equal("getNextIdentifier"))
{
handler.deliver(CIMValue(Uint32(getNextIdentifier())));
}
else if (methodName.equal("getSubscriptionCount"))
{
handler.deliver(CIMValue(_subscriptionCount));
}
handler.complete();
}
示例5: while
void
WQLFilterRep::enumInstances(
const String& ns,
const String& className,
CIMInstanceResultHandlerIFC& result,
EDeepFlag deep,
ELocalOnlyFlag localOnly, EIncludeQualifiersFlag includeQualifiers, EIncludeClassOriginFlag includeClassOrigin,
const StringArray* propertyList, EEnumSubclassesFlag enumSubclasses, OperationContext& context)
{
CIMName superClassName = m_inst.getClassName();
while (superClassName != CIMName())
{
if (superClassName == className)
{
// Don't need to do correct localOnly & deep processing.
//result.handleInstance(m_inst.clone(localOnly, includeQualifiers,
// includeClassOrigin, propertyList));
// This is more efficient
result.handle(m_inst);
break;
}
superClassName = m_pCIMServer->getClass(ns, superClassName.toString(),
E_NOT_LOCAL_ONLY, E_INCLUDE_QUALIFIERS, E_INCLUDE_CLASS_ORIGIN,
NULL, context).getSuperClass();
}
}
示例6: constructInstance
CIMInstance UNIX_AggregatePSExtentBasedOnAggregatePExtentProvider::constructInstance(
const CIMName &className,
const CIMNamespaceName &nameSpace,
const UNIX_AggregatePSExtentBasedOnAggregatePExtent &instanceObject) const
{
CIMProperty p;
CIMInstance inst(className);
// Set path
inst.setPath(CIMObjectPath(String(""), // hostname
nameSpace,
className,
constructKeyBindings(instanceObject)));
//CIM_Dependency Properties
if (instanceObject.getAntecedent(p)) inst.addProperty(p);
if (instanceObject.getDependent(p)) inst.addProperty(p);
if (className.equal("CIM_Dependency")) return inst;
//CIM_AbstractBasedOn Properties
if (instanceObject.getStartingAddress(p)) inst.addProperty(p);
if (instanceObject.getEndingAddress(p)) inst.addProperty(p);
if (instanceObject.getOrderIndex(p)) inst.addProperty(p);
if (className.equal("CIM_AbstractBasedOn")) return inst;
//CIM_BasedOn Properties
if (className.equal("CIM_BasedOn")) return inst;
//CIM_AggregatePSExtentBasedOnAggregatePExtent Properties
return inst;
}
开发者ID:brunolauze,项目名称:openpegasus-providers,代码行数:34,代码来源:UNIX_AggregatePSExtentBasedOnAggregatePExtentProvider.cpp
示例7: find
Boolean UNIX_ClusteringService::find(Array<CIMKeyBinding> &kbArray)
{
CIMKeyBinding kb;
String systemCreationClassNameKey;
String systemNameKey;
String creationClassNameKey;
String nameKey;
for(Uint32 i = 0; i < kbArray.size(); i++)
{
kb = kbArray[i];
CIMName keyName = kb.getName();
if (keyName.equal(PROPERTY_SYSTEM_CREATION_CLASS_NAME)) systemCreationClassNameKey = kb.getValue();
else if (keyName.equal(PROPERTY_SYSTEM_NAME)) systemNameKey = kb.getValue();
else if (keyName.equal(PROPERTY_CREATION_CLASS_NAME)) creationClassNameKey = kb.getValue();
else if (keyName.equal(PROPERTY_NAME)) nameKey = kb.getValue();
}
/* EXecute find with extracted keys */
return false;
}
示例8: _checkClass
/*
================================================================================
NAME : _checkClass
DESCRIPTION : tests the argument for valid classname,
: throws exception if not
ASSUMPTIONS : None
PRE-CONDITIONS :
POST-CONDITIONS :
NOTES :
================================================================================
*/
void UNIX_PROVIDER::_checkClass(CIMName& className)
{
if (!className.equal (_getClassCimName()) &&
!className.equal (_getBaseClassCimName()))
throw CIMNotSupportedException(className.getString() +
": Class not supported");
}
示例9: CIMPropertyList
const CIMPropertyList WQLSelectStatementRep::getSelectPropertyList(
const CIMObjectPath& inClassName) const
{
//
// Check for "*"
//
if (_allProperties)
{
//
// Return null CIMPropertyList for all properties
//
return CIMPropertyList ();
}
CIMName className = inClassName.getClassName();
if (className.isNull())
{
//
// If the caller passed in an empty className, then the FROM class is
// to be used
//
className = _className;
}
//
// Check if inClassName is the FROM class
//
if (!(className == _className))
{
//
// Check for NULL Query Context
//
if (_ctx == NULL)
{
MessageLoaderParms parms
("WQL.WQLSelectStatementRep.QUERY_CONTEXT_IS_NULL",
"Trying to process a query with a NULL Query Context.");
throw QueryRuntimeException(parms);
}
//
// Check if inClassName is a subclass of the FROM class
//
if (!_ctx->isSubClass(_className,className))
{
MessageLoaderParms parms
("WQL.WQLSelectStatementRep.CLASS_NOT_FROM_LIST_CLASS",
"Class $0 does not match the FROM class or any of its "
"subclasses.",
className.getString());
throw QueryRuntimeException(parms);
}
}
//
// Return CIMPropertyList for properties referenced in the projection
// list (SELECT clause)
//
return CIMPropertyList (_selectPropertyNames);
}
示例10: _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;
}
示例11: enumerateInstanceNames
void ComputerSystemProvider::enumerateInstanceNames(
const OperationContext& context,
const CIMObjectPath &ref,
ObjectPathResponseHandler& handler)
{
CIMName className = ref.getClassName();
_checkClass(className);
handler.processing();
// Deliver instance only if request was for leaf class
if (className.equal(CLASS_EXTENDED_COMPUTER_SYSTEM))
{
Array<CIMKeyBinding> keys;
keys.append(CIMKeyBinding(
PROPERTY_CREATION_CLASS_NAME,
CLASS_EXTENDED_COMPUTER_SYSTEM,
CIMKeyBinding::STRING));
keys.append(CIMKeyBinding(
PROPERTY_NAME,
_cs.getHostName(),
CIMKeyBinding::STRING));
handler.deliver(CIMObjectPath(
_cs.getHostName(),
ref.getNameSpace(),
CLASS_EXTENDED_COMPUTER_SYSTEM,
keys));
}
handler.complete();
return;
}
示例12: _checkClass
void ComputerSystemProvider::getInstance(
const OperationContext& context,
const CIMObjectPath& ref,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList& propertyList,
InstanceResponseHandler &handler)
{
CIMName className = ref.getClassName();
_checkClass(className);
Array<CIMKeyBinding> keys = ref.getKeyBindings();
//-- make sure we're the right instance
unsigned int keyCount = NUMKEYS_COMPUTER_SYSTEM;
CIMName keyName;
String keyValue;
if (keys.size() != keyCount)
{
throw CIMInvalidParameterException("Wrong number of keys");
}
for (unsigned int ii = 0; ii < keys.size(); ii++)
{
keyName = keys[ii].getName();
keyValue = keys[ii].getValue();
//Put CLASS_EXTENDED_COMPUTER_SYSTEM in front CLASS_CIM_COMPUTER_SYSTEM
//to prefer CLASS_EXTENDED_COMPUTER_SYSTEM as class being served first
//followed by CLASS_CIM_UNITARY_COMPUTER_SYSTEM
if (keyName.equal(PROPERTY_CREATION_CLASS_NAME) &&
(String::equalNoCase(keyValue,CLASS_EXTENDED_COMPUTER_SYSTEM) ||
String::equalNoCase(keyValue,CLASS_CIM_UNITARY_COMPUTER_SYSTEM) ||
String::equalNoCase(keyValue,CLASS_CIM_COMPUTER_SYSTEM) ||
String::equalNoCase(keyValue,String::EMPTY)))
{
keyCount--;
}
else if (keyName.equal("Name") &&
String::equalNoCase(keyValue,_cs.getHostName()))
{
keyCount--;
}
}
if (keyCount)
{
throw CIMInvalidParameterException(String::EMPTY);
}
// return instance of specified class
CIMInstance instance = _cs.buildInstance(ref.getClassName());
handler.processing();
handler.deliver(instance);
handler.complete();
return;
}
示例13: find
Boolean UNIX_AssociatedTargetMaskingGroup::find(const Array<CIMKeyBinding> &kbArray)
{
CIMKeyBinding kb;
String antecedentKey;
String dependentKey;
for(Uint32 i = 0; i < kbArray.size(); i++)
{
kb = kbArray[i];
CIMName keyName = kb.getName();
if (keyName.equal(PROPERTY_ANTECEDENT)) antecedentKey = kb.getValue();
else if (keyName.equal(PROPERTY_DEPENDENT)) dependentKey = kb.getValue();
}
/* Execute find with extracted keys */
for(int i = 0; load(i); i++) {
if ((String::equalNoCase(getAntecedent().getPath().toString(), antecedentKey)) &&
(String::equalNoCase(getDependent().getPath().toString(), dependentKey)))
{
return true;
}
}
return false;
}
示例14: constructInstance
CIMInstance UNIX_ASBGPEndpointsProvider::constructInstance(
const CIMName &className,
const CIMNamespaceName &nameSpace,
const UNIX_ASBGPEndpoints &instanceObject) const
{
CIMProperty p;
CIMInstance inst(className);
// Set path
inst.setPath(CIMObjectPath(String(""), // hostname
nameSpace,
className,
constructKeyBindings(instanceObject)));
//CIM_AbstractComponent Properties
if (instanceObject.getGroupComponent(p)) inst.addProperty(p);
if (instanceObject.getPartComponent(p)) inst.addProperty(p);
if (className.equal("CIM_AbstractComponent")) return inst;
//CIM_Component Properties
if (className.equal("CIM_Component")) return inst;
//CIM_SystemComponent Properties
if (className.equal("CIM_SystemComponent")) return inst;
//CIM_ASBGPEndpoints Properties
return inst;
}
示例15: find
Boolean UNIX_BGPServiceStatistics::find(const Array<CIMKeyBinding> &kbArray)
{
CIMKeyBinding kb;
String statsKey;
String elementKey;
for(Uint32 i = 0; i < kbArray.size(); i++)
{
kb = kbArray[i];
CIMName keyName = kb.getName();
if (keyName.equal(PROPERTY_STATS)) statsKey = kb.getValue();
else if (keyName.equal(PROPERTY_ELEMENT)) elementKey = kb.getValue();
}
/* Execute find with extracted keys */
for(int i = 0; load(i); i++) {
if ((String::equalNoCase(getStats().getPath().toString(), statsKey)) &&
(String::equalNoCase(getElement().getPath().toString(), elementKey)))
{
return true;
}
}
return false;
}