UAVariableType.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import { XMLElem } from "@/util/XmlElem";
  2. import type { NamespaceTable } from "./NameSpaceTable";
  3. import { UABaseNode, type UABaseNodeOptions } from "./UABaseNode";
  4. import type { IAddressSpace } from "./IAddressSpace";
  5. export class UAVariableType extends UABaseNode{
  6. public isAbstract: boolean=false;
  7. constructor(options: UAVariableTypeOptions) {
  8. super(options)
  9. Object.assign(this, options);
  10. this.nodeClass="VariableType";
  11. }
  12. static fromXML(xmlObjType: any, addressSpace: IAddressSpace): UAVariableType{
  13. const bn=super.fromXML(xmlObjType, addressSpace)
  14. const uavt= new UAVariableType(bn as UABaseNodeOptions);
  15. uavt.isAbstract= xmlObjType['@_IsAbstract']==='true';
  16. return uavt;
  17. }
  18. toXML(lnst:NamespaceTable, gnst:NamespaceTable): XMLElem {
  19. const elem =super.toXML(lnst, gnst);
  20. elem.name=this.nodeClass;
  21. elem.attr('IsAbstract', this.isAbstract);
  22. return elem;
  23. }
  24. }
  25. export interface UAVariableTypeOptions extends UABaseNodeOptions{
  26. isAbstract?: boolean
  27. }