ChimeraTK-ControlSystemAdapter-OPCUAAdapter  04.00.01
ua_namespace.opcua_namespace Class Reference

Namespace Organizer. More...

+ Collaboration diagram for ua_namespace.opcua_namespace:

Public Member Functions

def __init__ (self, name)
 
def addNamespace (self, numericId, stringURL)
 
def linkLater (self, pointer)
 
def getUnlinkedPointers (self)
 
def unlinkedItemCount (self)
 
def buildAliasList (self, xmlelement)
 
def getNodeByBrowseName (self, idstring)
 
def getNodeByIDString (self, idstring)
 
def createNode (self, ndtype, xmlelement)
 
def removeNodeById (self, nodeId)
 
def registerBinaryIndirectPointer (self, node)
 
def getBinaryIndirectPointerIndex (self, node)
 
def parseXML (self, xmldoc)
 
def linkOpenPointers (self)
 
def sanitize (self)
 
def getRoot (self)
 
def buildEncodingRules (self)
 
def allocateVariables (self)
 
def printDot (self, filename="namespace.dot")
 
def getSubTypesOf (self, tdNodes=None, currentNode=None, hasSubtypeRefNode=None)
 
def printDotGraphWalk (self, depth=1, filename="out.dot", rootNode=None, followInverse=False, excludeNodeIds=[])
 
def __reorder_getMinWeightNode__ (self, nmatrix)
 
def reorderNodesMinDependencies (self)
 
def printOpen62541Header (self, printedExternally=[], supressGenerationOfAttribute=[], outfilename="")
 

Public Attributes

 nodes
 
 knownNodeTypes
 
 name
 
 nodeids
 
 aliases
 
 namespaceIdentifiers
 

Static Public Attributes

list nodes = []
 
dictionary nodeids = {}
 
dictionary aliases = {}
 
string name = ""
 
string knownNodeTypes = ""
 
dictionary namespaceIdentifiers = {}
 

Detailed Description

Namespace Organizer.

Class holding and managing a set of OPCUA nodes.

    This class handles parsing XML description of namespaces, instantiating
    nodes, linking references, graphing the namespace and compiling a binary
    representation.

    Note that nodes assigned to this class are not restricted to having a
    single namespace ID. This class represents the entire physical address
    space of the binary representation and all nodes that are to be included
    in that segment of memory.

Definition at line 49 of file ua_namespace.py.

Constructor & Destructor Documentation

◆ __init__()

def ua_namespace.opcua_namespace.__init__ (   self,
  name 
)

Definition at line 70 of file ua_namespace.py.

Member Function Documentation

◆ __reorder_getMinWeightNode__()

def ua_namespace.opcua_namespace.__reorder_getMinWeightNode__ (   self,
  nmatrix 
)

Definition at line 534 of file ua_namespace.py.

+ Here is the caller graph for this function:

◆ addNamespace()

def ua_namespace.opcua_namespace.addNamespace (   self,
  numericId,
  stringURL 
)

Definition at line 81 of file ua_namespace.py.

◆ allocateVariables()

def ua_namespace.opcua_namespace.allocateVariables (   self)

Definition at line 435 of file ua_namespace.py.

◆ buildAliasList()

def ua_namespace.opcua_namespace.buildAliasList (   self,
  xmlelement 
)
Parses the <Alias> XML Element present in must XML NodeSet definitions.

No return value

Contents the Alias element are stored in a dictionary for further
dereferencing during pointer linkage (see linkOpenPointer()).

Definition at line 113 of file ua_namespace.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildEncodingRules()

def ua_namespace.opcua_namespace.buildEncodingRules (   self)
Calls buildEncoding() for all DataType nodes (opcua_node_dataType_t).

No return value

Definition at line 423 of file ua_namespace.py.

◆ createNode()

def ua_namespace.opcua_namespace.createNode (   self,
  ndtype,
  xmlelement 
)
createNode is instantiates a node described by xmlelement, its type being
defined by the string ndtype.

No return value

If the xmlelement is an <Alias>, the contents will be parsed and stored
for later dereferencing during pointer linking (see linkOpenPointers).

