Home > vbmeg > functions > common > utility > stack > vb_stack_get_length.m

vb_stack_get_length

PURPOSE ^

return number of items that stack has.

SYNOPSIS ^

function [N] = vb_stack_get_length(obj)

DESCRIPTION ^

 return number of items that stack has.
 [USAGE]
    [N] = vb_stack_get_length(<obj>);
 [IN]
    obj : stack object
 [OUT]
    N : item number that stack has.

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [N] = vb_stack_get_length(obj)
0002 % return number of items that stack has.
0003 % [USAGE]
0004 %    [N] = vb_stack_get_length(<obj>);
0005 % [IN]
0006 %    obj : stack object
0007 % [OUT]
0008 %    N : item number that stack has.
0009 %
0010 % Copyright (C) 2011, ATR All Rights Reserved.
0011 % License : New BSD License(see VBMEG_LICENSE.txt)
0012 
0013 %
0014 % --- Previous check
0015 %
0016 if ~exist('obj', 'var'), error('obj is a required parameter.'); end
0017 
0018 %
0019 % --- Main Procedure
0020 %
0021 switch(obj.class_type)
0022     case {'m_stack', 'f_stack'}
0023         N = length(obj.queue);
0024     otherwise
0025         error('invalid object is inputted.');
0026 end
0027 
0028 %
0029 % --- After check
0030 %

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005