本文整理汇总了C++中CIMObjectPath::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMObjectPath::toString方法的具体用法?C++ CIMObjectPath::toString怎么用?C++ CIMObjectPath::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMObjectPath
的用法示例。
在下文中一共展示了CIMObjectPath::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: _testReferences
Uint32 _testReferences(
CIMClient& client,
CIMObjectPath instancePath,
CIMName referenceClass)
{
if (verbose)
{
cout << "\nObject Name: " << instancePath.toString() << endl;
}
// get the association reference instances
//
String role;
Array<CIMObject> resultObjects =
client.references(NAMESPACE, instancePath, referenceClass,role);
Uint32 size = resultObjects.size();
if (verbose)
{
if (size > 0)
{
cout << " \n " << referenceClass.getString() << " :: ";
for (Uint32 i = 0; i < size ; ++i)
{
cout << resultObjects[i].getPath().toString();
}
cout << endl;
}
}
return size;
}
示例3: _testReferenceNames
void _testReferenceNames(CIMClient& client, CIMObjectPath instancePath,
Uint32 numExpectedObjects)
{
if (verbose)
{
cout << "Object Name: " << instancePath.toString() << endl;
}
try
{
// get the reference instance names
//
Array<CIMObjectPath> resultObjectPaths;
CIMName resultClass;
String role;
resultObjectPaths = client.referenceNames(
providerNamespace,
instancePath,
resultClass,
role);
// verify result
_verifyResult(resultObjectPaths.size(), numExpectedObjects);
// display result
_displayResult(resultObjectPaths);
}
catch (Exception& e)
{
_errorExit(e.getMessage());
}
}
示例4: _testAssociatorNames
void _testAssociatorNames(CIMClient& client, CIMName assocClass,
CIMObjectPath instancePath, Uint32 numExpectedObjects)
{
if (verbose)
{
cout << "Association Class: " << assocClass.getString() << endl;
cout << "Object Name: " << instancePath.toString() << endl;
}
try
{
// Get the names of the CIM instances that are associated to the
// specified source instance via an instance of the AssocClass.
//
CIMName resultClass;
String role;
String resultRole;
Array<CIMObjectPath> resultObjectPaths =
client.associatorNames(providerNamespace, instancePath,
assocClass, resultClass, role, resultRole);
// verify result
_verifyResult(resultObjectPaths.size(), numExpectedObjects);
// display result
_displayResult(resultObjectPaths);
}
catch (Exception& e)
{
_errorExit(e.getMessage());
}
}
示例5: _BubbleSort
static void _BubbleSort(Array<CIMKeyBinding>& x)
{
Uint32 n = x.size();
//
// If the key is a reference, the keys in the reference must also be
// sorted
//
for (Uint32 k = 0; k < n ; k++)
if (x[k].getType () == CIMKeyBinding::REFERENCE)
{
CIMObjectPath tmp (x[k].getValue ());
Array <CIMKeyBinding> keyBindings = tmp.getKeyBindings ();
_BubbleSort (keyBindings);
tmp.setKeyBindings (keyBindings);
x[k].setValue (tmp.toString ());
}
if (n < 2)
return;
for (Uint32 i = 0; i < n - 1; i++)
{
for (Uint32 j = 0; j < n - 1; j++)
{
if (String::compareNoCase(x[j].getName().getString(),
x[j+1].getName().getString()) > 0)
{
CIMKeyBinding t = x[j];
x[j] = x[j+1];
x[j+1] = t;
}
}
}
}
示例6:
CIMObjectPath _buildSubscriptionPath
(const CIMObjectPath & filterPath,
const CIMObjectPath & handlerPath)
{
CIMObjectPath path;
Array <CIMKeyBinding> keyBindings;
keyBindings.append (CIMKeyBinding ("Filter",
filterPath.toString (), CIMKeyBinding::REFERENCE));
keyBindings.append (CIMKeyBinding ("Handler",
handlerPath.toString (), CIMKeyBinding::REFERENCE));
path.setClassName (SUBSCRIPTION_CLASSNAME);
path.setKeyBindings (keyBindings);
return path;
}
示例7: createInstance
void InstanceProvider::createInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
const CIMInstance & instanceObject,
ObjectPathResponseHandler & handler)
{
// Validate the class name
if (!instanceObject.getClassName().equal("Sample_InstanceProviderClass"))
{
throw CIMNotSupportedException(
instanceObject.getClassName().getString());
}
// Find the key property
Uint32 idIndex = instanceObject.findProperty("Identifier");
if (idIndex == PEG_NOT_FOUND)
{
throw CIMInvalidParameterException("Missing key value");
}
CIMInstance cimInstance = instanceObject.clone();
// Create the new instance name
CIMValue idValue = instanceObject.getProperty(idIndex).getValue();
Array<CIMKeyBinding> keys;
keys.append(CIMKeyBinding("Identifier", idValue));
CIMObjectPath instanceName = CIMObjectPath(
String(),
CIMNamespaceName(),
instanceObject.getClassName(),
keys);
cimInstance.setPath(instanceName);
// Determine whether this instance already exists
for(Uint32 i = 0, n = _instances.size(); i < n; i++)
{
if(instanceName == _instances[i].getPath())
{
throw CIMObjectAlreadyExistsException(instanceName.toString());
}
}
// begin processing the request
handler.processing();
// add the new instance to the array
_instances.append(cimInstance);
// deliver the new instance name
handler.deliver(instanceName);
// complete processing the request
handler.complete();
}
示例8: filterPath
void _deleteSubscriptionInstance
(CIMClient & client,
const String & filterName,
const String & handlerName,
const CIMNamespaceName & filterNS,
const CIMNamespaceName & handlerNS,
const CIMNamespaceName & subscriptionNS)
{
Array<CIMKeyBinding> filterKeyBindings;
filterKeyBindings.append (CIMKeyBinding ("SystemCreationClassName",
System::getSystemCreationClassName (), CIMKeyBinding::STRING));
filterKeyBindings.append (CIMKeyBinding ("SystemName",
System::getFullyQualifiedHostName (), CIMKeyBinding::STRING));
filterKeyBindings.append (CIMKeyBinding ("CreationClassName",
PEGASUS_CLASSNAME_INDFILTER.getString(), CIMKeyBinding::STRING));
filterKeyBindings.append (CIMKeyBinding ("Name", filterName,
CIMKeyBinding::STRING));
CIMObjectPath filterPath ("", filterNS,
PEGASUS_CLASSNAME_INDFILTER, filterKeyBindings);
Array<CIMKeyBinding> handlerKeyBindings;
handlerKeyBindings.append (CIMKeyBinding ("SystemCreationClassName",
System::getSystemCreationClassName (), CIMKeyBinding::STRING));
handlerKeyBindings.append (CIMKeyBinding ("SystemName",
System::getFullyQualifiedHostName (), CIMKeyBinding::STRING));
handlerKeyBindings.append (CIMKeyBinding ("CreationClassName",
PEGASUS_CLASSNAME_INDHANDLER_CIMXML.getString(),
CIMKeyBinding::STRING));
handlerKeyBindings.append (CIMKeyBinding ("Name", handlerName,
CIMKeyBinding::STRING));
CIMObjectPath handlerPath ("", handlerNS,
PEGASUS_CLASSNAME_INDHANDLER_CIMXML, handlerKeyBindings);
Array<CIMKeyBinding> subscriptionKeyBindings;
subscriptionKeyBindings.append (CIMKeyBinding ("Filter",
filterPath.toString (), CIMKeyBinding::REFERENCE));
subscriptionKeyBindings.append (CIMKeyBinding ("Handler",
handlerPath.toString (), CIMKeyBinding::REFERENCE));
CIMObjectPath subscriptionPath ("", CIMNamespaceName (),
PEGASUS_CLASSNAME_INDSUBSCRIPTION, subscriptionKeyBindings);
client.deleteInstance (subscriptionNS, subscriptionPath);
}
示例9: _testReferenceNames
Uint32 _testReferenceNames(CIMClient& client,
CIMObjectPath instancePath,
CIMName referenceClass)
{
if (verbose)
{
cout << "\nObject Name: " << instancePath.toString() << endl;
}
// get the reference instance names
//
String role;
Array<CIMObjectPath> resultObjectPaths =
client.referenceNames(NAMESPACE, instancePath, referenceClass, role);
return resultObjectPaths.size();
}
示例10: getProviderIndicationDataInstance
CIMInstance ProviderIndicationCountTable::getProviderIndicationDataInstance(
const CIMObjectPath& instanceName)
{
PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
"ProviderIndicationCountTable::getProviderIndicationDataInstance");
//
// Gets provider module name and provider name from the provider indication
// data instance object path
//
String providerModuleName;
String providerName;
Array<CIMKeyBinding> keys = instanceName.getKeyBindings();
for (Uint32 i = 0; i < keys.size(); i++)
{
if (keys[i].getName() == _PROPERTY_PROVIDERNAME)
{
providerName = keys[i].getValue();
}
else if (keys[i].getName() == _PROPERTY_PROVIDERMODULENAME)
{
providerModuleName = keys[i].getValue();
}
}
String providerKey = _generateKey(providerModuleName, providerName);
_ProviderIndicationCountTableEntry entry;
WriteLock lock(_tableLock);
if (_table.lookup(providerKey, entry))
{
CIMInstance providerIndDataInstance =
_buildProviderIndDataInstance(entry);
PEG_METHOD_EXIT();
return providerIndDataInstance;
}
PEG_METHOD_EXIT();
throw CIMObjectNotFoundException(instanceName.toString());
}
示例11: _testAssociatorNames
Uint32 _testAssociatorNames(CIMClient& client,
CIMName assocClass,
CIMObjectPath instancePath)
{
if (verbose)
{
cout << "\nAssociation Class: " << assocClass.getString() << endl;
cout << "\nObject Name: " << instancePath.toString() << endl;
}
// Get the names of the CIM instances that are associated to the
// specified source instance via an instance of the AssocClass.
//
CIMName resultClass;
String role;
String resultRole;
Array<CIMObjectPath> resultObjectPaths = client.associatorNames(
NAMESPACE, instancePath, assocClass, resultClass, role, resultRole);
return resultObjectPaths.size();
}
示例12: createInstance
void LargeDataProvider::createInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
const CIMInstance & instanceObject,
ObjectPathResponseHandler & handler)
{
cout << "---------------------------------" << endl;
cout << "LargeDataProvider::createInstance" << 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());
// instance index corresponds to reference index
for(Uint32 i = 0, n = _instanceNames.size(); i < n; i++)
{
if(localReference == _instanceNames[i])
{
throw CIMObjectAlreadyExistsException(
localReference.toString());
}
}
// begin processing the request
handler.processing();
// add the new instance to the array
_instances.append(instanceObject);
_instanceNames.append(instanceReference);
// deliver the new instance
handler.deliver(_instanceNames[_instanceNames.size() - 1]);
// complete processing the request
handler.complete();
}
示例13: enumerateInstanceNames
/*****************************************************************************
*
* Implementation of InstanceProvider enumerateInstanceNames method
*
*****************************************************************************/
void InteropProvider::enumerateInstanceNames(
const OperationContext & context,
const CIMObjectPath & classReference,
ObjectPathResponseHandler & handler)
{
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
"InteropProvider::enumerateInstanceNames()");
initProvider();
PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL4,
"%s enumerateInstanceNames. classReference= %s",
thisProvider,
(const char *) classReference.toString().getCString()));
// test for legal namespace for this provider. Exception if not
// namespaceSupported(classReference);
// NOTE: Above is commented out because the routing tables will always
// do the right thing and that's the only way requests get here.
// begin processing the request
handler.processing();
// Utilize the local enumeration method to retrieve the instances and
// extract the instance names.
Array<CIMInstance> instances = localEnumerateInstances(
context,
classReference,
CIMPropertyList());
for (Uint32 i = 0 ; i < instances.size() ; i++)
{
handler.deliver(instances[i].getPath());
}
handler.complete();
PEG_METHOD_EXIT();
}
示例14: _testAssociators
Uint32 _testAssociators(
CIMClient& client,
CIMName assocClass,
CIMObjectPath instancePath)
{
if (verbose)
{
cout << "\nAssociation Class: " << assocClass.getString() << endl;
cout << "\nObject Name: " << instancePath.toString() << endl;
}
CIMName resultClass;
String role;
String resultRole;
// Get the CIM instances that are associated with the specified source
// instance via an instance of the AssocClass
//
Array<CIMObject> resultObjects =
client.associators(NAMESPACE, instancePath, assocClass, resultClass,
role, resultRole);
Uint32 size = resultObjects.size();
if (verbose)
{
if (size > 0)
{
cout << " \n " << assocClass.getString() << " :: ";
for (Uint32 i = 0; i < size ; ++i)
{
cout << resultObjects[i].getPath().toString();
}
cout << endl;
}
}
return size;
}
示例15: Str
Str(const CIMObjectPath& x) : _cstr(x.toString().getCString()) { }