%COVENGINEPROXY

%   Copyright 2014-2019 The MathWorks, Inc.

classdef CovEngineProxy < handle    

    properties (GetAccess=public, SetAccess=protected)
        id
    end

    methods
        %% Public method: CovEngineProxy ----------------------------------
        %  Abstract:
        %    constructor
        function this = CovEngineProxy(id)

            if nargin < 1
                id = 0;
            end

            validateattributes(id, {'numeric'}, {'scalar'});

            if id~=0 && ~cv('ishandle', id)
                throwAsCaller(MException(message('Slvnv:simcoverage:cvtest:NotTestdataObject', id)));
            end

            this.id = id;
        end

        %% Public method: set.id ------------------------------------------
        %  Abstract:
        %    Setter method for the property id
        function set.id(this, val)

            if val~=0
                if ~cv('ishandle', val)
                    throwAsCaller(MException(message('Slvnv:simcoverage:cvdata:CvObjNotExists', val)));
                end
                if cv('get', val,'.isa')~=cv('get','default','testdata.isa')
                    throwAsCaller(MException(message('Slvnv:simcoverage:cvdata:CvObjNotTestdata', val)));
                end
            end

            this.id = val;
        end

        %% Public method: double ------------------------------------------
        %  Abstract:
        %    converter
        function val = double(this)
            val = double(this.id);
        end
    end
end
