﻿' COMPILER GENERATED CODE
' THIS WILL BE OVERWRITTEN AT EACH GENERATION
' EDIT AT YOUR OWN RISK

Imports System.IO
Imports System.Runtime.CompilerServices
Imports ECAClientFramework
Imports ECAClientUtilities
Imports ECACommonUtilities
Imports ECACommonUtilities.Model
Imports GSF.TimeSeries

Namespace Model

    <CompilerGenerated>
    Public Class Mapper ' For {ProjectName}
        Inherits MapperBase

        #Region " Members "

        ' Fields
        Private ReadOnly m_unmapper As Unmapper

        #End Region
    
        #Region " Constructors "

        Public Sub New(framework As Framework)
        
            MyBase.New(framework, SystemSettings.InputMapping)
            m_unmapper = New Unmapper(framework, MappingCompiler)
            Unmapper = m_unmapper

        End Sub

        #End Region

        #Region " Methods "

        Public Overrides Sub Map(measurements As IDictionary(Of MeasurementKey, IMeasurement))

            SignalLookup.UpdateMeasurementLookup(measurements)
            Dim mapping As TypeMapping = MappingCompiler.GetTypeMapping(InputMapping)
            
            Reset()
            Dim inputData As {InputDataTypeName} = Create{InputCategoryIdentifier}{InputDataTypeIdentifier}(mapping)
            Reset()
            Dim inputMeta As {InputMetaTypeName} = Create{InputCategoryIdentifier}{InputMetaTypeIdentifier}(mapping)
            
            Dim output As Algorithm.Output = Algorithm.Execute(inputData, inputMeta)
            Subscriber.SendMeasurements(m_unmapper.Unmap(output.OutputData, output.OutputMeta))

        End Sub

        {MappingFunctions}

        #End Region

    End Class

End Namespace