本文整理汇总了TypeScript中node-opcua-nodeid.NodeId.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:TypeScript NodeId.isEmpty方法的具体用法?TypeScript NodeId.isEmpty怎么用?TypeScript NodeId.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类node-opcua-nodeid.NodeId
的用法示例。
在下文中一共展示了NodeId.isEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: n
function n(nodeId: NodeId | null) {
if (!nodeId || nodeId.isEmpty()) {
return "";
}
const node = addressSpace.findNode(nodeId)!;
return "\"" + nodeId.toString() +
"\"" + chalk.yellow(" /* " + (node ? node.browseName.toString() : "???") + " */");
}
示例2: makeRelativePath
export function makeRelativePath(str: string, addressSpace?: any) {
let r: any = {
elements: []
};
while (str.length > 0) {
const matches = str.match(regRelativePath);
if (!matches) {
throw new Error("Malformed relative path :'" + str + "'");
}
// console.log(mm);
let referenceTypeId: NodeId;
let includeSubtypes: boolean;
let isInverse: boolean;
//
// ------------ extract reference type
//
const refStr = matches[1];
if (refStr === "/") {
referenceTypeId = hierarchicalReferenceTypeNodeId;
isInverse = false;
includeSubtypes = true;
} else if (refStr === ".") {
referenceTypeId = aggregatesReferenceTypeNodeId;
isInverse = false;
includeSubtypes = true;
} else {
// match 3 => "#" or null
includeSubtypes = (matches[3] !== "#");
// match 4 => "!" or null
isInverse = (matches[4] === "!");
// match 5
// namespace match 6 ( ns:)
// name match 7
const ns = matches[6] ? parseInt(matches[6], 10) : 0;
const name = matches[7];
if (!matches[6]) {
referenceTypeId = resolveNodeId(name);
} else {
// AddressSpace.prototype.findReferenceType = function (refType,namespace)
referenceTypeId = addressSpace.findReferenceType(name, ns);
}
assert(referenceTypeId && !referenceTypeId.isEmpty());
}
const targetName = makeQualifiedName(matches);
r.elements.push({referenceTypeId, isInverse, includeSubtypes, targetName});
str = str.substr(matches[0].length);
}
r = new RelativePath(r);
return r;
}