function hLib = Ifx_IpoCur_CRLEntry(hLib)
% Key: interp1D
% y1: Result
% u1: dpResult->Index
% u2: dpResult->Ratio
% u3: Val_array 
% u4: N    

%% Code Replacement Library Entries  
% Code replacement library entries when index and fraction are on separate
% input lines:
inputIsBus = false;
inputs = {'u1', 'u2', 'u3', 'u4'};
hLib = Ifx_addEntries_IpoCur(hLib, inputIsBus, inputs);
% Code replacement library entries when index and fraction are on the same
% output line via a bus:
inputIsBus = true;
inputs = {'u1','dummy','u2','u3'};
hLib = Ifx_addEntries_IpoCur(hLib, inputIsBus, inputs);
end

function hLib = Ifx_addEntries_IpoCur(hLib, inputIsBus, inputs)
%% DataTypes
               % Conceptual datatype                           Implementation datatype 
int8datatype =   {'fixdt(1,8,0)',                              'int8'};
int16datatype =  {'fixdt(1,16,0)',                             'int16'};
uint8datatype =  {'fixdt(0,8,0)',                              'uint8'};
uint16datatype = {'fixdt(0,16,0)',                             'uint16'};
fuint16datatype = {'fixdt(0,16,16)',                           'uint16'};

%% Code Replacement Library Entries
%% Column-major routines (COLUMN_DIR)
%0x005
hLib.addEntry( Ifx_addEntry_IpoCur('Ifx_IpoCur_s8', int8datatype, uint16datatype, fuint16datatype, int8datatype, inputIsBus, inputs, false) );
%0x006
hLib.addEntry( Ifx_addEntry_IpoCur('Ifx_IpoCur_s16', int16datatype, uint16datatype, fuint16datatype, int16datatype, inputIsBus, inputs, false) );
%0x007
hLib.addEntry( Ifx_addEntry_IpoCur('Ifx_IpoCur_u16', uint16datatype, uint16datatype, fuint16datatype, uint16datatype, inputIsBus, inputs, false) );
%0x008
hLib.addEntry( Ifx_addEntry_IpoCur('Ifx_IpoCur_u8', uint8datatype, uint16datatype, fuint16datatype, uint8datatype, inputIsBus, inputs, false) );

%% Row-major routines (ROW_DIR)
%0x005
hLib.addEntry( Ifx_addEntry_IpoCur('Ifx_IpoCur_s8', int8datatype, uint16datatype, fuint16datatype, int8datatype, inputIsBus, inputs, true) );
%0x006
hLib.addEntry( Ifx_addEntry_IpoCur('Ifx_IpoCur_s16', int16datatype, uint16datatype, fuint16datatype, int16datatype, inputIsBus, inputs, true) );
%0x007
hLib.addEntry( Ifx_addEntry_IpoCur('Ifx_IpoCur_u16', uint16datatype, uint16datatype, fuint16datatype, uint16datatype, inputIsBus, inputs, true) );
%0x008
hLib.addEntry( Ifx_addEntry_IpoCur('Ifx_IpoCur_u8', uint8datatype, uint16datatype, fuint16datatype, uint8datatype, inputIsBus, inputs, true) );
end

function hEnt = Ifx_addEntry_IpoCur(signature, datatype_y1, datatype_u1, datatype_u2, datatype_u3, inputIsBus, inputs, createRowMajorRoutine)

if ~inputIsBus
    hEnt = coder.Ifx_CurCustomEntry;
else
    hEnt = coder.Ifx_CurBusCustomEntry;
end

%% Set Function Entry Parameters
hEnt.setTflCFunctionEntryParameters( ...
          'Key', 'interp1D', ...
          'Priority', 100, ...
          'SupportSymbolicDimensions', true, ...
          'ImplementationName', signature, ...
          'ImplementationHeaderFile', 'Ifx.h');

%% Add Algorithm Properties
                   % Parameter                                  Value
algPropertyList = {{'InterpMethod',                              'Linear'},...
                   {'ExtrapMethod',                              'Clip'},...
                   {'ValidIndexMayReachLast'                     'on'},...
                   {'RemoveProtectionIndex'                      'off'},...
                   {'RndMeth',                                   {'Round', 'Zero'}}};   

%% Set ArrayLayout and UseRowMajorAlgorithm
[hEnt, algPropertyList] = Ifx_setMapRowMajorAttributes(hEnt, algPropertyList, createRowMajorRoutine);            
               
hEnt = addAlgorithmParameters(hEnt, algPropertyList);
      
%% Add Conceptual and implementation Arguments
% Conceptual Arguments
hEnt = Ifx_addCurConceptualArguments(hEnt, datatype_y1, datatype_u1, datatype_u2, datatype_u3, inputIsBus, inputs);

% Implementation Arguments
hEnt = Ifx_addCurImplementationArguments(hEnt, datatype_y1, datatype_u3, inputIsBus, inputs);

%% Map and cache argument locations for use in do_match tasks
hEnt.mapAndCacheLabeledArgLocations();

end

