classdef (Abstract, Hidden) TargetRepositoryParameterMap < matlab.mixin.SetGetExactNames
%TARGETREPOSITORYPARAMETERMAP Base class for Simulink parameter mapping
%from target repository objects.

% Copyright 2018-2020 The MathWorks, Inc.

properties (SetAccess=protected)
Vendor;
Type;
Alias;
Platform;
Grandfathered;
end

properties (Abstract, SetAccess=protected)
BitPerChar;
BitPerShort;
BitPerInt;
BitPerLong;
BitPerLongLong;
WordSize;
Endianess;
IntDivRoundTo;
LargestAtomicInteger;
LargestAtomicFloat;
ShiftRightIntArith;
LongLongMode;
BitPerFloat;
BitPerDouble;
BitPerPointer;
BitPerSizeT;
BitPerPtrDiffT;
Visible;
Enabled;
end

properties (Access=protected)
Object;
end

methods

% Converts the instance to a structure of parameter values
function s = toParameterStruct(this)

props = properties(this);
vals = get(this, props)';
s = cell2struct(vals, props);
end

function value = get.Vendor(this)

if isempty(this.Object.Manufacturer)
value = this.Object.Name;
else
value = this.Object.Manufacturer;
end
end

function value = get.Type(this)
value = this.Object.Name;
end

function value = get.Alias(this)

if this.Object.AliasList.Size > 0
value = this.Object.AliasList.toArray()';
else
value = {};
end
end

function value = get.Platform(this)

switch this.Object.Platform
case target.internal.compatibility.HardwareImplementationPlatform.All
value = {'Prod', 'Target'};
case target.internal.compatibility.HardwareImplementationPlatform.Production
value = {'Prod'};
case target.internal.compatibility.HardwareImplementationPlatform.Target
value = {'Target'};
end
end

function value = get.Grandfathered(this)
value = this.Object.Grandfathered;
end
end
end