import { XMLElem } from "@/util/XmlElem"; import { UABaseNode, type UABaseNodeOptions } from "./UABaseNode"; export class UAObject extends UABaseNode { constructor(options: UAObjectNodeOptions) { super(options); } static fromXML(uaObject: any): UAObject{ const bn=super.fromXML(uaObject) return new UAObject({nodeId: bn.nodeId, browseName: bn.browseName, nodeClass: "Object", namespace: bn.namespace, displayName: bn.displayName, references: bn.references}); } toXML(): XMLElem { const elem =new XMLElem('UAVariable'); elem.attr('NodeID', this.nodeId.toString()) .attr('BrowseName', this.browseName) .attr('DisplayName', this.displayName); const refs=elem.add(new XMLElem('References')) for(const ref of this.references) { refs.add(ref.toXML()); } return elem; } } export interface UAObjectNodeOptions extends UABaseNodeOptions{ }