Home > m > helper > ltpda_isuserobject.m

ltpda_isuserobject

PURPOSE ^

LTPDA_ISUSEROBJECT checks that the input objects are one of the LTPDA user object

SYNOPSIS ^

function varargout = ltpda_isuserobject(varargin)

DESCRIPTION ^

 LTPDA_ISUSEROBJECT checks that the input objects are one of the LTPDA user object
 types.
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: LTPDA_ISUSEROBJECT checks that the input objects are one of the 
              LTPDA user object types.
 
 CALL:        result  = ltpda_isuserobject(a1)
              classes = ltpda_isuserobject()
 
 INPUTS:      objects
 
 OUTPUTS:     result == 1 if all input objects are LTPDA objects
              result == 0 otherwise
              classes - a list of recognised LTPDA object types

 VERSION:     $Id: ltpda_isuserobject.m,v 1.1 2007/11/19 09:49:47 hewitson Exp $

 HISTORY: 09-05-07 M Hewitson
             Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = ltpda_isuserobject(varargin)
0002 
0003 % LTPDA_ISUSEROBJECT checks that the input objects are one of the LTPDA user object
0004 % types.
0005 %
0006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0007 %
0008 % DESCRIPTION: LTPDA_ISUSEROBJECT checks that the input objects are one of the
0009 %              LTPDA user object types.
0010 %
0011 % CALL:        result  = ltpda_isuserobject(a1)
0012 %              classes = ltpda_isuserobject()
0013 %
0014 % INPUTS:      objects
0015 %
0016 % OUTPUTS:     result == 1 if all input objects are LTPDA objects
0017 %              result == 0 otherwise
0018 %              classes - a list of recognised LTPDA object types
0019 %
0020 % VERSION:     $Id: ltpda_isuserobject.m,v 1.1 2007/11/19 09:49:47 hewitson Exp $
0021 %
0022 % HISTORY: 09-05-07 M Hewitson
0023 %             Creation
0024 %
0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0026 
0027 
0028 if nargin == 0
0029   varargout{1} = classes;
0030 else
0031   
0032   for j=1:nargin
0033     % check this object
0034     obj = varargin{1};
0035     if iscell(obj)
0036       for k=1:length(obj)
0037         % check each one
0038         if ~isltpdaobj(obj{k})
0039           varargout{1} = 0;
0040           return;
0041         end
0042       end
0043     else
0044       for k=1:length(obj)
0045         % check each one
0046         
0047         % Stupid hack required because database objects can't cope with
0048         % begin indexed like conn(1) - all other objects work for this
0049         % call.
0050         if k==1
0051           if ~isltpdaobj(obj)
0052             varargout{1} = 0;
0053             return
0054           end
0055         else
0056           if ~isltpdaobj(obj(k))
0057             varargout{1} = 0;
0058             return;
0059           end
0060         end
0061       end
0062     end
0063   end
0064 end
0065 
0066 varargout{1} = 1;
0067 
0068 %--------------------------------------------------------------------------
0069 % Test a single object
0070 %
0071 function varargout = isltpdaobj(obj)
0072 
0073 classes = {'ao',...
0074            'plist',...
0075            'specwin',...
0076            'mfir',...
0077            'miir',...
0078            'pzmodel',...
0079            'time',...
0080            'timespan'};
0081 
0082          found = 0;
0083          for k=1:length(classes)
0084            type = classes{k};
0085            if isa(obj, type)
0086              found = 1;
0087            end
0088          end
0089          if ~found
0090            varargout{1} = 0;
0091            return
0092          else
0093            varargout{1} = 1;
0094          end
0095

Generated on Tue 22-Jan-2008 10:39:13 by m2html © 2003