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


C++ CIMValue函数代码示例

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


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

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

示例2: _createHandlerInstance

CIMObjectPath _createHandlerInstance(
    CIMClient & client,
    const String & name,
    const String & targetHost,
    const String & securityName,
    const Uint16 targetHostFormat,
    const Uint16 snmpVersion)
{
    CIMInstance handlerInstance (PEGASUS_CLASSNAME_INDHANDLER_SNMP);
    handlerInstance.addProperty (CIMProperty (CIMName
                                 ("SystemCreationClassName"), System::getSystemCreationClassName ()));
    handlerInstance.addProperty (CIMProperty (CIMName ("SystemName"),
                                 System::getFullyQualifiedHostName ()));
    handlerInstance.addProperty (CIMProperty (CIMName ("CreationClassName"),
                                 PEGASUS_CLASSNAME_INDHANDLER_SNMP.getString ()));
    handlerInstance.addProperty (CIMProperty (CIMName ("Name"), name));
    handlerInstance.addProperty (CIMProperty (CIMName ("TargetHost"),
                                 targetHost));
    handlerInstance.addProperty (CIMProperty (CIMName ("TargetHostFormat"),
                                 CIMValue ((Uint16) targetHostFormat)));
    handlerInstance.addProperty (CIMProperty (CIMName ("SNMPSecurityName"),
                                 securityName));
    handlerInstance.addProperty (CIMProperty (CIMName ("SnmpVersion"),
                                 CIMValue ((Uint16) snmpVersion)));
    handlerInstance.addProperty (CIMProperty (CIMName ("PortNumber"),
                                 CIMValue ((Uint32) PORT_NUMBER)));

    return client.createInstance(
               PEGASUS_NAMESPACENAME_INTEROP, handlerInstance);
}
开发者ID:xenserver,项目名称:openpegasus,代码行数:30,代码来源:testSnmpHandler.cpp

示例3: 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

示例4: invokeMethod