Recognized types are:
* UAVariable
* UAObject
* UAMethod
* UAView
* UAVariableType
* UAObjectType
* UAMethodType
* UAReferenceType
* UADataType

For every recognized type, an appropriate node class is added to the node
list of the namespace. The NodeId of the given node is created and parsing
of the node attributes and elements is delegated to the parseXML() and
parseXMLSubType() functions of the instantiated class.

If the NodeID attribute is non-unique in the node list, the creation is
deferred and an error is logged.

Definition at line 168 of file ua_namespace.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBinaryIndirectPointerIndex()

def ua_namespace.opcua_namespace.getBinaryIndirectPointerIndex (   self,
  node 
)
Returns the slot/index of a pointer in the indirect referencing space
(first 765 Bytes) of the binary representation.

Definition at line 275 of file ua_namespace.py.

◆ getNodeByBrowseName()

def ua_namespace.opcua_namespace.getNodeByBrowseName (   self,
  idstring 
)
Returns the first node in the nodelist whose browseName matches idstring.

Definition at line 139 of file ua_namespace.py.

+ Here is the caller graph for this function:

◆ getNodeByIDString()

def ua_namespace.opcua_namespace.getNodeByIDString (   self,
  idstring 
)
Returns the first node in the nodelist whose id string representation
matches idstring.

Definition at line 153 of file ua_namespace.py.

+ Here is the caller graph for this function:

◆ getRoot()

def ua_namespace.opcua_namespace.getRoot (   self)
Returns the first node instance with the browseName "Root".

Definition at line 418 of file ua_namespace.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSubTypesOf()

def ua_namespace.opcua_namespace.getSubTypesOf (   self,
  tdNodes = None,
  currentNode = None,
  hasSubtypeRefNode = None 
)

Definition at line 457 of file ua_namespace.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUnlinkedPointers()

def ua_namespace.opcua_namespace.getUnlinkedPointers (   self)
Return the list of references registered for linking during the next call
of linkOpenPointers()

Definition at line 101 of file ua_namespace.py.

◆ linkLater()

def ua_namespace.opcua_namespace.linkLater (   self,
  pointer 
)
Called by nodes or references who have parsed an XML reference to a
node represented by a string.

No return value

XML String representations of references have the form 'i=xy' or
'ns=1;s="This unique Node"'. Since during the parsing of this attribute
only a subset of nodes are known/parsed, this reference string cannot be
linked when encountered.

References register themselves with the namespace to have their target
attribute (string) parsed by linkOpenPointers() when all nodes are
created, so that target can be dereferenced an point to an actual node.

Definition at line 84 of file ua_namespace.py.

◆ linkOpenPointers()

def ua_namespace.opcua_namespace.linkOpenPointers (   self)
Substitutes symbolic NodeIds in references for actual node instances.

No return value

References that have registered themselves with linkLater() to have
their symbolic NodeId targets ("ns=2;i=32") substituted for an actual
node will be iterated by this function. For each reference encountered
in the list of unlinked/open references, the target string will be
evaluated and searched for in the node list of this namespace. If found,
the target attribute of the reference will be substituted for the
found node.

If a reference fails to get linked, it will remain in the list of
unlinked references. The individual items in this list can be
retrieved using getUnlinkedPointers().

Definition at line 321 of file ua_namespace.py.

+ Here is the call graph for this function:

◆ parseXML()

def ua_namespace.opcua_namespace.parseXML (   self,
  xmldoc 
)
Reads an XML Namespace definition and instantiates node.

No return value

parseXML open the file xmldoc using xml.dom.minidom and searches for
the first UANodeSet Element. For every Element encountered, createNode
is called to instantiate a node of the appropriate type.

Definition at line 284 of file ua_namespace.py.

+ Here is the call graph for this function:

◆ printDot()

def ua_namespace.opcua_namespace.printDot (   self,
  filename = "namespace.dot" 
)
Outputs a graphiz/dot description of all nodes in the namespace.

Output will written into filename to be parsed by dot/neato...

Note that for namespaces with more then 20 nodes the reference structure
will lead to a mostly illegible and huge graph. Use printDotGraphWalk()
for plotting specific portions of a large namespace.

