Home > m > helper > generic_class_fcn > generic_get.m

generic_get

PURPOSE ^

GET get a property of a general object.

SYNOPSIS ^

function val = generic_get(obj, prop_name, DEFAULT_PLIST, VERSION, CATEGORY)

DESCRIPTION ^

 GET get a property of a general object.

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

 DESCRIPTION: GET get a property of a general object.

 CALL:        val = get(obj, 'prop_name');

 VERSION:     $Id: generic_get.m,v 1.4 2008/02/25 18:09:08 ingo Exp $

 HISTORY:     11-02-2008 Diepholz
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % GET get a property of a general object.
0002 %
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 % DESCRIPTION: GET get a property of a general object.
0006 %
0007 % CALL:        val = get(obj, 'prop_name');
0008 %
0009 % VERSION:     $Id: generic_get.m,v 1.4 2008/02/25 18:09:08 ingo Exp $
0010 %
0011 % HISTORY:     11-02-2008 Diepholz
0012 %                 Creation
0013 %
0014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0015 function val = generic_get(obj, prop_name, DEFAULT_PLIST, VERSION, CATEGORY)
0016 
0017 %%% Check if this is a special call: default parameter list, cvs-version, category
0018 if ischar(prop_name)
0019   in = prop_name;
0020   if strcmp(in, 'Params')
0021     val = DEFAULT_PLIST;
0022     return
0023   elseif strcmp(in, 'Version')
0024     val = VERSION;
0025     return
0026   elseif strcmp(in, 'Category')
0027     val = CATEGORY;
0028     return
0029   end
0030 end
0031 
0032 %%% If prop_name is a plist then extrat the poperty name from the plist.
0033 if isa(prop_name, 'plist')
0034   prop_name = find(prop_name, 'property');
0035   if isempty(prop_name)
0036     error ('### The plist does not contain the ''key'' = ''property''');
0037   end
0038 end
0039 
0040 fields = fieldnames(obj);
0041 
0042 %%% Return the property of the analysis object
0043 try
0044   val = obj.(prop_name);
0045 catch
0046   error('### ''%s'' is not a valid %s-object property.', prop_name, class(obj));
0047 end

Generated on Mon 31-Mar-2008 13:54:54 by m2html © 2003