本文整理匯總了C++中CIMObjectPath函數的典型用法代碼示例。如果您正苦於以下問題:C++ CIMObjectPath函數的具體用法?C++ CIMObjectPath怎麽用?C++ CIMObjectPath使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CIMObjectPath函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: switch
Boolean operator==(const CIMKeyBinding& x, const CIMKeyBinding& y)
{
// Check that the names and types match
if (!(x.getName().equal(y.getName())) ||
!(x.getType() == y.getType()))
{
return false;
}
switch (x.getType())
{
case CIMKeyBinding::REFERENCE:
try
{
// References should be compared as CIMObjectPaths
return (CIMObjectPath(x.getValue()) == CIMObjectPath(y.getValue()));
}
catch (Exception&)
{
// If CIMObjectPath parsing fails, just compare strings
return String::equal(x.getValue(), y.getValue());
}
case CIMKeyBinding::BOOLEAN:
// Case-insensitive comparison is sufficient for booleans
return String::equalNoCase(x.getValue(), y.getValue());
case CIMKeyBinding::NUMERIC:
// Note: This comparison assumes XML syntax for integers
// First try comparing as unsigned integers
{
Uint64 xValue;
Uint64 yValue;
if (StringConversion::stringToUnsignedInteger(
x.getValue().getCString(), xValue) &&
StringConversion::stringToUnsignedInteger(
y.getValue().getCString(), yValue))
{
return (xValue == yValue);
}
}
// Next try comparing as signed integers
{
Sint64 xValue;
Sint64 yValue;
if (StringConversion::stringToSignedInteger(
x.getValue().getCString(), xValue) &&
StringConversion::stringToSignedInteger(
y.getValue().getCString(), yValue))
{
return (xValue == yValue);
}
}
// Note: Keys may not be real values, so don't try comparing as reals
// We couldn't parse the numbers, so just compare the strings
return String::equal(x.getValue(), y.getValue());
default: // CIMKeyBinding::STRING
return String::equal(x.getValue(), y.getValue());
}
PEGASUS_UNREACHABLE(return false;)
}
示例2: test05
//Test reference array type properties
void test05()
{
Array<CIMObjectPath> oa;
oa.append(CIMObjectPath("/root/cimv2:My_Class.a=1"));
oa.append(CIMObjectPath("/root/cimv2:My_Class.a=2"));
CIMProperty p1;
Boolean gotException = false;
try
{
p1 = CIMProperty(CIMName("property1"), oa, 0, CIMName("refclass"));
}
catch (TypeMismatchException&)
{
gotException = true;
}
PEGASUS_TEST_ASSERT(gotException);
p1 = CIMProperty(CIMName("property1"), oa[0], 0, CIMName("refclass"));
gotException = false;
try
{
p1.setValue(oa);
}
catch (TypeMismatchException&)
{
gotException = true;
}
PEGASUS_TEST_ASSERT(gotException);
}
示例3: instance1
void InstanceProvider::initialize(CIMOMHandle & cimom)
{
// create default instances
CIMInstance instance1("Sample_InstanceProviderClass");
instance1.setPath(CIMObjectPath("Sample_InstanceProviderClass.Identifier=1"));
instance1.addProperty(CIMProperty("Identifier", Uint8(1))); // key
instance1.addProperty(CIMProperty("Message", String("Hello World")));
_instances.append(instance1);
CIMInstance instance2("Sample_InstanceProviderClass");
instance2.setPath(CIMObjectPath("Sample_InstanceProviderClass.Identifier=2"));
instance2.addProperty(CIMProperty("Identifier", Uint8(2))); // key
instance2.addProperty(CIMProperty("Message", String("Yo Planet")));
_instances.append(instance2);
CIMInstance instance3("Sample_InstanceProviderClass");
instance3.setPath(CIMObjectPath("Sample_InstanceProviderClass.Identifier=3"));
instance3.addProperty(CIMProperty("Identifier", Uint8(3))); // key
instance3.addProperty(CIMProperty("Message", String("Hey Earth")));
_instances.append(instance3);
}
示例4: _getInstance
int _getInstance(const int argc, const char **argv)
{
if (argv[0] == 0)
{
_giUsage();
return 1;
}
// need to get class definition to find keys
// first arg is name of class
CIMClass cldef;
try
{
cldef = _c.getClass( _nameSpace, argv[0] );
}
catch(Exception& e)
{
cerr << /* "getInstance: " << */ e.getMessage() << endl;
return 1;
}
CIMObjectPath ref;
CIMInstance inst;
// If there are no more args, prompt user for keys
if (argv[1] == 0) ref = CIMObjectPath(String::EMPTY, // hostname left blank
_nameSpace,
argv[0],
_inputInstanceKeys(cldef));
// else if there's another arg and it's "list", enumInstNames and print
// a list from which user will select (return if none)
else if (String::equalNoCase("list",argv[1]))
{
ref = _selectInstance(argv[0]);
// An empty ObjectPath means nothing was selected
if (ref.identical(CIMObjectPath())) return 0;
}
// else there's another arg but it's invalid
else
{
_giUsage();
return 1;
}
// get the specified instance
try
{
inst = _c.getInstance(_nameSpace,ref);
}
catch(Exception& e)
{
cerr << /* "getInstance: " << */ e.getMessage() << endl;
return 1;
}
_displayInstance(inst);
return 0;
}
示例5: _getProperty
int _getProperty(const int argc, const char **argv)
{
// need to get class definition to find keys
// first arg is name of class
CIMClass cldef;
try
{
cldef = _c.getClass( PEGASUS_NAMESPACENAME_INTEROP, argv[0] );
}
catch(Exception& e)
{
cerr << /* "getProperty: " << */ e.getMessage() << endl;
return 1;
}
CIMObjectPath ref;
CIMInstance inst;
// If next arg is "ask", prompt user for keys
if (String::equalNoCase("ask",argv[1])) ref =
CIMObjectPath(String::EMPTY,
PEGASUS_NAMESPACENAME_INTEROP,
argv[0],
_inputInstanceKeys(cldef) );
// else if the next arg and is "list", enumInstNames and print
// a list from which user will select
else if (String::equalNoCase("list",argv[1]))
{
ref = _selectInstance( argv[0] );
if (ref.identical(CIMObjectPath())) return 0;
}
// else there's another arg but it's invalid
else
{
return 1;
}
CIMProperty pDef;
// if no more args, display property names and ask which
if (argc < 3)
{
int n;
for (n=0; n<cldef.getPropertyCount(); n++)
cerr << n+1 << ": " << cldef.getProperty(n).getName().getString() << endl;
cerr << "Property (1.." << cldef.getPropertyCount() << ")? ";
cin >> n;
pDef = cldef.getProperty(n-1);
}
示例6: inst
CIMInstance UNIX_ClassifierElementInClassifierServiceProvider::constructInstance(
const CIMName &className,
const CIMNamespaceName &nameSpace,
const UNIX_ClassifierElementInClassifierService &_p)
{
CIMProperty p;
CIMInstance inst(className);
// Set path
inst.setPath(CIMObjectPath(String(""), // hostname
nameSpace,
CIMName("UNIX_ClassifierElementInClassifierService"),
constructKeyBindings(_p)));
//CIM_Component Properties
if (_p.getGroupComponent(p)) inst.addProperty(p);
if (_p.getPartComponent(p)) inst.addProperty(p);
//CIM_ServiceComponent Properties
//CIM_ClassifierElementInClassifierService Properties
if (_p.getClassifierOrder(p)) inst.addProperty(p);
return inst;
}
開發者ID:brunolauze,項目名稱:openpegasus-providers-old,代碼行數:27,代碼來源:UNIX_ClassifierElementInClassifierServiceProvider.cpp
示例7: inst
CIMInstance UNIX_BlockStatisticsManifestCollectionProvider::constructInstance(
const CIMName &className,
const CIMNamespaceName &nameSpace,
const UNIX_BlockStatisticsManifestCollection &_p)
{
CIMProperty p;
CIMInstance inst(className);
// Set path
inst.setPath(CIMObjectPath(String(""), // hostname
nameSpace,
CIMName("UNIX_BlockStatisticsManifestCollection"),
constructKeyBindings(_p)));
//CIM_ManagedElement Properties
if (_p.getInstanceID(p)) inst.addProperty(p);
if (_p.getCaption(p)) inst.addProperty(p);
if (_p.getDescription(p)) inst.addProperty(p);
if (_p.getElementName(p)) inst.addProperty(p);
//CIM_Collection Properties
//CIM_SystemSpecificCollection Properties
//CIM_BlockStatisticsManifestCollection Properties
if (_p.getIsDefault(p)) inst.addProperty(p);
return inst;
}
開發者ID:brunolauze,項目名稱:openpegasus-providers-old,代碼行數:31,代碼來源:UNIX_BlockStatisticsManifestCollectionProvider.cpp
示例8: CIMObjectPath
void LargeDataProvider::getInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList & propertyList,
InstanceResponseHandler & handler)
{
cout << "------------------------------" << endl;
cout << "LargeDataProvider::getInstance" << endl;
cout << "------------------------------" << endl;
// convert a potential fully qualified reference into a local reference
// (class name and keys only).
CIMObjectPath localReference = CIMObjectPath(
String(),
String(),
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 == _instanceNames[i])
{
// deliver requested instance
handler.deliver(_instances[i]);
break;
}
}
// complete processing the request
handler.complete();
}
示例9: inst
CIMInstance UNIX_AssociatedSupplyVoltageSensorProvider::constructInstance(
const CIMName &className,
const CIMNamespaceName &nameSpace,
const UNIX_AssociatedSupplyVoltageSensor &_p)
{
CIMProperty p;
CIMInstance inst(className);
// Set path
inst.setPath(CIMObjectPath(String(""), // hostname
nameSpace,
CIMName("UNIX_AssociatedSupplyVoltageSensor"),
constructKeyBindings(_p)));
//CIM_Dependency Properties
if (_p.getAntecedent(p)) inst.addProperty(p);
if (_p.getDependent(p)) inst.addProperty(p);
//CIM_AssociatedSensor Properties
//CIM_AssociatedSupplyVoltageSensor Properties
if (_p.getMonitoringRange(p)) inst.addProperty(p);
return inst;
}
開發者ID:brunolauze,項目名稱:openpegasus-providers-old,代碼行數:27,代碼來源:UNIX_AssociatedSupplyVoltageSensorProvider.cpp
示例10: inst
CIMInstance UNIX_AccountSettingDataProvider::constructInstance(
const CIMName &className,
const CIMNamespaceName &nameSpace,
const UNIX_AccountSettingData &_p)
{
CIMProperty p;
CIMInstance inst(className);
// Set path
inst.setPath(CIMObjectPath(String(""), // hostname
nameSpace,
CIMName("UNIX_AccountSettingData"),
constructKeyBindings(_p)));
//CIM_ManagedElement Properties
if (_p.getInstanceID(p)) inst.addProperty(p);
if (_p.getCaption(p)) inst.addProperty(p);
if (_p.getDescription(p)) inst.addProperty(p);
if (_p.getElementName(p)) inst.addProperty(p);
//CIM_SettingData Properties
if (_p.getChangeableType(p)) inst.addProperty(p);
if (_p.getConfigurationName(p)) inst.addProperty(p);
//CIM_AccountSettingData Properties
if (_p.getComplexPasswordRulesEnforced(p)) inst.addProperty(p);
if (_p.getInactivityTimeout(p)) inst.addProperty(p);
if (_p.getMaximumPasswordExpiration(p)) inst.addProperty(p);
if (_p.getMaximumSuccessiveLoginFailures(p)) inst.addProperty(p);
if (_p.getPasswordHistoryDepth(p)) inst.addProperty(p);
return inst;
}
示例11: inst
CIMInstance UNIX_CalculationBasedOnQueueProvider::constructInstance(
const CIMName &className,
const CIMNamespaceName &nameSpace,
const UNIX_CalculationBasedOnQueue &_p)
{
CIMProperty p;
CIMInstance inst(className);
// Set path
inst.setPath(CIMObjectPath(String(""), // hostname
nameSpace,
CIMName("UNIX_CalculationBasedOnQueue"),
constructKeyBindings(_p)));
//CIM_Dependency Properties
if (_p.getAntecedent(p)) inst.addProperty(p);
if (_p.getDependent(p)) inst.addProperty(p);
//CIM_ProvidesServiceToElement Properties
//CIM_ServiceServiceDependency Properties
if (_p.getTypeOfDependency(p)) inst.addProperty(p);
if (_p.getRestartService(p)) inst.addProperty(p);
//CIM_CalculationBasedOnQueue Properties
return inst;
}
開發者ID:brunolauze,項目名稱:openpegasus-providers-old,代碼行數:30,代碼來源:UNIX_CalculationBasedOnQueueProvider.cpp
示例12: inst
CIMInstance UNIX_BGPPeerUsesRouteMapProvider::constructInstance(
const CIMName &className,
const CIMNamespaceName &nameSpace,
const UNIX_BGPPeerUsesRouteMap &_p)
{
CIMProperty p;
CIMInstance inst(className);
// Set path
inst.setPath(CIMObjectPath(String(""), // hostname
nameSpace,
CIMName("UNIX_BGPPeerUsesRouteMap"),
constructKeyBindings(_p)));
//CIM_MemberOfCollection Properties
if (_p.getCollection(p)) inst.addProperty(p);
if (_p.getMember(p)) inst.addProperty(p);
//CIM_CollectedMSEs Properties
//CIM_BGPPeerUsesRouteMap Properties
if (_p.getMapSequence(p)) inst.addProperty(p);
return inst;
}
示例13: CIMObjectPath
void InstanceProvider::deleteInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
ResponseHandler & handler)
{
// 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())
{
// remove instance from the array
_instances.remove(i);
break;
}
}
// complete processing the request
handler.complete();
}
示例14: inst
CIMInstance UNIX_BootConfigSettingProvider::constructInstance(
const CIMName &className,
const CIMNamespaceName &nameSpace,
const UNIX_BootConfigSetting &_p)
{
CIMProperty p;
CIMInstance inst(className);
// Set path
inst.setPath(CIMObjectPath(String(""), // hostname
nameSpace,
CIMName("UNIX_BootConfigSetting"),
constructKeyBindings(_p)));
//CIM_ManagedElement Properties
if (_p.getInstanceID(p)) inst.addProperty(p);
if (_p.getCaption(p)) inst.addProperty(p);
if (_p.getDescription(p)) inst.addProperty(p);
if (_p.getElementName(p)) inst.addProperty(p);
//CIM_SettingData Properties
if (_p.getChangeableType(p)) inst.addProperty(p);
if (_p.getConfigurationName(p)) inst.addProperty(p);
//CIM_BootConfigSetting Properties
return inst;
}
示例15: 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);
}