lib/address_space/ua_variable.js
/*=
 *
 * @param addressSpace
 * @param dataTypeNodeId : the nodeId matching the dataType of the destination variable.
 * @param variantDataType: the dataType of the variant to write to the destination variable
 * @param nodeId
 * @return {boolean} true if the variant dataType is compatible with the Variable DataType
 */
@param addressSpace
@param dataTypeNodeId : the nodeId matching the dataType of the destination variable.
@param variantDataType: the dataType of the variant to write to the destination variable
@param nodeId
@return {boolean} true if the variant dataType is compatible with the Variable DataType
@param addressSpace @param dataTypeNodeId : the nodeId matching the dataType of the destination variable . @param variantDataType : the dataType of the variant to write to the destination variable @param nodeId @return { boolean } true if the variant dataType is compatible with the Variable DataType
function validateDataType(addressSpace, dataTypeNodeId, variantDataType, nodeId) {
    if (variantDataType === DataType.ExtensionObject) {
        return true;
    }
    var builtInType, builtInUADataType;
    var destUADataType = addressSpace.findNode(dataTypeNodeId);
    assert(destUADataType instanceof UADataType);
    if (destUADataType.isAbstract) {
        builtInUADataType = destUADataType;
    } else {
        builtInType = findBuiltInType(destUADataType.browseName).name;
        builtInUADataType = addressSpace.findDataType(builtInType);
    }
    assert(builtInUADataType instanceof UADataType);
    var variantUADataType = _dataType_toUADataType(addressSpace, variantDataType);
    assert(variantUADataType instanceof UADataType);
    var dest_isSuperTypeOf_variant = variantUADataType.isSupertypeOf(builtInUADataType);
    if (doDebug) {
        if (dest_isSuperTypeOf_variant) {
            console.log(" ---------- Type match !!! ".green, " on ", nodeId.toString());
        } else {
            console.log(" ---------- Type mismatch ".red, " on ", nodeId.toString());
        }
        console.log(" Variable data Type is    = ".cyan, destUADataType.browseName.toString());
        console.log(" which matches basic Type = ".cyan, builtInUADataType.browseName.toString());
        console.log("        Actual   dataType = ".yellow, variantUADataType.browseName.toString());
    }
    return (dest_isSuperTypeOf_variant);
}
function validateDataType ( addressSpace , dataTypeNodeId , variantDataType , nodeId ) { if ( variantDataType === DataType . ExtensionObject ) { return true ; } var builtInType , builtInUADataType ; var destUADataType = addressSpace . findNode ( dataTypeNodeId ) ; assert ( destUADataType instanceof UADataType ) ; if ( destUADataType . isAbstract ) { builtInUADataType = destUADataType ; } else { builtInType = findBuiltInType ( destUADataType . browseName ) . name ; builtInUADataType = addressSpace . findDataType ( builtInType ) ; } assert ( builtInUADataType instanceof UADataType ) ; var variantUADataType = _dataType_toUADataType ( addressSpace , variantDataType ) ; assert ( variantUADataType instanceof UADataType ) ; var dest_isSuperTypeOf_variant = variantUADataType . isSupertypeOf ( builtInUADataType ) ; if ( doDebug ) { if ( dest_isSuperTypeOf_variant ) { console . log ( " ---------- Type match !!! " . green , " on " , nodeId . toString ( ) ) ; } else { console . log ( " ---------- Type mismatch " . red , " on " , nodeId . toString ( ) ) ; } console . log ( " Variable data Type is    = " . cyan , destUADataType . browseName . toString ( ) ) ; console . log ( " which matches basic Type = " . cyan , builtInUADataType . browseName . toString ( ) ) ; console . log ( "        Actual   dataType = " . yellow , variantUADataType . browseName . toString ( ) ) ; } return ( dest_isSuperTypeOf_variant ) ; }
@param addressSpace
 @param dataTypeNodeId : the nodeId matching the dataType of the destination variable.
@param addressSpace @param dataTypeNodeId : the nodeId matching the dataType of the destination variable .
// The value supplied for the attribute is not of the same type as the  value. /* istanbul ignore next */ /* istanbul ignore next*/ /* istanbul ignore next*/