|
@@ -1,32 +1,40 @@
|
|
import { XMLElem } from "@/util/XmlElem";
|
|
import { XMLElem } from "@/util/XmlElem";
|
|
import type { NamespaceTable } from "./NameSpaceTable";
|
|
import type { NamespaceTable } from "./NameSpaceTable";
|
|
-import { UABaseNode, type UABaseNodeOptions } from "./UABaseNode";
|
|
|
|
|
|
+import { type UABaseNodeOptions } from "./UABaseNode";
|
|
import type { IAddressSpace } from "./IAddressSpace";
|
|
import type { IAddressSpace } from "./IAddressSpace";
|
|
|
|
+import { UAType } from "./UAType";
|
|
|
|
|
|
-export class UAVariableType extends UABaseNode{
|
|
|
|
- public isAbstract: boolean=false;
|
|
|
|
|
|
+export class UAVariableType extends UAType{
|
|
|
|
+ public dataType?: string;
|
|
|
|
+ public valueRank?: number;
|
|
|
|
+ public arrayDimensions?: string;
|
|
|
|
|
|
constructor(options: UAVariableTypeOptions) {
|
|
constructor(options: UAVariableTypeOptions) {
|
|
super(options)
|
|
super(options)
|
|
Object.assign(this, options);
|
|
Object.assign(this, options);
|
|
- this.nodeClass="VariableType";
|
|
|
|
|
|
+ this.nodeClass="UAVariableType";
|
|
}
|
|
}
|
|
|
|
|
|
static fromXML(xmlObjType: any, addressSpace: IAddressSpace): UAVariableType{
|
|
static fromXML(xmlObjType: any, addressSpace: IAddressSpace): UAVariableType{
|
|
- const bn=super.fromXML(xmlObjType, addressSpace)
|
|
|
|
- const uavt= new UAVariableType(bn as UABaseNodeOptions);
|
|
|
|
- uavt.isAbstract= xmlObjType['@_IsAbstract']==='true';
|
|
|
|
- return uavt;
|
|
|
|
|
|
+ const bn=super.fromXML(xmlObjType, addressSpace) as UAVariableTypeOptions
|
|
|
|
+ bn.dataType= xmlObjType['@_DataType']||"i=24";
|
|
|
|
+ bn.valueRank= Number(xmlObjType['@_ValueRanke']||-1);
|
|
|
|
+ bn.arrayDimensions= xmlObjType['@_ArrayDimensions'];
|
|
|
|
+ return new UAVariableType(bn as UAVariableTypeOptions);
|
|
}
|
|
}
|
|
|
|
|
|
toXML(lnst:NamespaceTable, gnst:NamespaceTable): XMLElem {
|
|
toXML(lnst:NamespaceTable, gnst:NamespaceTable): XMLElem {
|
|
const elem =super.toXML(lnst, gnst);
|
|
const elem =super.toXML(lnst, gnst);
|
|
elem.name=this.nodeClass;
|
|
elem.name=this.nodeClass;
|
|
- elem.attr('IsAbstract', this.isAbstract);
|
|
|
|
|
|
+ elem.attr('DataType', this.dataType);
|
|
|
|
+ elem.attr('ValueRank', this.valueRank?.toString());
|
|
|
|
+ elem.attr('ArrayDimensions', this.arrayDimensions);
|
|
return elem;
|
|
return elem;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
export interface UAVariableTypeOptions extends UABaseNodeOptions{
|
|
export interface UAVariableTypeOptions extends UABaseNodeOptions{
|
|
- isAbstract?: boolean
|
|
|
|
|
|
+ dataType?: string;
|
|
|
|
+ valueRank?: number;
|
|
|
|
+ arrayDimensions?: string;
|
|
}
|
|
}
|