📄 cqlvaluerep.cpp
字号:
x._valueType != CQLValue::Uint64_type && x._valueType != CQLValue::Real_type) { MessageLoaderParms mload(String("CQL.CQLValueRep.OP_TYPE_MISMATCH"), String("Validation type mismatch error for type: $0"), String("SINT64, UINT64, REAL64")); throw CQLRuntimeException(mload); } break; case CQLValue::String_type: if(x._valueType != CQLValue::String_type) { MessageLoaderParms mload(String("CQL.CQLValueRep.OP_TYPE_MISMATCH"), String("Validation type mismatch error for type: $0"), String("STIRNG")); throw CQLRuntimeException(mload); } break; case CQLValue::CIMDateTime_type: if(x._valueType != CQLValue::CIMDateTime_type) { MessageLoaderParms mload(String("CQL.CQLValueRep.OP_TYPE_MISMATCH"), String("Validation type mismatch error for type: $0"), String("CIMDATETIME")); throw CQLRuntimeException(mload); } break; case CQLValue::CIMReference_type: if(x._valueType != CQLValue::CIMReference_type) { MessageLoaderParms mload(String("CQL.CQLValueRep.OP_TYPE_MISMATCH"), String("Validation type mismatch error for type: $0"), String("CIMREFERENCE")); throw CQLRuntimeException(mload); } break; case CQLValue::CIMObject_type: if(x._valueType != CQLValue::CIMObject_type) { MessageLoaderParms mload(String("CQL.CQLValueRep.OP_TYPE_MISMATCH"), String("Validation type mismatch error for type: $0"), String("CIMOBJECT")); throw CQLRuntimeException(mload); } break; case CQLValue::CQLIdentifier_type: if(x._valueType != CQLValue::CQLIdentifier_type) { MessageLoaderParms mload(String("CQL.CQLValueRep.OP_TYPE_MISMATCH"), String("Validation type mismatch error for type: $0"), String("CQLIDENTIFIER")); throw CQLRuntimeException(mload); } break; default: MessageLoaderParms mload(String("CQL.CQLValueRep.OP_TYPE_MISMATCH"), String("Validation type mismatch error for type: $0"), String("UNKNOWN")); throw CQLRuntimeException(mload); break; } PEG_METHOD_EXIT(); return;}void CQLValueRep::_setValue(CIMValue cv,Sint64 key){ PEG_METHOD_ENTER(TRC_CQL,"CQLValueRep::_setValue()"); CIMValue tmp; Uint32 index = 0; if(cv.isNull()) { _valueType = CQLValue::Null_type; } if(key != -1) { index = (Uint32)key; } if(cv.isArray()) { switch(cv.getType()) { case CIMTYPE_BOOLEAN: { if(key == -1) { _theValue = cv; } else { Array<Boolean> _bool; cv.get(_bool); _theValue.set(_bool[index]); } _valueType = CQLValue::Boolean_type; break; } case CIMTYPE_UINT8: { Array<Uint8> _uint; cv.get(_uint); if(key == -1) { Array<Uint64> _uint64; for(Uint32 i = 0; i < _uint.size(); ++i) { _uint64.append((Uint64)_uint[i]); } _theValue = CIMValue(_uint64); } else { _theValue.set((Uint64)_uint[index]); } _valueType = CQLValue::Uint64_type; break; } case CIMTYPE_UINT16: { Array<Uint16> _uint; cv.get(_uint); if(key == -1) { Array<Uint64> _uint64; for(Uint32 i = 0; i < _uint.size(); ++i) { _uint64.append((Uint64)_uint[i]); } _theValue = CIMValue(_uint64); } else { _theValue.set((Uint64)_uint[index]); } _valueType = CQLValue::Uint64_type; break; } case CIMTYPE_UINT32: { Array<Uint32> _uint; cv.get(_uint); if(key == -1) { Array<Uint64> _uint64; for(Uint32 i = 0; i < _uint.size(); ++i) { _uint64.append((Uint64)_uint[i]); } _theValue = CIMValue(_uint64); } else { _theValue.set((Uint64)_uint[index]); } _valueType = CQLValue::Uint64_type; break; } case CIMTYPE_UINT64: { if(key == -1) { _theValue = cv; } else { Array<Uint64> _uint; cv.get(_uint); _theValue.set((Uint64)_uint[index]); } _valueType = CQLValue::Uint64_type; break; } case CIMTYPE_SINT8: { Array<Sint8> _sint; cv.get(_sint); if(key == -1) { Array<Sint64> _sint64; for(Uint32 i = 0; i < _sint.size(); ++i) { _sint64.append((Sint64)_sint[i]); } _theValue = CIMValue(_sint64); } else { _theValue.set((Sint64)_sint[index]); } _valueType = CQLValue::Sint64_type; break; } case CIMTYPE_SINT16: { Array<Sint16> _sint; cv.get(_sint); if(key == -1) { Array<Sint64> _sint64; for(Uint32 i = 0; i < _sint.size(); ++i) { _sint64.append((Sint64)_sint[i]); } _theValue = CIMValue(_sint64); } else { _theValue.set((Sint64)_sint[index]); } _valueType = CQLValue::Sint64_type; break; } case CIMTYPE_SINT32: { Array<Sint32> _sint; cv.get(_sint); if(key == -1) { Array<Sint64> _sint64; for(Uint32 i = 0; i < _sint.size(); ++i) { _sint64.append((Sint64)_sint[i]); } _theValue = CIMValue(_sint64); } else { _theValue.set((Sint64)_sint[index]); } _valueType = CQLValue::Sint64_type; break; } case CIMTYPE_SINT64: { if(key == -1) { _theValue = cv; } else { Array<Sint64> _sint; cv.get(_sint); _theValue.set((Sint64)_sint[index]); } _valueType = CQLValue::Sint64_type; break; } case CIMTYPE_REAL32: { Array<Real32> _real; cv.get(_real); if(key == -1) { Array<Real64> _real64; for(Uint32 i = 0; i < _real.size(); ++i) { _real64.append((Real64)_real[i]); } _theValue = CIMValue(_real64); } else { _theValue.set((Real64)_real[index]); } _valueType = CQLValue::Real_type; break; } case CIMTYPE_REAL64: { if(key == -1) { _theValue = cv; } else { Array<Real64> _real; cv.get(_real); _theValue.set((Real64)_real[index]); } _valueType = CQLValue::Real_type; break; } case CIMTYPE_CHAR16: { Array<Char16> _str16; cv.get(_str16); Char16 _tmp[2]; if(key == -1) { Array<String> _str; for(Uint32 i = 0; i < _str16.size(); ++i) { _tmp[0] = _str16[i]; _tmp[1] = '\0'; _str.append(String(_tmp)); } _theValue = CIMValue(_str); } else { _tmp[0] = _str16[index]; _tmp[1] = '\0'; _theValue.set(String(_tmp)); } _valueType = CQLValue::String_type; break; } case CIMTYPE_STRING: { if(key == -1) { _theValue = cv; } else { Array<String> _str; cv.get(_str); _theValue.set(_str[index]); } _valueType = CQLValue::String_type; break; } case CIMTYPE_DATETIME: { if(key == -1) { _theValue = cv; } else { Array<CIMDateTime> _date; cv.get(_date); _theValue.set(_date[index]); } _valueType = CQLValue::CIMDateTime_type; break; } case CIMTYPE_REFERENCE: { if(key == -1) { _theValue = cv; } else { Array<CIMObjectPath> _path; cv.get(_path); _theValue.set(_path[index]); } _valueType = CQLValue::CIMReference_type; break; } case CIMTYPE_OBJECT:#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT case CIMTYPE_INSTANCE: { Boolean isInstance = cv.getType() == CIMTYPE_INSTANCE; if(key == -1) { _theValue = cv; } else { if(isInstance) { Array<CIMInstance> _inst; cv.get(_inst); _theValue.set((CIMObject)(_inst[index])); } else { Array<CIMObject> _obj; cv.get(_obj); _theValue.set(_obj[index]); } } _valueType = CQLValue::CIMObject_type; break; } #else { if(key == -1) { _theValue = cv; } else { Array<CIMObject> _obj; cv.get(_obj); _theValue.set(_obj[index]); } _valueType = CQLValue::CIMObject_type; break; }#endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT default: MessageLoaderParms mload(String("CQL.CQLValueRep.SET_VALUE"), String("Unable to set internal object type: $0."), cv.getType()); throw CQLRuntimeException(mload); } // switch statement } else { switch(cv.getType()) { case CIMTYPE_BOOLEAN: { _theValue = cv; _valueType = CQLValue::Boolean_type; break; } case CIMTYPE_UINT8: { Uint8 _tmp; cv.get(_tmp); _theValue = CIMValue((Uint64)_tmp); _valueType = CQLValue::Uint64_type; break; } case CIMTYPE_UINT16: { Uint16 _tmp; cv.get(_tmp); _theValue = CIMValue((Uint64)_tmp); _valueType = CQLValue::Uint64_type; break; } case CIMTYPE_UINT32: { Uint32 _tmp; cv.get(_tmp); _theValue = CIMValue((Uint64)_tmp); _valueType = CQLValue::Uint64_type; break; } case CIMTYPE_UINT64: { Uint64 _tmp; cv.get(_tmp); _theValue = CIMValue((Uint64)_tmp); _valueType = CQLValue::Uint64_type; break; } case CIMTYPE_SINT8: { Sint8 _tmp; cv.get(_tmp); _theValue = CIMValue((Sint64)_tmp); _valueType = CQLValue::Sint64_type; break; } case CIMTYPE_SINT16: { Sint16 _tmp; cv.get(_tmp); _theValue = CIMValue((Sint64)_tmp); _valueType = CQLValue::Sint64_type; break; } case CIMTYPE_SINT32: { Sint32 _tmp; cv.get(_tmp); _theValue = CIMValue((Sint64)_tmp); _valueType = CQLValue::Sint64_type; break; } case CIMTYPE_SINT64: { Sint64 _tmp; cv.get(_tmp); _theValue = CIMValue((Sint64)_tmp); _valueType = CQLValue::Sint64_type; break; } case CIMTYPE_REAL32: { Real32 _tmp; cv.get(_tmp); _theValue = CIMValue((Real64)_tmp); _valueType = CQLValue::Real_type; break; } case CIMTYPE_REAL64: { Real64 _tmp; cv.get(_tmp); _theValue = CIMValue((Real64)_tmp); _valueType = CQLValue::Real_type; break; } case CIMTYPE_CHAR16: { Char16 _tmp[2]; cv.get(_tmp[0]); _tmp[1] = '\0'; _theValue = CIMValue(String(_tmp)); _valueType = CQLValue::String_type; break; } case CIMTYPE_STRING: { _theValue = cv; _valueType = CQLValue::String_type; break; } case CIMTYPE_DATETIME: { _theValue = cv; _valueType = CQLValue::CIMDateTime_type; break; } case CIMTYPE_REFERENCE: { _theValue = cv; _valueType = CQLValue::CIMReference_type; break; } case CIMTYPE_OBJECT: { _theValue = cv; _valueType = CQLValue::CIMObject_type; break; }#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT case CIMTYPE_INSTANCE: { // Convert the value into an Object value CIMValue convertedValue(CIMTYPE_OBJECT, false); CIMInstance tmpInst; cv.get(tmpInst); convertedValue.set((CIMObject)tmpInst); _theValue = convertedValue; _valueType = CQLValue::CIMObject_type; break; } #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT default: MessageLoaderParms mload(String("CQL.CQLValueRep.SET_VALUE"), String("Unable to set internal object type: $0."), cv.getType()); throw CQLRuntimeException(mload); } } _isResolved = true; PEG_METHOD_EXIT(); return;}void CQLValueRep::applyContext(const QueryContext& _ctx, const CQLChainedIdentifier& inCid){ if(inCid.size() != 0 && _CQLChainId.size() == 1) { // If we get here we have a stand alone Symbolic constant. // We need to take the chain and create a complete context // for the symbolic constant. We will use the context from // inCid to populate the context for chain. /* _CQLChainId[0].setName(inCid[inCid.size()-1].getName()); _CQLChainId[0].applyScope(inCid[inCid.size()-1].getScope()); */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -