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


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

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


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

示例1: setValue

void CIMPropertyRep::setValue(const CIMValue& value)
{
    // CIMType of value is immutable:

    if (!value.typeCompatible(_value))
	throw TypeMismatchException();

    if (_arraySize && _arraySize != value.getArraySize())
	throw TypeMismatchException();

    _value = value;
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:12,代码来源:CIMPropertyRep.cpp

示例2: UninitializedObjectException

CIMPropertyRep::CIMPropertyRep(
    const CIMName& name,
    const CIMValue& value,
    Uint32 arraySize,
    const CIMName& referenceClassName,
    const CIMName& classOrigin,
    Boolean propagated)
    :
    _name(name), _value(value), _arraySize(arraySize),
    _referenceClassName(referenceClassName), _classOrigin(classOrigin),
    _propagated(propagated), _refCounter(1), _ownerCount(0)
{
    // ensure name is not null
    if (name.isNull())
    {
        throw UninitializedObjectException();
    }

    // Set the CIM name tag.
    _nameTag = generateCIMNameTag(_name);

    if ((arraySize != 0) &&
        (!value.isArray() || value.getArraySize() != arraySize))
    {
        throw TypeMismatchException();
    }

    // A CIM Property may not be of reference array type
    if (value.isArray() && (value.getType() == CIMTYPE_REFERENCE))
    {
        throw TypeMismatchException();
    }

    // if referenceClassName exists, must be CIMType REFERENCE.
    if (!referenceClassName.isNull())
    {
        if (_value.getType() != CIMTYPE_REFERENCE)
        {
            throw TypeMismatchException();
        }
    }

    // Can a property be of reference type with a null referenceClassName?
    // The DMTF says yes if it is a property of an instance; no if it is a
    // property of a class.  We'll allow it here, but check in the CIMClass
    // addProperty() method.
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:47,代码来源:CIMPropertyRep.cpp

示例3: setValue

void CIMPropertyRep::setValue(const CIMValue& value)
{
    // CIMType of value is immutable:

    if (!value.typeCompatible(_value))
        throw TypeMismatchException();

    if (_arraySize && _arraySize != value.getArraySize())
        throw TypeMismatchException();

    // A CIM Property may not be of reference array type
    if (value.isArray() && (value.getType() == CIMTYPE_REFERENCE))
    {
        throw TypeMismatchException();
    }

    _value = value;
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:18,代码来源:CIMPropertyRep.cpp

示例4: _getArrayValues

String IndicationFormatter::_getArrayValues(
    const CIMValue & propertyValue,
    const String & arrayIndexStr,
    const ContentLanguages & contentLangs)
{
    PEG_METHOD_ENTER (TRC_IND_FORMATTER,
	"IndicationFormatter::_getArrayValues");

    CIMType type = propertyValue.getType();
    String arrayValues;
    char propertyValueBuffer[2048];
    Uint32 arraySize = propertyValue.getArraySize();

    char arrayIndexBuffer[16];
    Sint32 arrayIndex = 0;
    Uint32 sizeOfArrayIndexStr = arrayIndexStr.size();

    // there is an index value enclosed in brackets (e.g. [2])
    if (sizeOfArrayIndexStr != 0)
    {
        sprintf(arrayIndexBuffer, "%s", (const char *)
	    arrayIndexStr.getCString());

	try
	{
	    _isValidIndex(arrayIndexBuffer);
            arrayIndex = atoi(arrayIndexBuffer);
	}
	catch (CIMException & c)
	{
	    arrayIndex = -1;

	    PEG_TRACE_STRING(TRC_IND_FORMATTER, Tracer::LEVEL4,c.getMessage());
	}
    }

    // Array index is out of range
    if (sizeOfArrayIndexStr != 0 &&
	((arrayIndex < 0) || ((Uint32)arrayIndex >= arraySize)))
    {
	arrayValues = "UNKNOWN";

        PEG_METHOD_EXIT();
        return (arrayValues);
    }

    switch (type)
    {
	case CIMTYPE_UINT8:
	{
	    Array<Uint8> propertyValueUint8;
	    propertyValue.get(propertyValueUint8);

	    // Empty brackets (e.g. []), gets all values of the array
	    if (sizeOfArrayIndexStr == 0)
	    {
                arrayValues.append("[");
		for (Uint32 i=0; i<arraySize; i++)
		{
		    sprintf(propertyValueBuffer, "%u",
			propertyValueUint8[i]);
		    arrayValues.append(propertyValueBuffer);

		    if ( i < arraySize-1)
		    {
			arrayValues.append(",");
		    }
		}

		arrayValues.append("]");
	    }
	    else
	    {
	        sprintf(propertyValueBuffer, "%u",
		    propertyValueUint8[arrayIndex]);
	        arrayValues = propertyValueBuffer;
	    }

            break;
	}

	case CIMTYPE_UINT16:
	{
	    Array<Uint16> propertyValueUint16;
	    propertyValue.get(propertyValueUint16);

	    // Empty brackets (e.g. []), gets all values of the array
	    if (sizeOfArrayIndexStr == 0)
	    {
                arrayValues.append("[");
		for (Uint32 i=0; i<arraySize; i++)
		{
		    sprintf(propertyValueBuffer, "%u",
			propertyValueUint16[i]);
		    arrayValues.append(propertyValueBuffer);

		    if ( i < arraySize-1)
		    {
			arrayValues.append(",");
		    }
//.........这里部分代码省略.........
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:101,代码来源:IndicationFormatter.cpp

示例5: CIMDataType

void
CIMtoXML(CIMQualifier const& cq, ostream& ostr)
{
	CIMFlavor fv;
	
	if (cq.getName().empty())
	{
		OW_THROWCIMMSG(CIMException::FAILED, "qualifier must have a name");
	}
	CIMValue dv = cq.getDefaults().getDefaultValue();
	CIMDataType dt = cq.getDefaults().getDataType();
	CIMValue cv = cq.getValue();
	if (!cv)
	{
		cv = dv;
	}
	if (cv)
	{
		if (cv.isArray())
		{
			dt = CIMDataType(cv.getType(),cv.getArraySize());
		}
		else
		{
			dt = CIMDataType(cv.getType());
		}
	}
	OW_ASSERT(dt);
	ostr
		<< "<QUALIFIER NAME=\""
		<< cq.getName()
		<< "\" TYPE=\"";
	CIMtoXML(dt,ostr);
	ostr << "\" ";
	if (cq.getPropagated())
	{
		ostr << "PROPAGATED=\"true\" ";
	}
	//
	// Create flavors
	//
	fv = CIMFlavor(CIMFlavor::ENABLEOVERRIDE);
	if (cq.hasFlavor(fv))
	{
		//
		// Not needed, because OVERRIDABLE defaults to true!
	}
	else
	{
		fv = CIMFlavor(CIMFlavor::DISABLEOVERRIDE);
		if (cq.hasFlavor(fv))
		{
			CIMtoXML(fv, ostr);
			ostr <<  "=\"false\" ";
		}
	}
	fv = CIMFlavor(CIMFlavor::TOSUBCLASS);
	if (cq.hasFlavor(fv))
	{
		//
		// Not needed, because TOSUBCLASS defaults to true!
	}
	else
	{
		fv = CIMFlavor(CIMFlavor::RESTRICTED);
		if (cq.hasFlavor(fv))
		{
			CIMtoXML(fv, ostr);
			ostr <<  "=\"false\" ";
		}
	}
	// This is a bug in the spec, but we still support it for backward compatibility.
	//fv = CIMFlavor(CIMFlavor::TOINSTANCE);
	//if (cq.hasFlavor(fv))
	//{
	//	CIMtoXML(fv, ostr);
	//	ostr << "=\"true\" ";
	//}
	//else
	//{
		//
		// Not needed, because TOINSTANCE defaults to false!
	//}
	fv = CIMFlavor(CIMFlavor::TRANSLATE);
	if (cq.hasFlavor(fv))
	{
		CIMtoXML(fv, ostr);
		ostr << "=\"true\" ";
	}
	else
	{
		//
		// Not needed, because TRANSLATABLE defaults to false!
	}

	String lang = cq.getLanguage();
	if (!lang.empty())
	{
		ostr << " xml:lang=\"";
		ostr << lang;
//.........这里部分代码省略.........
开发者ID:kkaempf,项目名称:openwbem,代码行数:101,代码来源:OW_CIMtoXML.cpp


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