void OOPModuleFailureTestProvider::invokeMethod (
    const OperationContext & context,
    const CIMObjectPath & objectReference,
    const CIMName & methodName,
    const Array <CIMParamValue> & inParameters,
    MethodResultResponseHandler & handler)
{
    Boolean sendIndication = false;
    String identifier;
    handler.processing ();

    if (objectReference.getClassName ().equal ("FailureTestIndication") &&
        _enabled)
    {
        if (methodName.equal ("SendTestIndication"))
        {
            if ((inParameters.size() > 0) &&
                (inParameters[0].getParameterName () == "identifier"))
            {
                inParameters[0].getValue().get(identifier);
            }
            sendIndication = true;
            handler.deliver (CIMValue (0));
        }
    }
    else
    {
         handler.deliver (CIMValue (1));
         PEGASUS_STD (cout) << "Provider is not enabled." <<
         PEGASUS_STD (endl);
    }

    handler.complete ();

    if (sendIndication)
    {
        _generateIndication (_handler, identifier);
    }

    //
    //  If I am the OOPModuleInvokeFailureTestProvider, fail (i.e. exit)
    //
    if (String::equalNoCase (_providerName,
        "OOPModuleInvokeFailureTestProvider"))
    {
        if (methodName.equal ("Fail"))
        {
            exit (-1);
        }
    }
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:51,代码来源:OOPModuleFailureTestProvider.cpp

示例5: testArrayType

void testArrayType(const Array<T>& x)
{
    WsmToCimRequestMapper mapper((CIMRepository*) 0);

    // Create a NULL CIMValue of the appropriate type. Normally type
    // info is retrieved from the repository.
    CIMValue tmp(x);
    CIMValue cimValue(tmp.getType(), tmp.isArray());

    // Create WsmValue out of the given array
    Array<String> arr;
    for (Uint32 i = 0; i < x.size(); i++)
    {
        String str = CIMValue(x[i]).toString();
        if (tmp.getType() == CIMTYPE_BOOLEAN)
        {
            str.toLower();
        }
        arr.append(str);
    }

    WsmValue wsmValue(arr);
    mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue);
    PEGASUS_TEST_ASSERT(tmp == cimValue);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:25,代码来源:WsmToCimMapper.cpp

示例6: 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

示例7: _getSubscriptionObjectPath

CIMObjectPath _getSubscriptionObjectPath(
    const String & filterName,
    const String & handlerName)
{
    CIMObjectPath filterObjectPath = _getFilterObjectPath(filterName);

    CIMObjectPath handlerObjectPath = _getHandlerObjectPath(handlerName);

    Array<CIMKeyBinding> subscriptionKeyBindings;
    subscriptionKeyBindings.append (CIMKeyBinding ("Filter",
                                    CIMValue(filterObjectPath)));
    subscriptionKeyBindings.append (CIMKeyBinding ("Handler",
                                    CIMValue(handlerObjectPath)));
    return(CIMObjectPath("", CIMNamespaceName (),
                         PEGASUS_CLASSNAME_INDSUBSCRIPTION, subscriptionKeyBindings));
}
开发者ID:xenserver,项目名称:openpegasus,代码行数:16,代码来源:testSnmpHandler.cpp

示例8: _sendTestIndication

void _sendTestIndication(
    CIMClient* client,
    const CIMName & methodName,
    Uint32 indicationSendCount)
{
    //
    //  Invoke method to send test indication
    //
    Array <CIMParamValue> inParams;
    Array <CIMParamValue> outParams;
    Array <CIMKeyBinding> keyBindings;
    Sint32 result;

    CIMObjectPath className (String::EMPTY, CIMNamespaceName (),
                             CIMName ("Test_IndicationProviderClass"), keyBindings);

    inParams.append(CIMParamValue(String("indicationSendCount"),
                                  CIMValue(indicationSendCount)));

    CIMValue retValue = client->invokeMethod
                        (SOURCE_NAMESPACE,
                         className,
                         methodName,
                         inParams,
                         outParams);

    retValue.get (result);
    PEGASUS_TEST_ASSERT (result == 0);
}
开发者ID:xenserver,项目名称:openpegasus,代码行数:29,代码来源:testSnmpHandler.cpp

示例9: _buildObjectPath

void benchmarkProvider::enumerateInstanceNames(
    const OperationContext & context,
    const CIMObjectPath & classReference,
    ObjectPathResponseHandler & handler)
{
    CIMObjectPath _instanceName;
    Uint32 numberOfProperties;
    Uint32 sizeOfPropertyValue;
    Uint32 numberOfInstances;

    CIMName className = classReference.getClassName();
    test.getConfiguration(className, numberOfProperties,
                          sizeOfPropertyValue, numberOfInstances);

    // begin processing the request
    handler.processing();

    for (Uint32 i = 1; i <= numberOfInstances; i++)
    {
       _instanceName = _buildObjectPath(className, 
               CIMKeyBinding(CIMName("Identifier"), CIMValue(i))); 
       handler.deliver(_instanceName);
    }
 
    // complete processing the request
    handler.complete();
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:27,代码来源:benchmarkProvider.cpp

示例10: _buildInstance

void benchmarkProvider::enumerateInstances(
    const OperationContext & context,
    const CIMObjectPath & classReference,
    const Boolean includeQualifiers,
    const Boolean includeClassOrigin,
    const CIMPropertyList & propertyList,
    InstanceResponseHandler & handler)
{
    CIMInstance _instance;
    Uint32 numberOfProperties;
    Uint32 sizeOfPropertyValue;
    Uint32 numberOfInstances;

    CIMName className = classReference.getClassName();
    test.getConfiguration(className, numberOfProperties,
                          sizeOfPropertyValue, numberOfInstances);

    // begin processing the request
    handler.processing();

    for (Uint32 i = 1; i <= numberOfInstances; i++)
    {
       _instance = _buildInstance(className, numberOfProperties,
                        sizeOfPropertyValue , CIMValue(i));   
       handler.deliver(_instance);
    }

    // complete processing the request
    handler.complete();
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:30,代码来源:benchmarkProvider.cpp

示例11: testModifyInstance

void testModifyInstance(CIMClient& client, const char* ns)
{
  Array<CIMInstance> instances;

  instances = client.enumerateInstances(ns, CIM_QUERYCAPCLASS_NAME);

  CIMProperty prop;
  Uint32 pos = instances[0].findProperty(PROPERTY_NAME_CAPTION);
  prop = instances[0].getProperty(pos);
  instances[0].removeProperty(pos);

  prop.setValue(CIMValue(String("MODIFIED CAPTION")));

  instances[0].addProperty(prop);

  try
  {
    client.modifyInstance(ns, instances[0]);
  }
  catch(Exception)
  {
    // Do nothing. This is expected since modifyInstance is NOT
    // supported.
    return;
  }

  throw Exception("modifyInstance is supported");
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:28,代码来源:TestCIMQueryCap.cpp

示例12: PEG_METHOD_ENTER

void DefaultProviderManager::unloadIdleProviders()
{
    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
        "DefaultProviderManager::unloadIdleProviders");

    try
    {
        struct timeval now;
        Time::gettimeofday(&now);

        // Make a copy of the table so it is not locked during provider calls
        Array<ProviderMessageHandler*> providerList;
        {
            AutoMutex lock(_providerTableMutex);

            for (ProviderTable::Iterator i = _providers.start(); i != 0; i++)
            {
                providerList.append(i.value());
            }
        }

        for (Uint32 i = 0; i < providerList.size(); i++)
        {
            ProviderMessageHandler* provider = providerList[i];

            AutoMutex lock(provider->status.getStatusMutex());

            if (!provider->status.isInitialized())
            {
                continue;
            }

            struct timeval providerTime = {0, 0};
            provider->status.getLastOperationEndTime(&providerTime);

            PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
                "provider->status.isIdle() returns: %s",
                (const char*)CIMValue(provider->status.isIdle())
                       .toString().getCString()));

            if (provider->status.isIdle() &&
                ((now.tv_sec - providerTime.tv_sec) >
                 ((Sint32)PEGASUS_PROVIDER_IDLE_TIMEOUT_SECONDS)))
            {
                PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3,
                    "Unloading idle provider: %s",
                    (const char*)provider->getName().getCString()));
                _unloadProvider(provider);
            }
        }
    }
    catch (...)
    {
        PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1,
            "Caught unexpected exception in unloadIdleProviders.");
    }

    PEG_METHOD_EXIT();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:59,代码来源:DefaultProviderManager.cpp

