Skip to content
Snippets Groups Projects

Implements #73, cleans up example file,

Merged Lemmer, Jan requested to merge development into master
21 files
+ 448
251
Compare changes
  • Side-by-side
  • Inline
Files
21
+ 21
19
classdef config < handle
%CONFIG class handles methoths and attributes related to the config
%CONFIG class handles methods and attributes related to the config
%file
% Detailed explanation goes here
% handle class used for dynamicy property updates
%handle class used for dynamicy property updates
properties (SetAccess = private)
mandatoryFields = {'Author', 'ProjectID'}
optionFields
optionFields
configPath
end
properties (SetAccess = protected)
configData
configFileName
exportPath = ''
end
methods
function obj = config(configFileName)
%CONFIG Construct an instance of this class
% Detailed explanation goes here
% reads config data from config file, if an error occurs the
% wizard is started by the catch block
obj.configFileName = configFileName;
try
txt = fileread(obj.configFileName);
obj.configData = jsondecode(txt);
assert(checkConfig(obj));
catch
if isfield(obj.configData,'ExportPath')
obj.exportPath = obj.configData.ExportPath;
obj.configData.options.Location = 'exportPath';
end
catch
msg = ['no valid config File with the filename ',...
obj.configFileName, ' found.' newline,...
'Please enter the required information manually'];
disp(msg);
obj.configData = obj.wizard('initilise');
obj.configData = obj.wizard('initialise');
m = input('Do you want to save the config, Y/N [Y]:','s');
if ismember(m,{'Y','y'})
obj.writeConfig(fullfile(pwd));
end
end%try
obj.configPath = which(obj.configFileName);
end
function outputArg = checkConfig(obj)
@@ -57,22 +62,19 @@ classdef config < handle
end
function configData = addPublishOptions(obj,mode)
%writeConfig writes the config file to path
% TODo;
%addPublishOptions adds the publsih options to the config
%object depending on the mode
obj.configData.options = obj.plotID_options(mode);
end
function outputArg = method1(obj,inputArg)
%METHOD1 Summary of this method goes here
% Detailed explanation goes here
outputArg = obj.Property1 + inputArg;
end
cpath = fileparts(obj.configPath);
obj.writeConfig(cpath);
end
end
methods (Static)
configStruct = wizard(mode)
optionStruct = plotID_options(input)
optionStruct = plotID_options(input)
end
end
Loading