view m-toolbox/classes/+utils/@helper/ltpda_userclasses.m @ 24:056f8e1e995e database-connection-manager

Properly record history in fromRepository constructors
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% LTPDA_USERCLASSES lists all the LTPDA user object types.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: LTPDA_USERCLASSES lists all the LTPDA user object types.
%
% CALL:        classes = ltpda_userclasses()
%
% INPUTS:
%
% OUTPUTS:     classes - a cell array with a list of recognised LTPDA user object types
%
% Returns a list of all ltpda classes which are derived from the ltpda_uo
% class.
%
% VERSION:     $Id: ltpda_userclasses.m,v 1.6 2010/08/16 14:06:15 hewitson Exp $
%
% HISTORY: 14-02-08 M Hueller
%             Creation
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function classes = ltpda_userclasses(varargin)

%   prefs = getappdata(0, 'LTPDApreferences');
%   vl = double(prefs.getDisplayPrefs.getDisplayVerboseLevel);
%   LTPDAprefs('display', 'verboseLevel', -1);
  classes = utils.helper.ltpda_classes;

  for ii = 1:numel(classes)
    try
      if ~isa(eval(classes{ii}), 'ltpda_uo')
        classes{ii} = {};
      end
    catch
      classes{ii} = {};
    end
  end

  classes = classes(~cellfun('isempty', classes));
  classes = sort(classes);

end

function result = isabstract(cl)

  mi = eval(['?' cl]);

  hasAbstractMethod = false;
  for kk=1:numel(mi.Methods)
    if mi.Methods{kk}.Abstract
      hasAbstractMethod = true;
      break;
    end
  end

  hasAbstractProperty = false;
  if ~hasAbstractMethod
    for kk=1:numel(mi.Properties)
      if mi.Properties{kk}.Abstract
        hasAbstractProperty = true;
        break;
      end
    end
  end

  if hasAbstractProperty || hasAbstractMethod
    result = true;
  else
    result = false;
  end

end