
%

%   Copyright 2010-2011 The MathWorks, Inc.

classdef DataMerger < handle
    %DATAMERGER Merges test case data    
    
    properties (Access = private)          
        % Data - Array of data that will be merged
        Data = struct('TestCases',[],'InterfaceInfo',[]);
        
        % DataMerged - Merged test case data
        DataMerged = [];
        
        % UtilityName - Name of the utility
        UtilityName = '';  
        
        % MsgIdPref - Id for generating errors and warnings
        MsgIdPref = 'Slvnv:DATAMERGE:';
    end
    
    methods
        function obj = DataMerger(utilityName)
            obj.UtilityName = utilityName;
        end
        
        dataMerged = mergeData(obj, varargin)
        %mergeData Merges data
    end
    
    methods (Access = private)
        % The following function may be called in two ways:
        %    	handleMsg(obj, msgOpt, msgObject)
        %          - 3 arguments
        %          - msgObject: message object
        %  OR
        %       handleMsg(obj, msgOpt, msgId, msgStr, optional-arguments)
        %          - 4+ arguments
        %          - msgId: message ID
        %          - msgStr: message string
        %          - optional-arguments: optional parameters to be used with msgStr
        function handleMsg(obj, msgOpt, varargin)
            if nargin == 3
                switch msgOpt
                    case 'warning'
                        sldvshareprivate('util_gen_warning_notrace', varargin{1}.Identifier, getString(varargin{1}));
                    case 'error'
                        error(varargin{1});
                    otherwise
                        assert(false, getString(message('Sldv:shared:DataMerger:UnexpectedMsgValue')));
                end
            else
                switch msgOpt
                    case 'warning'
                        sldvshareprivate('util_gen_warning_notrace', varargin{1}, varargin{2}, varargin{3:end});
                    case 'error'                    
                        error(varargin{1}, varargin{2}, varargin{3:end});
                    otherwise
                        assert(false, getString(message('Sldv:shared:DataMerger:UnexpectedMsgValue')));
                end
            end
        end
        
        identifyTestData(obj, varargin)        
        %identifyTestData Identifies the test case data to be merged
        
        checkInterfaceInfo(obj)
        %checkInterfaceInfo Checks the interface info 
        
        combineData(obj)
        %combineData Combines test case data
    end
end

