public uint GetLocalIntegerIdMapping(string mappingType, NodeId remoteId)
{
lock (m_lock)
{
// check if no mappings defined.
if (m_mappingSets == null)
{
return 0;
}
if (mappingType == null)
{
mappingType = String.Empty;
}
// check for an existing mapping.
NodeIdMappingSet mappingSet = null;
if (!m_mappingSets.TryGetValue(mappingType, out mappingSet))
{
return 0;
}
// search for a existing integer id.
NodeId localId = GetLocalNodeId(remoteId);
if (mappingSet.Mappings != null)
{
for (int ii = 0; ii < mappingSet.Mappings.Count; ii++)
{
NodeIdMapping mapping = mappingSet.Mappings[ii];
if (localId == mapping.NodeId)
{
return mapping.IntegerId;
}
}
}
// not found.
return 0;
}
}