classdef CharacterVector
%CharacterVector A compile-time fixed size character vector
%   The CharacterVector provides control logic around accessing and setting
%   variably sized character vectors as long as the vectors are within the
%   maximum buffer length.
%#codegen

%   Copyright 2023 The MathWorks, Inc.

    properties(Access=private)
        %Length
        Length

        %Vector
        Vector
    end
    methods
        function obj=CharacterVector(maxlen)
            obj.Vector=blanks(maxlen);
            obj.Length=maxlen;
        end

        function obj=setVector(obj,vec)
            len=length(vec);
            obj.Length=len;
            obj.Vector(1,1:len)=vec(1,1:len);
        end

        function vec=getVector(obj)
            vec=obj.Vector(1,1:obj.Length);
        end
    end
end
