1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import { XMLElem } from "@/util/XmlElem";
- import type { NamespaceTable } from "./NameSpaceTable";
- import { UABaseNode, type UABaseNodeOptions } from "./UABaseNode";
- import type { IAddressSpace } from "./IAddressSpace";
- export class UAObjectType extends UABaseNode{
- public isAbstract: boolean;
-
- constructor(options: UAObjectTypeOptions) {
- super(options)
- this.isAbstract=options.isAbstract||false;
- }
- static fromXML(xmlObjType: any, addressSpace: IAddressSpace): UAObjectType{
- const bn=super.fromXML(xmlObjType, addressSpace)
- return new UAObjectType({nodeId: bn.nodeId,
- browseName: bn.browseName,
- displayName: bn.displayName,
- references: bn.references,
- isAbstract: xmlObjType['@_IsAbstract']==='true',
- addressSpace: addressSpace});
- }
- toXML(lnst:NamespaceTable, gnst:NamespaceTable): XMLElem {
- const nid=UABaseNode.localNodeId(this.nodeId, lnst, gnst);
- const elem =new XMLElem('UAObjectType');
- elem.attr('NodeId', nid.toString())
- .attr('BrowseName', this.browseName)
- .attr('IsAbstract', this.isAbstract)
- .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 UAObjectTypeOptions extends UABaseNodeOptions{
- isAbstract?: boolean
- }
|