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


C++ CIMInstance类代码示例

本文整理汇总了C++中CIMInstance的典型用法代码示例。如果您正苦于以下问题:C++ CIMInstance类的具体用法?C++ CIMInstance怎么用?C++ CIMInstance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CIMInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void _checkUint16Property
  (CIMInstance & instance, const String & name, Uint16 value)
{
  Uint32 pos = instance.findProperty (name);
  PEGASUS_TEST_ASSERT (pos != PEG_NOT_FOUND);

  CIMProperty theProperty = instance.getProperty (pos);
  CIMValue theValue = theProperty.getValue ();

  PEGASUS_TEST_ASSERT (theValue.getType () == CIMTYPE_UINT16);
  PEGASUS_TEST_ASSERT (!theValue.isArray ());
  PEGASUS_TEST_ASSERT (!theValue.isNull ());
  Uint16 result;
  theValue.get (result);

  if (verbose)
    {
      if (result != value)
        {
          cerr << "Property value comparison failed.  ";
          cerr << "Expected " << value << "; ";
          cerr << "Actual property value was " << result << "." << endl;
        }
    }

  PEGASUS_TEST_ASSERT (result == value);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:27,代码来源:TestCMPIInstanceExecQuery.cpp

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

示例3: filters

/**
 ***************************************************************************
   _filterAssociationInstances is used to filter the set of possible return
   instances against the filters (resultClass and resultRole) provided with
   the associators and associatorNames operations.  It returns the ObjectPaths
   of the set of objects that pass the filter tests.

    @param assocInstance     - The target association class instance
    @param sourceObjectPath  - The source ObjectPath
    @param resultClass       - The result class. If there is no resultClass,
                               this is String::EMPTY.
    @param resultRole        - The result role. If there is no role, this is
                               String::EMPTY

    @return   the ObjectPaths of the set of association instances that pass
              the filter tests.
 ***************************************************************************
*/
Array<CIMObjectPath> RUEpProvider::_filterAssociationInstances(
    CIMInstance& assocInstance,
    const CIMObjectPath& sourceObjectPath,
    CIMName resultClass,
    String resultRole)
{
    Array<CIMObjectPath> returnPaths;

    // get all Reference properties
    for (Uint32 i = 0, n = assocInstance.getPropertyCount(); i < n; i++)
    {
        CIMProperty p = assocInstance.getProperty(i);

        if (p.getType() == CIMTYPE_REFERENCE)
        {
            CIMValue v = p.getValue();
            CIMObjectPath path;
            v.get(path);

            if (!sourceObjectPath.identical(path))
            {
                if (resultClass.isNull() || resultClass == path.getClassName())
                {
                    if (resultRole == String::EMPTY ||
                        (p.getName() == CIMName(resultRole)))
                    {
                        returnPaths.append(path);
                    }
                }
            }
        }
    }
    return returnPaths;
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:52,代码来源:RUEpProvider.cpp

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

示例5: getInstance

CIMInstance CIMClient::getInstance(
    const CIMNamespaceName& nameSpace,
    const CIMObjectPath& instanceName,
    Boolean localOnly,
    Boolean includeQualifiers,
    Boolean includeClassOrigin,
    const CIMPropertyList& propertyList)
{
    CIMInstance inst = _rep->getInstance(
        nameSpace,
        instanceName,
        localOnly,
        includeQualifiers,
        includeClassOrigin,
        propertyList).getInstance();

    if (!inst.isUninitialized())
    {
        // remove key bindings, name space and host name form object path.
        CIMObjectPath& p =
            const_cast<CIMObjectPath&>(inst.getPath());

        CIMName cls = p.getClassName();
        p.clear();
        p.setClassName(cls);

    }

    return inst;
}
开发者ID:kaixuanlive,项目名称:openpegasus,代码行数:30,代码来源:CIMClient.cpp

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

示例7: exportIndication

void CIMExportClient::exportIndication(
   const String& url,
   const CIMInstance& instanceName,
   const ContentLanguageList& contentLanguages)
{
    PEG_METHOD_ENTER (TRC_EXPORT_CLIENT, "CIMExportClient::exportIndication()");

    try
    {
        // encode request
        CIMRequestMessage* request = new CIMExportIndicationRequestMessage(
            String::EMPTY,
            url,
            instanceName,
            QueueIdStack(),
            String::EMPTY,
            String::EMPTY);

        request->operationContext.set
            (ContentLanguageListContainer(contentLanguages));

        PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
            "Exporting %s Indication for destination %s:%d%s",
            (const char*)(instanceName.getClassName().getString().
            getCString()),
            (const char*)(_connectHost.getCString()), _connectPortNumber,
            (const char*)(url.getCString())));

        Message* message = _doRequest(request,
            CIM_EXPORT_INDICATION_RESPONSE_MESSAGE);

        PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
            "%s Indication for destination %s:%d%s exported successfully",
            (const char*)(instanceName.getClassName().getString().
            getCString()),
            (const char*)(_connectHost.getCString()), _connectPortNumber,
            (const char*)(url.getCString())));

        CIMExportIndicationResponseMessage* response =
            (CIMExportIndicationResponseMessage*)message;

        AutoPtr<CIMExportIndicationResponseMessage> ap(response);
    }
    catch (const Exception& e)
    {
        PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
            "Failed to export indication: %s",
            (const char*)e.getMessage().getCString()));
        throw;
    }
    catch (...)
    {
        PEG_TRACE_CSTRING (TRC_DISCARDED_DATA, Tracer::LEVEL1,
            "Failed to export indication");
        throw;
    }
    PEG_METHOD_EXIT();
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:58,代码来源:CIMExportClient.cpp