Definition at line 440 of file ua_namespace.py.

◆ printDotGraphWalk()

def ua_namespace.opcua_namespace.printDotGraphWalk (   self,
  depth = 1,
  filename = "out.dot",
  rootNode = None,
  followInverse = False,
  excludeNodeIds = [] 
)
Outputs a graphiz/dot description the nodes centered around rootNode.

References beginning from rootNode will be followed for depth steps. If
"followInverse = True" is passed, then inverse (not Forward) references
will also be followed.

Nodes can be excluded from the graph by passing a list of NodeIds as
string representation using excludeNodeIds (ex ["i=53", "ns=2;i=453"]).

Output is written into filename to be parsed by dot/neato/srfp...

Definition at line 480 of file ua_namespace.py.

+ Here is the call graph for this function:

◆ printOpen62541Header()

def ua_namespace.opcua_namespace.printOpen62541Header (   self,
  printedExternally = [],
  supressGenerationOfAttribute = [],
  outfilename = "" 
)

Definition at line 616 of file ua_namespace.py.

+ Here is the call graph for this function:

◆ registerBinaryIndirectPointer()

def ua_namespace.opcua_namespace.registerBinaryIndirectPointer (   self,
  node 
)
Appends a node to the list of nodes that should be contained in the
first 765 bytes (255 pointer slots a 3 bytes) in the binary
representation (indirect referencing space).

This function is reserved for references and dataType pointers.

Definition at line 264 of file ua_namespace.py.

◆ removeNodeById()

def ua_namespace.opcua_namespace.removeNodeById (   self,
  nodeId 
)

Definition at line 250 of file ua_namespace.py.

+ Here is the call graph for this function:

◆ reorderNodesMinDependencies()

def ua_namespace.opcua_namespace.reorderNodesMinDependencies (   self)

Definition at line 554 of file ua_namespace.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sanitize()

def ua_namespace.opcua_namespace.sanitize (   self)

Definition at line 406 of file ua_namespace.py.

◆ unlinkedItemCount()

def ua_namespace.opcua_namespace.unlinkedItemCount (   self)
Returns the number of unlinked references that will be processed during
the next call of linkOpenPointers()

Definition at line 107 of file ua_namespace.py.

+ Here is the caller graph for this function:

Member Data Documentation

◆ aliases [1/2]

dictionary ua_namespace.opcua_namespace.aliases = {}
static

Definition at line 63 of file ua_namespace.py.

◆ aliases [2/2]

ua_namespace.opcua_namespace.aliases

Definition at line 77 of file ua_namespace.py.

◆ knownNodeTypes [1/2]

string ua_namespace.opcua_namespace.knownNodeTypes = ""
static

Definition at line 67 of file ua_namespace.py.

◆ knownNodeTypes [2/2]

ua_namespace.opcua_namespace.knownNodeTypes

Definition at line 72 of file ua_namespace.py.

◆ name [1/2]

string ua_namespace.opcua_namespace.name = ""
static

Definition at line 66 of file ua_namespace.py.

◆ name [2/2]

ua_namespace.opcua_namespace.name

Definition at line 75 of file ua_namespace.py.

◆ namespaceIdentifiers [1/2]

dictionary ua_namespace.opcua_namespace.namespaceIdentifiers = {}
static

Definition at line 68 of file ua_namespace.py.

◆ namespaceIdentifiers [2/2]

ua_namespace.opcua_namespace.namespaceIdentifiers

Definition at line 78 of file ua_namespace.py.

◆ nodeids [1/2]

dictionary ua_namespace.opcua_namespace.nodeids = {}
static

Definition at line 62 of file ua_namespace.py.

◆ nodeids [2/2]

ua_namespace.opcua_namespace.nodeids

Definition at line 76 of file ua_namespace.py.

◆ nodes [1/2]

list ua_namespace.opcua_namespace.nodes = []
static

Definition at line 61 of file ua_namespace.py.

◆ nodes [2/2]

ua_namespace.opcua_namespace.nodes

Definition at line 71 of file ua_namespace.py.


The documentation for this class was generated from the following file: