%% input_data_type
%   this function will determine what the desired output type of
%   the function is, based on what the user has selected using the
%   ports and datamanagement window. if the user has selected an
%   unconvertable type, (inheret, fixed pt. etc.) it will return
%   the empty string
% inputs:
%   object:GUI - GUI objecto
% outputs:
%   type:string - string representation of the output type.
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function types = input_data_type(object)
types = [];
if (object.mode == 1)
    
    S = sfroot;
    code_block = sprintf('%s/code',getfullname(object.block_handle));
    code_blocks = find_system(getfullname(object.block_handle),'LookUnderMasks','all','BlockType','SubSystem','Name','code');
    if ~isempty(code_blocks)
        myState = S.find('-isa','Stateflow.EMChart', '-and', 'Path', code_block); % find which one we want to edit
        for (i=1:size(myState.Inputs,1))
            if strncmp(myState.Inputs(i).DataType,'Inherit',7);
                typename = 'Inherit';
            elseif strncmp(myState.Inputs(i).DataType,'boolean',7);
                typename = 'logical';
            else
                typename = myState.Inputs(i).DataType;
            end
            types = [types;{myState.Inputs(i).Name, typename}];
        end
    else
        types = [];
    end
else
    types = [];
end
end