示例8: _checkValue

static Boolean _checkValue(
    CIMInstance &instance,
    const String &prop,
    T value)
{
    T lvalue;
    instance.getProperty(instance.findProperty(prop)).getValue().get(lvalue);
    return lvalue == value;
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:9,代码来源:DeliveryRetry.cpp

示例9: _testPropertyValue

void _testPropertyValue(
    CIMInstance& instance,
    const CIMName& propertyName,
    const CIMValue & testValue)
{
    CIMValue value =
        instance.getProperty(instance.findProperty(propertyName)).getValue();
    PEGASUS_TEST_ASSERT(testValue == value);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:9,代码来源:Configuration.cpp

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

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

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

示例13: setPropertyValue

bool setPropertyValue(CIMInstance& instance, const CIMName& propertyName,
    const CIMValue & value)
{
    unsigned int pos = instance.findProperty(propertyName);
    if(pos != PEG_NOT_FOUND)
    {
        instance.getProperty(pos).setValue(value);
        return true;
    }
    return false;
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:11,代码来源:main.cpp

示例14: handler

CIMObjectPath _createHandler
   (CIMClient & client,
    const String & name,
    const String & destination)
{
    CIMInstance handler (HANDLER_CLASSNAME);

    handler.addProperty (CIMProperty (CIMName ("Name"), name));
    handler.addProperty (CIMProperty (CIMName ("Destination"), destination));

    CIMObjectPath path = client.createInstance (INTEROPNAMESPACE, handler);
    return path;
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:13,代码来源:SendTestIndications.cpp

示例15: PEG_METHOD_ENTER

/////////////////////////////////////////////////////////////////////////////
// WMIInstanceProvider::getProperty
//
// ///////////////////////////////////////////////////////////////////////////
CIMValue WMIInstanceProvider::getProperty(
        const String& nameSpace,
        const String& userName,
        const String& password,
        const CIMObjectPath& instanceName,
        const String& propertyName)
{

    CIMInstance cimInstance;
    Array<CIMName> propertyNames;

    PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIInstanceProvider::getProperty()");

    setup(nameSpace,userName,password);

    if (!m_bInitialized)
    {
        throw CIMException(CIM_ERR_FAILED, "[getProperty] m_bInitialized");
    }

    CIMName propName = propertyName;

    propertyNames.append(propName);

    CIMPropertyList propertyList = CIMPropertyList(propertyNames);

    // get the relevant CIMInstance object
    cimInstance = getCIMInstance(nameSpace,
                                 userName,
                                 password,
                                 instanceName,
                                 propertyList);

    // now fetch the property
    Uint32 pos = cimInstance.findProperty(propName);

    if (PEG_NOT_FOUND == pos)
    {
        throw CIMException(CIM_ERR_NO_SUCH_PROPERTY,
            "[getProperty] findproperty");
    }

    CIMProperty property = cimInstance.getProperty(pos);

    // and return the value
    CIMValue value = property.getValue();

    PEG_METHOD_EXIT();

    return value;
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:55,代码来源:WMIInstanceProvider.cpp


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