Home > phiwave > @phido > phido.m

phido

PURPOSE ^

class constructor for phiwave design object

SYNOPSIS ^

function [o, others] = phido(params, others, passf)

DESCRIPTION ^

 class constructor for phiwave design object
 FORMAT [o, others] = phido(params, others, passf)
 inputs [defaults]
 params  -  one of:            
            - string, specifying SPM design file, OR
            - mardo object OR
            - structure, which can:
               contain SPM/MarsBaR design OR
               contain fields for mardo object or phido object.
               Fields should include 'des_struct', containing design
               structure
 others  - any other fields for mardo object or phido object or children
           Fields for phido object are:
           [none, so far]
 passf   - if 1, or not passed, will try children objects to see if
           they would like to own this design

 outputs
 o       - phido object
 others  - any unrecognized fields from params, others

 phido is pronounced like Fido, the dog's name.
 
 phido is the parent for containers of mardo designs - see the mardo
 constructor functions for details. The phido object itself is only a
 placeholder for various settings - contained in the object fields.  The
 SPM / MarsBaR design is passed to the children of this class, either
 phido_99 or phido_2.  If the design is not suitable for either, the phido
 object has no use for it, and throws it away. If the (99 or 2) classes
 claim the object, they return an object of class (99 or 2), which inherits
 the phido class just created in this call to the object.
 
 Note the "passf" input flag; this is a trick to allow the other phido
 classes (99 and 2) to create a phido object for them to inherit,
 without this constructor passing the phido object back to the other
 classes, creating an infinite loop.  So, it is by default set to 1, and
 the newly created phido object is passed to the other phido classes for
 them to claim ownership.  The other phido classes can call this
 constructor with passf set to 0 in order for the constructor merely to
 make a phido object, without passing back to the other classes. 
 
 $Id: phido.m,v 1.10 2005/06/05 04:42:22 matthewbrett Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [o, others] = phido(params, others, passf)
0002 % class constructor for phiwave design object
0003 % FORMAT [o, others] = phido(params, others, passf)
0004 % inputs [defaults]
0005 % params  -  one of:
0006 %            - string, specifying SPM design file, OR
0007 %            - mardo object OR
0008 %            - structure, which can:
0009 %               contain SPM/MarsBaR design OR
0010 %               contain fields for mardo object or phido object.
0011 %               Fields should include 'des_struct', containing design
0012 %               structure
0013 % others  - any other fields for mardo object or phido object or children
0014 %           Fields for phido object are:
0015 %           [none, so far]
0016 % passf   - if 1, or not passed, will try children objects to see if
0017 %           they would like to own this design
0018 %
0019 % outputs
0020 % o       - phido object
0021 % others  - any unrecognized fields from params, others
0022 %
0023 % phido is pronounced like Fido, the dog's name.
0024 %
0025 % phido is the parent for containers of mardo designs - see the mardo
0026 % constructor functions for details. The phido object itself is only a
0027 % placeholder for various settings - contained in the object fields.  The
0028 % SPM / MarsBaR design is passed to the children of this class, either
0029 % phido_99 or phido_2.  If the design is not suitable for either, the phido
0030 % object has no use for it, and throws it away. If the (99 or 2) classes
0031 % claim the object, they return an object of class (99 or 2), which inherits
0032 % the phido class just created in this call to the object.
0033 %
0034 % Note the "passf" input flag; this is a trick to allow the other phido
0035 % classes (99 and 2) to create a phido object for them to inherit,
0036 % without this constructor passing the phido object back to the other
0037 % classes, creating an infinite loop.  So, it is by default set to 1, and
0038 % the newly created phido object is passed to the other phido classes for
0039 % them to claim ownership.  The other phido classes can call this
0040 % constructor with passf set to 0 in order for the constructor merely to
0041 % make a phido object, without passing back to the other classes.
0042 %
0043 % $Id: phido.m,v 1.10 2005/06/05 04:42:22 matthewbrett Exp $
0044 
0045 myclass = 'phido';
0046 cvs_v   = mars_cvs_version(myclass);
0047 
0048 % Default object structure
0049 defstruct = [];
0050 
0051 if nargin < 1
0052   defstruct.cvs_version = cvs_v;
0053   o = class(defstruct, myclass);
0054   others = [];
0055   return
0056 end
0057 if nargin < 2
0058   others = [];
0059 end
0060 if nargin < 3
0061   passf = 1;
0062 end
0063 
0064 % Deal with passed objects of this (or child) class
0065 if isa(params, myclass)
0066   o = params;
0067   % Check for simple form of call
0068   if isempty(others), return, end
0069 
0070   % Otherwise, we are being asked to set fields of object
0071   % (but there are none for now, so just split)
0072   [p others] = mars_struct('split', others, defstruct);
0073   return
0074 end
0075 
0076 % send design to mardo
0077 [mardo_o others] = mardo(params, others);
0078 
0079 % fill params with defaults, parse into fields for this object, children
0080 [params, others] = mars_struct('ffillsplit', defstruct, others);
0081 
0082 % add cvs tag
0083 params.cvs_version = cvs_v;
0084 
0085 % set the phido object
0086 o  = class(params, myclass);
0087 
0088 % If requested (passf) pass it to candidate children
0089 if passf
0090   switch lower(type(mardo_o))
0091    case 'spm99'
0092     [o others] = phido_99(mardo_o, others, o);
0093    case 'spm2'
0094     % [o others] = phido_2(mardo_o, others, o);
0095     mardo_o = mardo_99(mardo_o);
0096     [o others] = phido_99(mardo_o, others, o);
0097   end
0098 end
0099 
0100 return

Generated on Wed 06-Jul-2005 18:07:21 by m2html © 2003