diff m-toolbox/classes/@ssmblock/addPorts.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@ssmblock/addPorts.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,33 @@
+% ADDPORTS adds the given ssm ports to the list of ports.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: ADDPORTS adds the given ssm ports to the list of ports.
+%
+% The given ports are added to the list of ports. No check is done to ensure
+% the ports remain unique. Instead you should check with
+% ssmblock.containsPort before adding the ports.
+%
+% CALL:            block = addPorts(ssmblocks, ports)
+%
+% VERSION:     $Id: addPorts.m,v 1.4 2011/04/08 08:56:31 hewitson Exp $
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+function varargout = addPorts(varargin)
+  warning('This function is outdated and will be deleted')
+  [blocks, invars, rest] = utils.helper.collect_objects(varargin(:), 'ssmblock');
+  ports = utils.helper.collect_objects(rest, 'ssmport');
+  
+  % copy or modify
+  outblocks = copy(blocks, nargout);
+  
+  % loop over blocks
+  for kk=1:numel(blocks)
+    block = blocks(kk);
+    block.ports = [block.ports copy(ports,1)];
+  end
+  
+  if nargout > 0
+    varargout{1} = outblocks;
+  end
+end