Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TSG QC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
US191
TSG QC
Commits
594c3bc1
Commit
594c3bc1
authored
17 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
add new methods set and isfield, update get in tsg_nc class
parent
2d5b722b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
@tsg_nc/get.m
+8
-6
8 additions, 6 deletions
@tsg_nc/get.m
@tsg_nc/isfield.m
+26
-0
26 additions, 0 deletions
@tsg_nc/isfield.m
@tsg_nc/set.m
+20
-4
20 additions, 4 deletions
@tsg_nc/set.m
with
54 additions
and
10 deletions
@tsg_nc/get.m
+
8
−
6
View file @
594c3bc1
function
result
=
get
(
self
,
varargin
)
% tsg_nc
var
/get -- get structure of "tsg_ncv
ar
" object.
% tsg_nc/get -- get structure of "tsg_ncv" object.
%
% Input
% -----
% self ........... instance of 'tsg_nc
var
' object
% key ...........
GF3 code
% self ........... instance of 'tsg_nc' object
% key ...........
hashtable key
% member ........... attribute member
%
% Output
% ------
% result ........... structure for the key (hastable)
% result ........... structure for the key (hashtable)
%
% if key dosn't exist, return empty structure
%
% if key dosn't exist, return empty struct
% $Id$
% Test variable argument list
...
...
@@ -38,8 +38,10 @@ switch (nargin)
% ----------------------------
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
});
...
...
This diff is collapsed.
Click to expand it.
@tsg_nc/isfield.m
0 → 100644
+
26
−
0
View file @
594c3bc1
function
bool
=
isfield
(
self
,
fieldname
)
% tsg_nc/get_fieldnames -- get internal structure fieldnames of "tsg_nc" object.
%
% Input
% -----
% self ........... an instance of 'tsg_nc' object
% fieldname ........... is field of internal structure ?
%
% Output
% ------
% bool .......... true if fieldname is internal structure
% $Id: get_fieldnames.m 92 2008-01-09 11:10:40Z jgrelet $
% get cell of keys inside object
% ------------------------------
c
=
get
(
self
);
if
isempty
(
c
)
warning
(
'Empty object'
)
;
else
% get structure for the first element
theStruc
=
get
(
self
,
c
{
1
});
bool
=
isfield
(
theStruc
,
fieldname
);
end
This diff is collapsed.
Click to expand it.
@tsg_nc/set.m
+
20
−
4
View file @
594c3bc1
function
self
=
set
(
self
,
varargin
)
function
self
=
set
(
self
,
key
,
theStruct
)
% tsg_nc
var
/set -- set new pair key/value for "tsg_nc
var
" object.
% tsg_nc/set -- set new pair key/value for "tsg_nc" object.
%
% not implemented yet
% Input
% -------
% self ........... instance of 'tsg_nc' object
% key ........... hashtable key
% theStruct ........... hashtable structure
%
% Output
% --------
% self ........... instance of updated 'tsg_nc' object
%
% $Id$
% populate the internal hashtable
% -------------------------------
self
.
hashtable
=
put
(
self
.
hashtable
,
key
,
theStruct
);
% $Id£
% update self.size
% ----------------
self
.
size
=
numel
(
keys
(
self
.
hashtable
));
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment