123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import { XMLElem } from "@/util/XmlElem";
- import { UABaseNode, type UABaseNodeOptions } from "./UABaseNode";
- import type { NamespaceTable } from "./NameSpaceTable";
- export class UAVariable extends UABaseNode {
- constructor(options: UAVariableNodeOptions) {
- super(options);
- this.nodeClass="Variable";
- }
- static fromXML(uaObject: any): UAVariable{
- const bn=super.fromXML(uaObject)
- return new UAVariable({nodeId: bn.nodeId,
- browseName: bn.browseName,
- displayName: bn.displayName,
- references: bn.references});
- }
- toXML(lnst:NamespaceTable, gnst:NamespaceTable): XMLElem {
- const nid=UABaseNode.localNodeId(this.nodeId, lnst, gnst);
- const elem =new XMLElem('UAVariable');
- elem.attr('NodeId', nid.toString())
- .attr('BrowseName', this.browseName)
- .elem('DisplayName', this.displayName);
- const refs=elem.add(new XMLElem('References'))
- for(const ref of this.references) {
- if(ref.fromNode.nodeId.toString()==this.nodeId.toString()) //on load resolveReferences() duplicates references to both sides. skip them for export
- refs.add(ref.toXML(lnst, gnst));
- }
- return elem;
- }
- }
- }
- export interface UAVariableNodeOptions extends UABaseNodeOptions{
- }
|