From e3314ddb71e7b227e36a28347120511e75626cce Mon Sep 17 00:00:00 2001
From: Jacques Grelet <jacques.grelet@ird.fr>
Date: Fri, 18 Jan 2008 08:47:14 +0000
Subject: [PATCH] Remove @quality object and use tsg_nc classe with
 @tsg_nc/tsg_quality.csv file Write @tsg_nc/tsg_quality.csv with new format id
 en endl line delimiter Change tsg.qc.hash initialisation with
 @tsg_nc/tsg_quality.csv

---
 @quality/display.m            |  9 ------
 @quality/get.m                | 52 -----------------------------------
 @quality/keys.m               | 10 -------
 @quality/quality.csv          | 10 -------
 @quality/quality.m            | 51 ----------------------------------
 @tsg_nc/tsg_quality.csv       | 15 ++++++++++
 tsg_util/tsg_initialisation.m |  4 +--
 7 files changed, 17 insertions(+), 134 deletions(-)
 delete mode 100644 @quality/display.m
 delete mode 100644 @quality/get.m
 delete mode 100644 @quality/keys.m
 delete mode 100644 @quality/quality.csv
 delete mode 100644 @quality/quality.m
 create mode 100644 @tsg_nc/tsg_quality.csv

diff --git a/@quality/display.m b/@quality/display.m
deleted file mode 100644
index a706f89..0000000
--- a/@quality/display.m
+++ /dev/null
@@ -1,9 +0,0 @@
-function display(this)
-
-%$Id: display.m 53 2006-03-03 13:41:22Z jgrelet $
-
-try
-  disp(struct(this));
-catch
-  err ('quality', 'display', lasterr) ;
-end
diff --git a/@quality/get.m b/@quality/get.m
deleted file mode 100644
index 06662bc..0000000
--- a/@quality/get.m
+++ /dev/null
@@ -1,52 +0,0 @@
-function result = get( self, varargin )
-
-% quality/get -- get structure of "quality" object.
-%
-% Input
-% -----
-% self   ........... instance of 'quality' object
-% key    ........... types 
-% member ........... attribute member
-%
-% Output
-% ------
-% result ........... structure for the key (hastable)
-%
-% if key dosn't exist, return empty struct
-
-% $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
diff --git a/@quality/keys.m b/@quality/keys.m
deleted file mode 100644
index 8050e33..0000000
--- a/@quality/keys.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function result = types(self)
-
-% quality/types -- Get all the types currently being used in the internal
-%   quality hash
-%   result = types(self)
-
-% $Id$
-
-result = keys(self.hashtable);
-
diff --git a/@quality/quality.csv b/@quality/quality.csv
deleted file mode 100644
index e29dcb8..0000000
--- a/@quality/quality.csv
+++ /dev/null
@@ -1,10 +0,0 @@
-NO_CONTROL;No control;0;k;on
-GOOD;Good;1;b;on
-PROBABLY_GOOD;Probably Good;2;g;on
-PROBABLY_BAD;Probably bad;3;m;on
-BAD;Bad;4;r;on
-VALUE_CHANGED;Value changed;5;y;off
-HARBOUR;Harbour;6;c;on
-NOT_USED;Not used;7;w;off
-INTERPOLATED_VALUE;Interpolated value;8;k;off
-MISSING_VALUE;Missing value;9;k;off
diff --git a/@quality/quality.m b/@quality/quality.m
deleted file mode 100644
index 2688515..0000000
--- a/@quality/quality.m
+++ /dev/null
@@ -1,51 +0,0 @@
-function q = quality( varargin )
-% QUALITY constructor function for QUALITY object
-%
-% Use:                 q = quality( <file> )
-%
-% by default:          q = quality 
-% use @quality/quality.scv file
-%
-% example:
-%   Get all types        get(q)
-%   get internal has     get(q, 'NO_CONTROL')
-%   get specific value   get(q, 'NO_CONTROL','code')
-%  
-% $Id$
-
-switch nargin
-  case 0  % create default object
-    file = 'quality.csv';
-  case 1
-    if( isa(varargin{1}, 'char'))
-      file = varargin{1};      
-    else
-      error('Wrong input argument');
-    end
-  otherwise
-    error('Wrong number of input arguments');
-end
-
-if exist(file, 'file') ~= 2
-  disp(['The specified data file ' file  ' does not exist ...']);
-  disp('Or is not in the directory which is on the MATLAB search path');
-  datagui_closereq_callback;
-end
-
-[type,label,code,color,state] = textread(...
-      file,'%s%s%d%s%s','delimiter',';');
-
-q.file = which(file);
-q.size = length(type);
-types   = hashtable;
-
-for i=1:length(type)
-  s.label  = label{i};
-  s.code   = code(i);
-  s.color  = color{i};
-  s.state  = state{i};
- 
-  types = put(types, type{i}, s);
-end	
-
-q = class(q, 'quality', types );
diff --git a/@tsg_nc/tsg_quality.csv b/@tsg_nc/tsg_quality.csv
new file mode 100644
index 0000000..504785a
--- /dev/null
+++ b/@tsg_nc/tsg_quality.csv
@@ -0,0 +1,15 @@
+% tsg_quality.csv:  definition ( id + 6 members + endl & 16 separators ; actually)
+% $Id$
+%
+id;type;label;code;color;state;endl
+char;char;char;integer;char;char;char
+#;NO_CONTROL;No control;0;k;on;#
+#;GOOD;Good;1;b;on;#
+#;PROBABLY_GOOD;Probably Good;2;g;on;#
+#;PROBABLY_BAD;Probably bad;3;m;on;#
+#;BAD;Bad;4;r;on;#
+#;VALUE_CHANGED;Value changed;5;y;off;#
+#;HARBOUR;Harbour;6;c;on;#
+#;NOT_USED;Not used;7;w;off;#
+#;INTERPOLATED_VALUE;Interpolated value;8;k;off;#
+#;MISSING_VALUE;Missing value;9;k;off;#
diff --git a/tsg_util/tsg_initialisation.m b/tsg_util/tsg_initialisation.m
index f0bd55e..67382e1 100644
--- a/tsg_util/tsg_initialisation.m
+++ b/tsg_util/tsg_initialisation.m
@@ -57,10 +57,10 @@ tsg.file.type = [];
 %  9         Missing value                              
 
 % Quality definition, we use a hashtable with a definition file 
-% @quality/quality.csv, 
+% located in @tsg_nc/tsg_quality.csv, 
 % use this file if you want add or modify quality context menu
 % -------------------------------------------------------------
-tsg.qc.hash = quality;
+tsg.qc.hash = tsg_nc('tsg_quality.csv');
 
 % set default code at startup
 % ---------------------------
-- 
GitLab