LTPDA_ISOBJECT checks that the input objects are one of the LTPDA object types. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: LTPDA_ISOBJECT checks that the input objects are one of the LTPDA object types. CALL: result = ltpda_isobject(a1) classes = ltpda_isobject() 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_isobject.m,v 1.3 2008/02/14 16:04:30 mauro Exp $ HISTORY: 09-05-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = ltpda_isobject(varargin) 0002 0003 % LTPDA_ISOBJECT checks that the input objects are one of the LTPDA object 0004 % types. 0005 % 0006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0007 % 0008 % DESCRIPTION: LTPDA_ISOBJECT checks that the input objects are one of the LTPDA object 0009 % types. 0010 % 0011 % CALL: result = ltpda_isobject(a1) 0012 % classes = ltpda_isobject() 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_isobject.m,v 1.3 2008/02/14 16:04:30 mauro Exp $ 0021 % 0022 % HISTORY: 09-05-07 M Hewitson 0023 % Creation 0024 % 0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0026 0027 classes = ltpda_classes(); 0028 0029 if nargin == 0 0030 varargout{1} = classes; 0031 return 0032 else 0033 if length(varargin{1}) > 0 0034 for j=1:nargin 0035 % check this object 0036 obj = varargin{1}; 0037 if iscell(obj) 0038 for k=1:length(obj) 0039 % check each one 0040 if ~isltpdaobj(obj{k}, classes) 0041 varargout{1} = 0; 0042 return; 0043 end 0044 end 0045 else 0046 for k=1:length(obj) 0047 % check each one 0048 0049 % Stupid hack required because database objects can't cope with 0050 % begin indexed like conn(1) - all other objects work for this 0051 % call. 0052 if k==1 0053 if ~isltpdaobj(obj, classes) 0054 varargout{1} = 0; 0055 return 0056 end 0057 else 0058 if ~isltpdaobj(obj(k), classes) 0059 varargout{1} = 0; 0060 return; 0061 end 0062 end 0063 end 0064 end 0065 end 0066 else 0067 varargout{1} = 0; 0068 return; 0069 end 0070 end 0071 0072 varargout{1} = 1; 0073 0074 %-------------------------------------------------------------------------- 0075 % Test a single object 0076 % 0077 function varargout = isltpdaobj(obj, classes) 0078 0079 found = 0; 0080 for k=1:length(classes) 0081 type = classes{k}; 0082 if isa(obj, type) 0083 found = 1; 0084 end 0085 end 0086 if ~found 0087 varargout{1} = 0; 0088 return 0089 else 0090 varargout{1} = 1; 0091 end 0092