当前位置: 首页>>代码示例>>C++>>正文


C++ CIMObjectPath函数代码示例

本文整理汇总了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;)
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:60,代码来源:CIMObjectPath.cpp

示例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);
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:31,代码来源:Property.cpp

示例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);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:27,代码来源:InstanceProvider.cpp

示例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;
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:59,代码来源:Cimop.cpp

示例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);
  }
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:50,代码来源:Cimpls.cpp

示例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();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:35,代码来源:LargeDataProvider.cpp

示例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;
}
开发者ID:brunolauze,项目名称:openpegasus-providers-old,代码行数:35,代码来源:UNIX_AccountSettingDataProvider.cpp

示例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;
}
开发者ID:brunolauze,项目名称:openpegasus-providers-old,代码行数:27,代码来源:UNIX_BGPPeerUsesRouteMapProvider.cpp

示例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();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:31,代码来源:InstanceProvider.cpp

示例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;
}
开发者ID:brunolauze,项目名称:openpegasus-providers-old,代码行数:30,代码来源:UNIX_BootConfigSettingProvider.cpp

示例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);
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:34,代码来源:JSONWriter.cpp


注:本文中的CIMObjectPath函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。