using System.Collections.Generic;
namespace Hylasoft.Opc.Common
{
///
/// Base class representing a node on the OPC server
///
public abstract class Node
{
///
/// Gets the displayed name of the node
///
public string Name { get; protected set; }
///
/// Gets the dot-separated fully qualified tag of the node
///
public string Tag { get; protected set; }
///
/// Gets the parent node. If the node is root, returns null
///
public Node Parent { get; private set; }
///
/// Creates a new node
///
/// the name of the node
/// The parent node
protected Node(string name, Node parent = null)
{
Name = name;
Parent = parent;
if (parent != null && !string.IsNullOrEmpty(parent.Tag))
Tag = parent.Tag + '.' + name;
else
Tag = name;
}
///
/// Overrides ToString()
///
public override string ToString()
{
return Tag;
}
}
}