function result = get( self, varargin )

% tsg_nc/get -- get structure of "tsg_nc" object.
%
% Input
% -----
% self   ........... instance of 'tsg_nc' object
% key    ........... hashtable key
% member ........... attribute member
%
% Output
% ------
% result ........... structure for the key (hashtable)
%
% if key dosn't exist, return empty structure
%
% $Id$

% Test variable argument list
% ---------------------------
switch (nargin)
  
  % Return the list of key 
  % ----------------------
  case 1
     result = keys(self);

  % Return for a valid key the hash (structure)
  % -------------------------------------------
  case 2
    if  ~isempty( find(strcmp(keys(self), varargin{1})))
      result = get(self.hashtable, varargin{1});
    else
      result = {};
    end
    
  % Return the hash member value 
  % ----------------------------
  case 3
    % call method get for an hashtable object
    % ---------------------------------------
    result = get(self, varargin{1});
    % test if third arg is a valid member of the struct in the hash
    % -------------------------------------------------------------
    if ~isempty( find(strcmp(keys(self), varargin{1})) ) && ...
        isfield(result,varargin{2})
      result = result.(varargin{2});
    else
      result = {};
    end
    
  otherwise
    error('Wrong input args');
end
