#include <nodemanageruanode.h>
Public Member Functions | |
NodeManagerUaNode (const UaString &sNamespaceUri, OpcUa_Int32 nHashTableSize) | |
virtual | ~NodeManagerUaNode () |
virtual UaStatus | afterStartUp ()=0 |
virtual UaStatus | beforeShutDown ()=0 |
virtual UaNode * | getNode (const UaNodeId &nodeId) |
virtual IOManager * | getIOManager (UaNode *pUaNode, OpcUa_Int32 attributeId) const =0 |
void | registerBrowseUaNodeCallback (BrowseUaNodeCallback *pBrowseUaNodeCallback) |
UaStatus | addUaNode (UaNode *pNewNode) |
UaStatus | deleteUaNode (UaNode *pNode, OpcUa_Boolean deleteTargetReferences, OpcUa_Boolean deleteSourceReferences=OpcUa_False, OpcUa_Boolean deleteAllChildren=OpcUa_False) |
UaStatus | addNodeAndReference (UaReferenceLists *pSourceNode, UaReferenceLists *pNewNode, const UaNodeId &referenceTypeId) |
UaStatus | addNodeAndReference (const UaNodeId &sourceNode, UaReferenceLists *pNewNode, const UaNodeId &referenceTypeId) |
UaStatus | addUaReference (UaReferenceLists *pSourceNode, UaReferenceLists *pTargetNode, const UaNodeId &referenceTypeId) |
UaStatus | addUaReference (const UaNodeId &sourceId, const UaNodeId &targetId, const UaNodeId &referenceTypeId) |
UaStatus | deleteUaReference (UaReferenceLists *pSourceNode, UaReferenceLists *pTargetNode, const UaNodeId &referenceTypeId) |
UaStatus | deleteUaReference (const UaNodeId &sourceId, const UaNodeId &targetId, const UaNodeId &referenceTypeId) |
OpcUa_UInt16 | getNameSpaceIndex () const |
virtual UaStatus | startUp (ServerManager *) |
virtual UaStatus | shutDown () |
virtual UaStatus | browse (const ServiceContext &, BrowseContext &, UaReferenceDescriptions &) |
virtual UaStatus | translateBrowsePathToNodeId (const ServiceContext &, const UaNodeId &, UaRelativePath &, UaBrowsePathTargets &) |
virtual VariableHandle * | getVariableHandle (Session *, VariableHandle::ServiceType, OpcUa_NodeId *, OpcUa_Int32) const |
virtual MethodHandle * | getMethodHandle (Session *, OpcUa_NodeId *, OpcUa_NodeId *, UaStatus &) const |
virtual NodeManagerCrossReferences * | getNodeManagerCrossReferences () |
virtual NodeManagerConfig * | getNodeManagerConfig () |
virtual NodeManagerUaNode * | getNodeManagerUaNode () |
virtual UaStatus | connectStartingNode (const UaNodeId &, NodeManager *, OpcUa_Boolean, OpcUa_Boolean) |
virtual UaStatus | disconnectStartingNode (const UaNodeId &, NodeManager *) |
Protected Member Functions | |
UaStatusCode | clearAllNodes () |
UaNode * | findNode (const UaNodeId &id) const |
UaNode * | findNode (const OpcUa_NodeId *pId) const |
UaString | getNameSpaceUri () |
OpcUa_Boolean | isStarted () |
Protected Attributes | |
ServerManager * | m_pServerManager |
Central server manager object. | |
NodeManagerCrossReferences * | m_pNodeManagerCrossReferences0 |
NodeManagerCrossReferences interface of node manager root (name space 0). | |
NodeManagerList * | m_pNodeManagerList |
NodeManagerList interface of node manager root (name space 0). | |
UaString | m_defaultLocaleId |
Default LocaleId for the node manager. | |
OpcUa_Boolean | m_isStarted |
Flag indicating if the node manager was started. | |
UaMutex | m_mutexNodes |
This mutex is used to synconize access to the nodes and references in this node manager. | |
OpcUa_UInt16 | m_nNamespaceIndex |
Name space index of this node manager. | |
UaString | m_sNamespaceUri |
Name space URI of this node manager. | |
HashTable * | m_pTable |
Hash table for the nodes managed by this node manager. | |
UaMutex | m_mutexAliasTable |
Mutex used to protect access to the hash table. | |
UaObjectPointerArray< UaNodeId > | m_crossNodeManagerAliasNodes |
List of cross node manager alias nodes. | |
BrowseUaNodeCallback * | m_pBrowseUaNodeCallback |
Callback interface to influence browse results. |
Implementation of the interface NodeManager operating on a generic address space node model.
This class implements most of the functionality necessary for a client to navigate through the nodes of the name space managed by this node manager. A derived class containing the product specific implementation must implement the functions afterStartUp to create the nodes of the address space and beforeShutDown to clean up resources in the node manager. It is possible to add and remove nodes and references by using the interface NodeManagerConfig implemented by this node manager class.
NodeManagerUaNode::NodeManagerUaNode | ( | const UaString & | sNamespaceUri, |
OpcUa_Int32 | nHashTableSize | ||
) |
Constructs a NodeManagerUaNode object.
[in] | sNamespaceUri | Name space URI for the name space managed by this node manager instance |
[in] | nHashTableSize | Size of the hash table. The size can be smaller than the total number of nodes managed by the node manager but it is better for the performance to avoid collisions with a large size. Prefered sizes are 1.009, 10.007, 100.003, 1.000.003, 10.000.019 |
NodeManagerUaNode::~NodeManagerUaNode | ( | ) | [virtual] |
Destroys the NodeManagerUaNode object and all nodes managed by the node manager
UaStatus NodeManagerUaNode::addNodeAndReference | ( | UaReferenceLists * | pSourceNode, |
UaReferenceLists * | pNewNode, | ||
const UaNodeId & | referenceTypeId | ||
) | [virtual] |
Adds the new node to the node management and creates reference
Adds the passed new node to the internal node management of the NodeManager and creates a reference from the passed source node to the new node.
[in] | pSourceNode | Pointer to UaReferenceLists interface of the source node. |
[in] | pNewNode | Pointer to UaReferenceLists interface of the new node. |
[in] | referenceTypeId | Type of the reference to create from the source node to the new node. |
Implements NodeManagerConfig.
UaStatus NodeManagerUaNode::addNodeAndReference | ( | const UaNodeId & | sourceNode, |
UaReferenceLists * | pNewNode, | ||
const UaNodeId & | referenceTypeId | ||
) | [virtual] |
Adds the new node to the node management and creates reference
Adds the passed new node to the internal node management of the NodeManager and creates a reference from the passed source node to the new node.
[in] | sourceNode | NodeId of the source node. |
[in] | pNewNode | Pointer to UaReferenceLists interface of the new node. |
[in] | referenceTypeId | Type of the reference to create from the source node to the new node. |
Implements NodeManagerConfig.
Add a new UaNode to the node management.
Adds the passed new node to the internal node management of the NodeManager.
[in] | pNewNode | Pointer to UaNode interface of the new node to add |
Implements NodeManagerConfig.
UaStatus NodeManagerUaNode::addUaReference | ( | UaReferenceLists * | pSourceNode, |
UaReferenceLists * | pTargetNode, | ||
const UaNodeId & | referenceTypeId | ||
) | [virtual] |
Adds a reference from source node to target node
Creates a reference from the passed source node to the passed target node.
[in] | pSourceNode | Pointer to UaReferenceLists interface of the source node. |
[in] | pTargetNode | Pointer to UaReferenceLists interface of the target node. |
[in] | referenceTypeId | Type of the reference to create from the source node to the target node. |
Implements NodeManagerConfig.
UaStatus NodeManagerUaNode::addUaReference | ( | const UaNodeId & | sourceId, |
const UaNodeId & | targetId, | ||
const UaNodeId & | referenceTypeId | ||
) | [virtual] |
Adds a reference from source node to target node
This functions is provided for convenience and behaves like the functions above. This function finds the node objects for the specified source and target nodeIds and creates a new reference if the nodes exist.
[in] | sourceId | NodeId of the source node. |
[in] | targetId | NodeId of the target node. |
[in] | referenceTypeId | Type of the reference to create from the source node to the target node. |
Implements NodeManagerConfig.
virtual UaStatus NodeManagerUaNode::afterStartUp | ( | ) | [pure virtual] |
This method needs to be implemented by the derived class and is called to finish the start up of the NodeManager. This method is typically used to initialize the node manager and to create the nodes available at start up.
Implemented in NodeManagerNS1, NodeManagerRoot, OpcUaDi::NodeManagerDevices, and OpcUaPlc::NodeManagerPLCopen.
virtual UaStatus NodeManagerUaNode::beforeShutDown | ( | ) | [pure virtual] |
This method needs to be implemented by the derived class and is called to start the shut down of the NodeManager. This method is typically used to clean up resources in the node manager. The nodes created in the node manager are automatically deleted by the node manager.
Implemented in NodeManagerNS1, NodeManagerRoot, OpcUaDi::NodeManagerDevices, and OpcUaPlc::NodeManagerPLCopen.
UaStatus NodeManagerUaNode::browse | ( | const ServiceContext & | serviceContext, |
BrowseContext & | browseContext, | ||
UaReferenceDescriptions & | References | ||
) | [virtual] |
Discover the references of a specified node of a view. This method is used to return a list of references and target nodes for the passed node to browse for the services Browse and BrowseNext.
serviceContext | General context for the service call containing information like the session object, return diagnostic mask and timeout hint. |
browseContext | Browse context for the first browse or the following browse next calls with continuation point. |
References | Array of ReferenceDescription results for the browsed node. |
Implements NodeManager.
Reimplemented in NodeManagerRoot.
UaStatusCode NodeManagerUaNode::clearAllNodes | ( | ) | [protected] |
Clear all nodes in the node manager and all references to other node managers.
UaStatus NodeManagerUaNode::connectStartingNode | ( | const UaNodeId & | startingNode, |
NodeManager * | pNodeManager, | ||
OpcUa_Boolean | forwardReferences, | ||
OpcUa_Boolean | inverseReferences | ||
) | [virtual] |
Connect a starting node to the passed NodeManager This method is used to tell the NodeManager A (implements this method) that another NodeManager B has a Nodes with references to a Node in A but is not able to specify the list. All View services called with the specified Node in A must be called also on NodeManager B to allow B to return affected Nodes.
startingNode | NodeId of the node that needs to be connected to the other NodeManager. |
pNodeManager | Pointer to NodeManager that manages references from the starting node to nodes in the that NodeManager. |
forwardReferences | Flag that indicates that there are forward references. |
inverseReferences | Flag that indicates that there are inverse references. |
Implements NodeManagerCrossReferences.
UaStatus NodeManagerUaNode::deleteUaNode | ( | UaNode * | pNode, |
OpcUa_Boolean | deleteTargetReferences, | ||
OpcUa_Boolean | deleteSourceReferences = OpcUa_False , |
||
OpcUa_Boolean | deleteAllChildren = OpcUa_False |
||
) | [virtual] |
Remove a UaNode from the node management.
Removes the passed node from the internal node management of the NodeManager.
[in] | pNode | Pointer to UaNode interface of the node to remove. |
[in] | deleteTargetReferences | Flag indicating if the inverse references in the target nodes must be deleted |
[in] | deleteSourceReferences | Flag indicating if the inverse references in the target nodes must be deleted |
[in] | deleteAllChildren | Indicates if all child nodes of the node to delete and all references of the nodes must be deleted. In this case the fuction follows all forward references that are a subtype of HasChildren like HasComponent or HasProperty and deletes the target nodes and all of their references. If this flag is set and one of the child nodes to delete is shared, the shared node and its children is not deleted. |
Implements NodeManagerConfig.
UaStatus NodeManagerUaNode::deleteUaReference | ( | const UaNodeId & | sourceId, |
const UaNodeId & | targetId, | ||
const UaNodeId & | referenceTypeId | ||
) | [virtual] |
Delete the reference from source node to target node
This functions is provided for convenience and behaves like the functions above. This function finds the node objects for the specified source and target nodeIds and creates a deletes the reference if the nodes exist.
[in] | sourceId | NodeId of the source node. |
[in] | targetId | NodeId of the target node. |
[in] | referenceTypeId | Type of the reference to delete from the source node to the target node. |
Implements NodeManagerConfig.
UaStatus NodeManagerUaNode::deleteUaReference | ( | UaReferenceLists * | pSourceNode, |
UaReferenceLists * | pTargetNode, | ||
const UaNodeId & | referenceTypeId | ||
) | [virtual] |
Delete the reference from source node to target node
Deletes the reference of the passed type from the passed source node to the passed target node.
[in] | pSourceNode | Pointer to UaReferenceLists interface of the source node. |
[in] | pTargetNode | Pointer to UaReferenceLists interface of the target node. |
[in] | referenceTypeId | Type of the reference to delete from the source node to the target node. |
Implements NodeManagerConfig.
UaStatus NodeManagerUaNode::disconnectStartingNode | ( | const UaNodeId & | startingNode, |
NodeManager * | pNodeManager | ||
) | [virtual] |
Disconnect a starting node from the passed NodeManager
startingNode | NodeId of the node that needs to be disconnected from the other NodeManager. |
pNodeManager | Pointer of the NodeManager to disconnect. |
Implements NodeManagerCrossReferences.
UaNode * NodeManagerUaNode::findNode | ( | const OpcUa_NodeId * | pId ) | const [protected] |
virtual IOManager* NodeManagerUaNode::getIOManager | ( | UaNode * | pUaNode, |
OpcUa_Int32 | attributeId | ||
) | const [pure virtual] |
Get the responsible IOManager for the node and attribute combination.
pUaNode | the actual Node where to get all information from. |
attributeId | AttributeId of the requested node |
Implemented in NodeManagerBase, NodeManagerRoot, OpcUaDi::NodeManagerDevices, and OpcUaPlc::NodeManagerPLCopen.
MethodHandle * NodeManagerUaNode::getMethodHandle | ( | Session * | pSession, |
OpcUa_NodeId * | pObjectNodeId, | ||
OpcUa_NodeId * | pMethodNodeId, | ||
UaStatus & | result | ||
) | const [virtual] |
Get the method handle for the passed node Id. This method is used to get the MethodHandle for a Object node / Method combination used to access the related MethodManager in the service Call.
pSession | Interface to the Session context for the method call |
pObjectNodeId | the NodeId of the actual Object. |
pMethodNodeId | the NodeId of the actual Method. |
result | the result of the current Operation. |
Reimplemented from NodeManager.
Reimplemented in NodeManagerRoot.
OpcUa_UInt16 NodeManagerUaNode::getNameSpaceIndex | ( | ) | const [inline, virtual] |
Get the namespace index of the node manager.
Implements NodeManagerConfig.
UaString NodeManagerUaNode::getNameSpaceUri | ( | ) | [inline, protected] |
Get the name space URI of this node manager.
Get a UaNode pointer for a requested nodeId. If a UaNode object is found for the nodeId the reference count of the node gets incremented and a pointer to the node ist returned. The caller must release the reference when the node is not longer needed.
nodeId | NodeId of the node to return. |
Reimplemented in NodeManagerRoot.
NodeManagerConfig * NodeManagerUaNode::getNodeManagerConfig | ( | ) | [virtual] |
Get the interface NodeManagerConfig if available.
Reimplemented from NodeManager.
Reimplemented in NodeManagerRoot.
NodeManagerCrossReferences * NodeManagerUaNode::getNodeManagerCrossReferences | ( | ) | [virtual] |
Get the interface NodeManagerCrossReferences if available.
Reimplemented from NodeManager.
Reimplemented in NodeManagerRoot.
NodeManagerUaNode * NodeManagerUaNode::getNodeManagerUaNode | ( | ) | [virtual] |
Get the interface NodeManagerUaNode if available.
Reimplemented from NodeManager.
VariableHandle * NodeManagerUaNode::getVariableHandle | ( | Session * | pSession, |
VariableHandle::ServiceType | serviceType, | ||
OpcUa_NodeId * | pNodeId, | ||
OpcUa_Int32 | AttributeId | ||
) | const [virtual] |
Get the variable handle for the passed node Id. This method is used to get the VariableHandle for a node used to access the related IOManager in the services Read, Write and CreateMonitoredItems. The provided VariableHandle is reference counted. The reference count is 1 after initial creation of the object. The SDK will release its reference after the transaction is finished. If the VariableHandle is stored in an application specific object, the reference counter must be incremented to keep the one reference. If this stored pointer is used to return the VariableHandle in following getVariableHandle calls, the reference counter must be incrementd before returning the pointer.
pSession | Interface to the Session context for the method call |
serviceType | Service type enumerator with the following possible settings READ - Read service WRITE - Write service MONITORING - CreateMonitoredItems service |
pNodeId | NodeId of the requested node |
AttributeId | AttributeId of the requested node |
Implements NodeManager.
Reimplemented in NodeManagerRoot.
OpcUa_Boolean NodeManagerUaNode::isStarted | ( | ) | [inline, protected] |
Check if the NodeManager is started or not.
void NodeManagerUaNode::registerBrowseUaNodeCallback | ( | BrowseUaNodeCallback * | pBrowseUaNodeCallback ) |
Registeres a callback interface used to influence browse results.
UaStatus NodeManagerUaNode::shutDown | ( | ) | [virtual] |
Shut down NodeManager. Method is called during shut down of OPC Server and can be used to clean up the configuration of the NodeManager.
Implements NodeManager.
UaStatus NodeManagerUaNode::startUp | ( | ServerManager * | pServerManager ) | [virtual] |
Start up NodeManager.
pServerManager | Interface to the central ServerManager object. This interface pointer should be stored in the NodeManager instance to have access to core module objects like the root NodeManager or the ServerConfig |
Implements NodeManager.
Reimplemented in NodeManagerBase, NodeManagerNS1, and NodeManagerRoot.
UaStatus NodeManagerUaNode::translateBrowsePathToNodeId | ( | const ServiceContext & | serviceContext, |
const UaNodeId & | startingNode, | ||
UaRelativePath & | relativePath, | ||
UaBrowsePathTargets & | browsePathTargets | ||
) | [virtual] |
Translates a relative browse path to a node id. This method is used to request the Server to translate a browse paths to a NodeId for the target node. There could be a list of target nodes but the normal case is a single result for a starting node and a path. The browse path is constructed of a starting Node and a RelativePath. The specified starting Node identifies the Node from which the RelativePath is based. The RelativePath contains a sequence of BrowseNames. The relative path parameter contains a list of relative path elements and the current position of the translate process since the translate can affect more than one node manager and the implementation of this method is only responsible for processing relative path elements and starting nodes managed by the current node manager instance.
serviceContext | General context for the service calls containing information like the session object, return diagnostic mask and timeout hint. |
startingNode | Starting node from where the relative path is defined. |
relativePath | Relative path from the starting node to the searched node including the current position of the translate process. |
browsePathTargets | All result target nodes for the Browsepath. |
Implements NodeManager.
Reimplemented in NodeManagerRoot.