- IED server/model: Added additional functions for ModelNode access

pull/331/head
Michael Zillgith 5 years ago
parent 9e27ed5a77
commit cc905b5013

@ -31,6 +31,7 @@ extern "C" {
#include "libiec61850_common_api.h" #include "libiec61850_common_api.h"
#include "logging_api.h" #include "logging_api.h"
#include "linked_list.h"
/** /**
* @defgroup iec61850_common_api_group IEC 61850 API common parts * @defgroup iec61850_common_api_group IEC 61850 API common parts

@ -420,6 +420,36 @@ ModelNode_getObjectReferenceEx(ModelNode* node, char* objectReference, bool with
LIB61850_API ModelNodeType LIB61850_API ModelNodeType
ModelNode_getType(ModelNode* self); ModelNode_getType(ModelNode* self);
/**
* \brief Get the name of the ModelNode
*
* \param self the ModelNode instance
*
* \return the name of the ModelNode
*/
LIB61850_API const char*
ModelNode_getName(ModelNode* self);
/**
* \brief Get the parent ModelNode of this ModelNode instance
*
* \param self the ModelNode instance
*
* \return the parent instance, or NULL when the ModelNode has no parent
*/
LIB61850_API ModelNode*
ModelNode_getParent(ModelNode* self);
/**
* \brief Get the list of direct child nodes
*
* \param self the ModelNode instance
*
* \return the list of private child nodes, or NULL when the node has no children
*/
LIB61850_API LinkedList
ModelNode_getChildren(ModelNode* self);
/** /**
* \brief Set the name of the IED * \brief Set the name of the IED
* *

@ -706,6 +706,37 @@ ModelNode_getType(ModelNode* self)
return self->modelType; return self->modelType;
} }
const char*
ModelNode_getName(ModelNode* self)
{
return self->name;
}
ModelNode*
ModelNode_getParent(ModelNode* self)
{
return self->parent;
}
LinkedList
ModelNode_getChildren(ModelNode* self)
{
LinkedList childNodes = NULL;
if (self->firstChild)
childNodes = LinkedList_create();
ModelNode* childNode = self->firstChild;
while (childNode) {
LinkedList_add(childNodes, childNode);
childNode = childNode->sibling;
}
return childNodes;
}
LogicalNode* LogicalNode*
LogicalDevice_getLogicalNode(LogicalDevice* self, const char* nodeName) LogicalDevice_getLogicalNode(LogicalDevice* self, const char* nodeName)
{ {

Loading…
Cancel
Save