示例13: _cimClass

ObjectNormalizer::ObjectNormalizer(
    const CIMClass& cimClass,
    Boolean includeQualifiers,
    Boolean includeClassOrigin,
    const CIMNamespaceName& nameSpace,
    SharedPtr<NormalizerContext>& context)
  : _cimClass(cimClass),
    _includeQualifiers(includeQualifiers),
    _includeClassOrigin(includeClassOrigin),
    _context(context),
    _nameSpace(nameSpace)
{
    if (!_cimClass.isUninitialized())
    {
        // ATTN: the following code is intended to expedite normalizing
        // instances and instance object paths by establishing the keys
        // once now rather than multiple times later. it is biased
        // toward providers that return many instances with many properties.

        // build a reference object path within the class
        Array<CIMKeyBinding> keys;

        for (Uint32 i = 0, n = _cimClass.getPropertyCount(); i < n; i++)
        {
            CIMConstProperty referenceProperty = _cimClass.getProperty(i);

            Uint32 pos = referenceProperty.findQualifier("key");

            if ((pos != PEG_NOT_FOUND) &&
                (referenceProperty.getQualifier(pos).getValue().equal(
                     CIMValue(true))))
            {
                if (referenceProperty.getType() == CIMTYPE_REFERENCE)
                {
                    // ATTN: a fake reference is inserted in the key so that
                    // the _BubbleSort() method in CIMObjectPath does not
                    // throw and exception. It implicitly validates keys of
                    // type REFERENCE so just place a dummy value for now.
                    // The value will be replaced by the normalized object
                    // later.
                    keys.append(CIMKeyBinding(referenceProperty.getName(),
                        "class.key=\"value\"", CIMKeyBinding::REFERENCE));
                }
                else
                {
                    keys.append(CIMKeyBinding(referenceProperty.getName(),
                        referenceProperty.getValue()));
                }
            }
        }

        // update class object path
        CIMObjectPath cimObjectPath(_cimClass.getPath());

        cimObjectPath.setKeyBindings(keys);

        _cimClass.setPath(cimObjectPath);
    }
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:59,代码来源:ObjectNormalizer.cpp

示例14: cname

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

示例15: buildInstance

/*
    Build an instance of the test class
*/
CIMInstance buildInstance(CIMClient& client, String& instanceId)
{
    CIMClass cl = client.getClass(PROVIDERNS, TEST_CLASS);
    CIMInstance inst = cl.buildInstance(false, false, CIMPropertyList());
    setPropertyValue(inst, "Id", CIMValue(instanceId));

    return inst;
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:11,代码来源:main.cpp


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