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


C++ CIMValue::isNull方法代码示例

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


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

示例1: _checkStringValue

void _checkStringValue (CIMValue & theValue,
    const String & value,
    Boolean null = false)
{
    PEGASUS_TEST_ASSERT (theValue.getType () == CIMTYPE_STRING);
    PEGASUS_TEST_ASSERT (!theValue.isArray ());
    if (null)
    {
        PEGASUS_TEST_ASSERT (theValue.isNull ());
    }
    else
    {
        PEGASUS_TEST_ASSERT (!theValue.isNull ());
        String 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,代码行数:29,代码来源:TestCMPIBroker.cpp

示例2:

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

示例3: getPropertyValue

Array<String> CIMHelper::getPropertyAsStringArray(const CIMInstance &instanceObject, String name)
{
    CIMValue value = getPropertyValue(instanceObject, name);
    if (value.isNull()) return Array<String>();
    Array<String> result;
    value.get(result);
    return result;
}
开发者ID:brunolauze,项目名称:pegasus-providers,代码行数:8,代码来源:CIMHelper.cpp

示例4: getPropertyAsString

String CIMHelper::getPropertyAsString(const CIMInstance &instanceObject, String name)
{
    CIMValue value = getPropertyValue(instanceObject, name);
    if (value.isNull()) return String("");
    String result;
    value.get(result);
    return result;
}
开发者ID:brunolauze,项目名称:pegasus-providers,代码行数:8,代码来源:CIMHelper.cpp

示例5: deliver

void GetPropertyResponseHandler::deliver(const CIMValue& cimValue)
{
    if (cimValue.isNull())
    {
        MessageLoaderParms message(
            "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
            "The object is not initialized.");

        throw CIMException(CIM_ERR_FAILED, message);
    }

    SimpleValueResponseHandler::deliver(cimValue);
}
开发者ID:deleisha,项目名称:neopegasus,代码行数:13,代码来源:OperationResponseHandler.cpp

示例6: setInstance

void CIMError::setInstance(const CIMInstance& instance)
{
    for (Uint32 i = 0; i < instance.getPropertyCount(); i++)
    {
        CIMConstProperty p = instance.getProperty(i);

        _Check("ErrorType", p, (Uint16*)0);
        _Check("OtherErrorType", p, (String*)0);
        _Check("OwningEntity", p, (String*)0);
        _Check("MessageID", p, (String*)0);
        _Check("Message", p, (String*)0);
        _Check("MessageArguments", p, (Array<String>*)0);
        _Check("PerceivedSeverity", p, (Uint16*)0);
        _Check("ProbableCause", p, (Uint16*)0);
        _Check("ProbableCauseDescription", p, (String*)0);
        _Check("RecommendedActions", p, (Array<String>*)0);
        _Check("ErrorSource", p, (String*)0);
        _Check("ErrorSourceFormat", p, (Uint16*)0);
        _Check("OtherErrorSourceFormat", p, (String*)0);
        _Check("CIMStatusCode", p, (Uint32*)0);
        _Check("CIMStatusCodeDescription", p, (String*)0);
    }

    // Verify that the instance contains all of the required properties.

    for (Uint32 i = 0; i < _numRequiredProperties; i++)
    {
        // Does inst have this property?

        Uint32 pos = instance.findProperty(_requiredProperties[i]);

        if (pos == PEG_NOT_FOUND)
        {
            char buffer[80];
            sprintf(buffer, "required property does not exist: %s",
                    _requiredProperties[i]);
            throw CIMException(CIM_ERR_NO_SUCH_PROPERTY, buffer);
        }
        // is required property non-null?
        CIMConstProperty p = instance.getProperty(pos);
        CIMValue v = p.getValue();
        if (v.isNull())
        {
            char buffer[80];
            sprintf(buffer, "required property MUST NOT be Null: %s",
                    _requiredProperties[i]);
            throw CIMException(CIM_ERR_FAILED, buffer);
        }
    }
    _inst = instance;
}
开发者ID:xenserver,项目名称:openpegasus,代码行数:51,代码来源:CIMError.cpp

示例7: _checkUint32Value

void _checkUint32Value (CIMValue & theValue, Uint32 value)
{
    PEGASUS_TEST_ASSERT (theValue.getType () == CIMTYPE_UINT32);
    PEGASUS_TEST_ASSERT (!theValue.isArray ());
    PEGASUS_TEST_ASSERT (!theValue.isNull ());

    Uint32 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,代码行数:21,代码来源:TestCMPIBroker.cpp

示例8: createInstance

/////////////////////////////////////////////////////////////////////////////
// WMIInstanceProvider::createInstance
//
// ///////////////////////////////////////////////////////////////////////////
CIMObjectPath WMIInstanceProvider::createInstance(
        const String& nameSpace,
        const String& userName,
        const String& password,
        const CIMInstance& newInstance)
{
    PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIInstanceProvider::createInstance()");

    HRESULT hr;
    CComPtr<IWbemClassObject>    pClass;
    CComPtr<IWbemClassObject>    pNewInstance;
    CComBSTR bs;

    setup(nameSpace, userName, password);

    PEG_TRACE((TRC_WMIPROVIDER,
                  Tracer::LEVEL3,
                  "createInstance() - nameSpace %s, userName %s",
                  nameSpace.getCString(),
                  userName.getCString()));

    if (!m_bInitialized)
    {
        throw CIMException(CIM_ERR_FAILED);
    }

    // Get the class definition.
    String className = newInstance.getClassName().getString();

    if (!(_collector->getObject(&pClass, className)))
    {
        if (pClass)
            pClass.Release();

        throw CIMException(CIM_ERR_INVALID_CLASS);
    }
    else if (_collector->isInstance(pClass))
    {
        if (pClass)
            pClass.Release();

        throw CIMException(CIM_ERR_INVALID_PARAMETER);
    }

    // Create a new instance.
    hr = pClass->SpawnInstance(0, &pNewInstance);

    if (pClass)
        pClass.Release();

    if(FAILED(hr))
    {
        throw CIMException(CIM_ERR_FAILED);
    }

    // Set the properties
    for(Uint32 i = 0; i < newInstance.getPropertyCount(); i++)
    {
        CComVariant v;

        CIMProperty property = newInstance.getProperty(i).clone();
        CIMValue propertyValue = property.getValue();

        try
        {
            WMIValue(propertyValue).getAsVariant(
                                        &v,
                                        nameSpace,
                                        userName,
                                        password);
        }
        catch (CIMException&)
        {
            if (pNewInstance)
                pNewInstance.Release();

            v.Clear();

            throw;
        }

        bs.Empty();
        bs = property.getName().getString().getCString();

        // NULL properties in causes a CIM_ERR_FAILED
        // this conditional ignores properties with NULL.
        if (!propertyValue.isNull())
            hr = pNewInstance->Put(bs, 0, &v, 0);

        v.Clear();

        if(FAILED(hr))
        {
            if (pNewInstance)
                pNewInstance.Release();

//.........这里部分代码省略.........
开发者ID:rdobson,项目名称:openpegasus,代码行数:101,代码来源:WMIInstanceProvider.cpp

示例9: _applyProjection

Boolean _applyProjection(QueryExpression& qe,
                         Array<CIMInstance>& _instances,
                         String testOption,
                         String lang)
{
    if(testOption == String::EMPTY || testOption == "2")
    {
        cout << endl << lang << " ========Apply Projection Results========" << endl;
        cout << qe.getQuery() << endl;

        for(Uint32 j = 0; j < _instances.size(); j++)
        {
            cout << "Instance of class " << _instances[j].getClassName().getString() << endl;

            try
            {
                CIMInstance projInst = _instances[j].clone();

                Boolean gotPropExc = false;
                try
                {
                    qe.applyProjection(projInst, false);
                }
                catch (QueryRuntimePropertyException & qrpe)
                {
                    // Got a missing property exception.
                    cout << "-----" << qrpe.getMessage() << endl;
                    gotPropExc = true;
                }

                if (gotPropExc)
                {
                    // Got a missing property exception.
                    // Try again, allowing missing properties.
                    // Need to use a cloned instance because the original instance
                    // was partially projected.
                    cout << "Instance of class " << _instances[j].getClassName().getString()
                         << ".  Allow missing properties." << endl;
                    projInst = _instances[j].clone();
                    qe.applyProjection(projInst, true);
                }

                Uint32 cnt = projInst.getPropertyCount();
                if (cnt == 0)
                {
                    cout << "-----No properties left after projection" << endl;
                }

                if (cnt > 10)
                {
                    // If more than 10 props, just print the count to keep
                    // the output file short
                    cout << "Instance has " << cnt << " properties" << endl;
                }
                else
                {
                    for (Uint32 n = 0; n < cnt; n++)
                    {
                        CIMProperty prop = projInst.getProperty(n);
                        CIMValue val = prop.getValue();
                        cout << "-----Prop #" << n << " Name = " << prop.getName().getString();
                        if (val.isNull())
                        {
                            cout << " Value = NULL" << endl;
                        }
                        else
                        {
                            cout << " Value = " << val.toString() << endl;
                        }
                    }
                }
            }
            catch(Exception& e) {
                cout << "-----" << e.getMessage() << endl;
            }
            catch(...) {
                cout << "Unknown Exception" << endl;
            }

        }
    }

    return true;
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:84,代码来源:QueryExpression.cpp

示例10: handleIndication

void EmailListenerDestination::handleIndication(
    const OperationContext& context,
    const String nameSpace,
    CIMInstance& indication,
    CIMInstance& handler,
    CIMInstance& subscription,
    ContentLanguages & contentLanguages)
{
    PEG_METHOD_ENTER (TRC_IND_HANDLER,
                      "EmailListenerDestination::handleIndication");

    String indicationText;

    try
    {
        // gets formatted indication message
        indicationText = IndicationFormatter::getFormattedIndText(
                             subscription, indication, contentLanguages);

        // get MailTo from handler instance
        Array<String> mailTo;
        handler.getProperty(handler.findProperty(
                                PEGASUS_PROPERTYNAME_LSTNRDST_MAILTO)).getValue().get(mailTo);

        // get MailSubject from handler instance
        String mailSubject = String::EMPTY;
        handler.getProperty(handler.findProperty(
                                PEGASUS_PROPERTYNAME_LSTNRDST_MAILSUBJECT)).getValue().get(
                                    mailSubject);

        // get MailCc from handler instance
        CIMValue mailCcValue;
        Array<String> mailCc;

        Uint32 posMailCc = handler.findProperty(
                               PEGASUS_PROPERTYNAME_LSTNRDST_MAILCC);

        if (posMailCc != PEG_NOT_FOUND)
        {
            mailCcValue = handler.getProperty(posMailCc).getValue();
        }

        if (!mailCcValue.isNull())
        {
            if ((mailCcValue.getType() == CIMTYPE_STRING) &&
                    (mailCcValue.isArray()))
            {
                mailCcValue.get(mailCc);
            }
        }

        // Sends the formatted indication to the specified recipients
        _sendViaEmail(mailTo, mailCc, mailSubject, indicationText);

    }
    catch (CIMException & c)
    {
        PEG_TRACE_STRING(TRC_IND_HANDLER, Tracer::LEVEL4, c.getMessage());
        PEG_METHOD_EXIT();

        throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, c.getMessage());
    }
    catch (Exception& e)
    {
        PEG_TRACE_STRING(TRC_IND_HANDLER, Tracer::LEVEL4, e.getMessage());
        PEG_METHOD_EXIT();

        throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, e.getMessage());
    }
    catch (...)
    {
        PEG_TRACE_STRING(TRC_IND_HANDLER, Tracer::LEVEL4,
                         "Failed to deliver indication via e-mail.");
        PEG_METHOD_EXIT();

        throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED,
                                       MessageLoaderParms("Handler.EmailListenerDestination."
                                               "EmailListenerDestination.FAILED_TO_DELIVER_INDICATION_VIA_EMAIL",
                                               "Failed to deliver indication via e-mail."));
    }

    PEG_METHOD_EXIT();
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:83,代码来源:EmailListenerDestination.cpp

示例11: initProvider

void InteropProvider::initProvider()
{
    if(providerInitialized)
        return;
    // Placed METHOD_ENTER trace statement after checking whether the
    // provider is initialized because this method will be called for every
    // operation through the InteropProvider, and this method is only
    // interesting the first time it is successfully run.
    PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
        "InteropProvider::initProvider()");

    AutoMutex lock(interopMut);
    if(!providerInitialized)
    {
        //
        // Initialize the object manager instance for the CIM Server, and
        // retrieve the object manager's name property. This is retrieved once
        // and stored for use in constructing other instances requiring its
        // value.
        //
        CIMInstance objectManager = getObjectManagerInstance();
        objectManager.getProperty(objectManager.findProperty(
            OM_PROPERTY_NAME)).getValue().get(objectManagerName);

        //
        // Determine whether the CIMOM should be gathering statistical data
        // based on the GatherStatisticalData property in the object manager.
        //
        Uint32 gatherDataIndex = objectManager.findProperty(
            OM_PROPERTY_GATHERSTATISTICALDATA);
        if(gatherDataIndex != PEG_NOT_FOUND)
        {
            CIMConstProperty gatherDataProp =
                objectManager.getProperty(gatherDataIndex);
            if (gatherDataProp.getType() == CIMTYPE_BOOLEAN)
            {
                CIMValue gatherDataVal  = gatherDataProp.getValue();
                if (!gatherDataVal.isNull())
                {
                    Boolean gatherData;
                    gatherDataVal.get(gatherData);
                    if (gatherData == true)
                    {
                        StatisticalData* sd = StatisticalData::current();
                        sd->setCopyGSD(true);
                    }
                }
            }
        }

        // Cache this class definition for use later.
        profileCapabilitiesClass = repository->getClass(
            PEGASUS_NAMESPACENAME_INTEROP,
            PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES,
            false,
            true,
            false);

        providerClassifications.append(Uint16(5)); // "Instrumentation"

        // initialize namespaces.
        initializeNamespaces();

        // Now cache the Registration info used for ElementConformsToProfile
        cacheProfileRegistrationInfo();

        providerInitialized = true;
    }
    PEG_METHOD_EXIT();
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:70,代码来源:InteropProvider.cpp

示例12: getValue

/*
    Get the value of the defined property (including looping through
    chained properties) and convert that value to an FQLOperand.
*/
Boolean FQLInstancePropertySource::getValue(
    const String& propertyName,
    FQLOperand& value) const
{
    CIMValue val;
    CIMType type;

#ifdef ENABLE_LOCAL_DIAGNOSTICS
    DCOUT << "getValue " << propertyName << " isChained "
          << boolToString(value.isChained()) << endl;
#endif
    // if dotted property, return the embedded instance or false if
    // the value is NOT an instance.
    if (value.isChained())
    {
        if (!_getPropertyValue(ci, propertyName, val))
        {
            // Property could not be found, return false.
            return false;
        }
        type=val.getType();

        if (type != CIMTYPE_INSTANCE)
        {
            return false;
        }
        else
        {
            CIMInstance ciLocal;
            val.get(ciLocal);
            if (value.isChained())
            {
                PEGASUS_ASSERT(value.chainSize() != 0);

                // If this property is chained, resolve the property chain
                FQLOperand x;
                Uint32 chainSize = value.chainSize();
                Uint32 lastEntry = chainSize - 1;

                for (Uint32 i = 0; i < chainSize; i++)
                {
                    // Get chained operand and get name from it
                    x = value.chainItem(i);
                    String pName  = x.getPropertyName();

                    // Get name from the chain item
                    if (!_getPropertyValue(ciLocal, pName, val))
                    {
                        // Property could not be found, return false.
                        return false;
                    }
                    type=val.getType();

                    if (type == CIMTYPE_INSTANCE)
                    {
                        if (i == lastEntry)
                        {
                            return false;
                        }
                        else
                        {
                            val.get(ciLocal);
                        }
                    }
                    else
                    {
                        if (i != lastEntry)
                        {
                            return false;
                        }
                    }
                }
            }
        }
    }
    else
    {
        unsigned int pos=ci.findProperty(propertyName);
        if (pos==PEG_NOT_FOUND)
        {
            // Property could not be found, return false.
            return false;
        }

        val=ci.getProperty(pos).getValue();
        type=val.getType();
    }

    if (val.isNull())
    {
        value=FQLOperand();
        return true;
    }

    if (val.isArray())
    {
//.........这里部分代码省略.........
开发者ID:deleisha,项目名称:neopegasus,代码行数:101,代码来源:FQLInstancePropertySource.cpp

示例13: _getIndPropertyValue

String IndicationFormatter::_getIndPropertyValue(
    const String & specifiedPropertyName,
    const String & arrayIndexStr,
    const CIMInstance & indication,
    const ContentLanguages & contentLangs)
{
    PEG_METHOD_ENTER (TRC_IND_FORMATTER,
        "IndicationFormatter::_getIndPropertyValue");

    CIMInstance indicationInstance = indication.clone();
    String propertyName;

    Boolean canLocalize = false;

#if defined(PEGASUS_HAS_ICU) && defined(PEGASUS_INDFORMATTER_USE_ICU)
    Locale locale;
    canLocalize = _canLocalize(contentLangs, locale);
#endif

    for (Uint32 i=0; i < indicationInstance.getPropertyCount(); i++)
    {
        CIMProperty property = indicationInstance.getProperty(i);
        propertyName = property.getName().getString();

        // get specified property value
        if (String::equalNoCase(propertyName, specifiedPropertyName))
        {
            CIMValue propertyValue = property.getValue();
            Boolean valueIsNull = propertyValue.isNull();
	    CIMType type = propertyValue.getType();

            if (!valueIsNull)
            {
                Boolean isArray = propertyValue.isArray();

                if (isArray)
                {
                    PEG_METHOD_EXIT();
		    return (_getArrayValues(propertyValue, arrayIndexStr,
			                    contentLangs));
                }
                else // value is not an array
                {
#if defined(PEGASUS_HAS_ICU) && defined(PEGASUS_INDFORMATTER_USE_ICU)
		    if (canLocalize)
		    {
                        if (type == CIMTYPE_DATETIME)
		        {
			    CIMDateTime dateTimeValue;
			    propertyValue.get(dateTimeValue);
                            PEG_METHOD_EXIT();
			    return(_localizeDateTime(dateTimeValue, locale));
		        }
                        else if (type == CIMTYPE_BOOLEAN)
		        {
			    Boolean booleanValue;
			    propertyValue.get(booleanValue);
                            PEG_METHOD_EXIT();
			    return(_localizeBooleanStr(booleanValue, locale));
		        }
                        else
                        {
                            PEG_METHOD_EXIT();
                            return (propertyValue.toString());
                        }
		    }
		    else
		    {
			if (type == CIMTYPE_BOOLEAN)
			{
                            PEG_METHOD_EXIT();
                            return (_getBooleanStr(propertyValue));
			}
			else
			{
                            PEG_METHOD_EXIT();
                            return (propertyValue.toString());
			}
		    }
#else
		    if (type == CIMTYPE_BOOLEAN)
		    {
                        PEG_METHOD_EXIT();
                        return (_getBooleanStr(propertyValue));
		    }
		    else
		    {
                        PEG_METHOD_EXIT();
                        return (propertyValue.toString());
		    }
#endif
                }

            }
            else // value is NULL
            {
                PEG_METHOD_EXIT();
                return ("NULL");
            }

//.........这里部分代码省略.........
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:101,代码来源:IndicationFormatter.cpp

示例14: test01

void test01()
{
    CIMProperty pnull;

    PEGASUS_TEST_ASSERT(pnull.isUninitialized());

    CIMProperty p1(CIMName ("message"), String("Hi There"));
    p1.addQualifier(CIMQualifier(CIMName ("Key"), true));
    p1.addQualifier(CIMQualifier(CIMName ("stuff"), true));
    p1.addQualifier(CIMQualifier(CIMName ("stuff2"), true));
    p1.addQualifier(CIMQualifier(CIMName ("Description"), String("Blah Blah")));
    CIMConstProperty p2 = p1;

    // Test clone
    CIMProperty p1clone = p1.clone();
    CIMProperty p2clone = p2.clone();
   
    // Test print

    if(verbose)
    {
       XmlWriter::printPropertyElement(p1, cout);
       XmlWriter::printPropertyElement(p2, cout);
       XmlWriter::printPropertyElement(p1clone, cout);
       XmlWriter::printPropertyElement(p2clone, cout);
    }

    // Test toMof
       Buffer mofOut;
       MofWriter::appendPropertyElement(true, mofOut, p1);
       MofWriter::appendPropertyElement(true, mofOut, p2);

    // Test toXml
       Buffer xmlOut;
       XmlWriter::appendPropertyElement(xmlOut, p1);
       XmlWriter::appendPropertyElement(xmlOut, p2);

    // Test name
        CIMName name;
        name = p1.getName();
        PEGASUS_TEST_ASSERT(name == CIMName ("message"));
        name = p2.getName();
        PEGASUS_TEST_ASSERT(name == CIMName ("message"));

    // Test type
        PEGASUS_TEST_ASSERT(p1.getType() == CIMTYPE_STRING);
        PEGASUS_TEST_ASSERT(p2.getType() == CIMTYPE_STRING);

    // Test for key qualifier
        Uint32 pos;
        Boolean isKey = false;
        if ((pos = p1.findQualifier (CIMName ("key"))) != PEG_NOT_FOUND)
        {
            CIMValue value;
            value = p1.getQualifier (pos).getValue ();
            if (!value.isNull ())
            {
                value.get (isKey);
            }
        }
        PEGASUS_TEST_ASSERT (isKey);
        isKey = false;
        if ((pos = p2.findQualifier (CIMName ("key"))) != PEG_NOT_FOUND)
        {
            CIMValue value;
            value = p2.getQualifier (pos).getValue ();
            if (!value.isNull ())
            {
                value.get (isKey);
            }
        }
        PEGASUS_TEST_ASSERT (isKey);
    // Test for key property using CIMPropertyInternal
        PEGASUS_TEST_ASSERT (CIMPropertyInternal::isKeyProperty(p1));
        PEGASUS_TEST_ASSERT (CIMPropertyInternal::isKeyProperty(p2));

    // Test getArraySize
        PEGASUS_TEST_ASSERT(p1.getArraySize() == 0);
        PEGASUS_TEST_ASSERT(p2.getArraySize() == 0);

    // Test getPropagated
        PEGASUS_TEST_ASSERT(p1.getPropagated() == false);
        PEGASUS_TEST_ASSERT(p2.getPropagated() == false);

    // Tests for Qualifiers
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff2")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff21")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuf")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.getQualifierCount() == 4);

    PEGASUS_TEST_ASSERT(p2.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p2.findQualifier(CIMName ("stuff2")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p2.findQualifier(CIMName ("stuff21")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p2.findQualifier(CIMName ("stuf")) == PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p2.getQualifierCount() == 4);

    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff")) != PEG_NOT_FOUND);
    PEGASUS_TEST_ASSERT(p1.findQualifier(CIMName ("stuff2")) != PEG_NOT_FOUND);

//.........这里部分代码省略.........
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:101,代码来源:Property.cpp

示例15: logCurrentRegProvider

void AuditLogger::logCurrentRegProvider(
    const Array < CIMInstance > & instances)
{
    // check if SMF is gathering this type of records.
    if (_smf.isRecording(CONFIGURATION) ||
        (! _isInternalWriterUsed) )
    {
        unsigned char * provStatRecord;
        unsigned char * cursor;
        int cursorOffset;

        _smf86_provider_status * provStatSection;

        String moduleName;
        int moduleNameLen;
        String statusValue;
        Uint32 pos;

        // For all current registered providers.
        for (Uint32 i = 0; i < instances.size(); i++)
        {
            // Get the module name.
            instances[i].getProperty(instances[i].findProperty(
                _PROPERTY_PROVIDERMODULE_NAME)).getValue().get(moduleName);

            // +1 for the 0x00 termination.
            moduleNameLen = moduleName.size()+1;

            // Allocate the full record.
            provStatRecord = (unsigned char *) calloc(1,
                sizeof(_smf86_provider_status_record) + moduleNameLen );

            // Initialize the header and product section.
            // The length is the total of subtype section + variable parts.
            _smf.initMyProlog((_smf86_record_prolog *)provStatRecord,
                PROVIDER_STATUS,
                sizeof(_smf86_provider_status) + moduleNameLen );

            // Set the pointer to the subtype section.
            provStatSection = (_smf86_provider_status *)
                (provStatRecord + sizeof(_smf86_record_prolog));

            pos = instances[i].findProperty(_PROPERTY_OPERATIONALSTATUS);

            if (pos == PEG_NOT_FOUND)
            {
                provStatSection->CurrStatus = 0;
            }
            else
            {
                CIMValue theValue = instances[i].getProperty(pos).getValue();
                if (theValue.isNull())
                {
                    provStatSection->CurrStatus = 0;
                }
                else
                {
                    Array<Uint16> moduleStatus;
                    // Get the module status
                    theValue.get(moduleStatus);
                    // reset the smf record field
                    provStatSection->CurrStatus = 0;
                    for (int j = 0; j < moduleStatus.size();j++)
                    {
                        // Accumulate the status of the provider
                        // by shifting a bit the value of moduleStatus
                        // times to the left to get the right bit set.
                        provStatSection->CurrStatus =
                            provStatSection->CurrStatus +
                            ( 1 << moduleStatus[j] );
                    }

                }
            } // End of status set.

            // The provider does not change its state.
            provStatSection->IsChanging=0;
            provStatSection->NewStatus=0;

            // The variable values are starting
            // at the end of the subtype section.
            cursor = provStatRecord + sizeof(_smf86_provider_status_record);
            cursorOffset = sizeof(_smf86_provider_status);

            // Set the provider module name.
            provStatSection->ProvNameOf = cursorOffset;
            provStatSection->ProvNameNo = 1;
            provStatSection->ProvNameLen = moduleNameLen;
            _smf.setEBCDICRecordField(cursor,
                (const char*)moduleName.getCString(),
                moduleNameLen,true);

            _writeAuditMessage(PROVIDER_STATUS,(char *)provStatRecord);
            free(provStatRecord);

        } // For all current registered providers.
    }
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:98,代码来源:AuditLoggerToSMF.cpp


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