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

classdef Mapper < handle % For {ProjectName}
    properties (Access = private)
        m_helper = [];
    end
    properties (Access = public)
        Unmapper = [];
    end
    methods
        function this = Mapper(helper)
            this.m_helper = helper;
            this.Unmapper = Unmapper(helper);
        end
        function Map(this, measurements)
            this.m_helper.SignalLookup.UpdateMeasurementLookup(measurements);
            inputMapping = this.m_helper.MappingCompiler.GetTypeMapping(this.m_helper.InputMapping);

            this.m_helper.Reset();
            inputData = this.Create{InputCategoryIdentifier}{InputDataTypeIdentifier}(inputMapping);
            this.m_helper.Reset();
            inputMeta = this.Create{InputCategoryIdentifier}{InputMetaTypeIdentifier}(inputMapping);

            [outputData, outputMeta] = Algorithm.Execute(inputData, inputMeta);
            this.m_helper.Subscriber.SendMeasurements(this.Unmapper.Unmap(outputData, outputMeta));
        end
    end
    methods (Access = private)
         {MappingFunctions}
    end
end