www.gusucode.com > ros 工具箱 matlab源码程序 > ros/+robotics/+ros/+msggen/+rosauth/AuthenticationRequest.m

    classdef AuthenticationRequest < robotics.ros.Message
    %AuthenticationRequest MATLAB implementation of rosauth/AuthenticationRequest
    %   This class was automatically generated by
    %   robotics.ros.msg.internal.gen.MessageClassGenerator.
    
    %   Copyright 2014-2016 The MathWorks, Inc.
    
    %#ok<*INUSD>
    
    properties (Constant)
        MessageType = 'rosauth/AuthenticationRequest' % The ROS message type
    end
    
    properties (Constant, Hidden)
        MD5Checksum = 'cad474945b8be70807460ba22a018b32' % The MD5 Checksum of the message definition
    end
    
    properties (Access = protected)
        JavaMessage % The Java message object
    end
    
    properties (Constant, Access = protected)
        TimeClass = robotics.ros.msg.internal.MessageFactory.getClassForType('time') % Dispatch to MATLAB class for message type time
    end
    
    properties (Dependent)
        Mac
        Client
        Dest
        Rand
        T
        Level
        End
    end
    
    properties (Access = protected)
        Cache = struct('T', [], 'End', []) % The cache for fast data access
    end
    
    properties (Constant, Hidden)
        PropertyList = {'Client', 'Dest', 'End', 'Level', 'Mac', 'Rand', 'T'} % List of non-constant message properties
        ROSPropertyList = {'client', 'dest', 'end', 'level', 'mac', 'rand', 't'} % List of non-constant ROS message properties
    end
    
    methods
        function obj = AuthenticationRequest(msg)
            %AuthenticationRequest Construct the message object AuthenticationRequest
            import com.mathworks.toolbox.robotics.ros.message.MessageInfo;
            
            % Support default constructor
            if nargin == 0
                obj.JavaMessage = obj.createNewJavaMessage;
                return;
            end
            
            % Construct appropriate empty array
            if isempty(msg)
                obj = obj.empty(0,1);
                return;
            end
            
            % Make scalar construction fast
            if isscalar(msg)
                % Check for correct input class
                if ~MessageInfo.compareTypes(msg(1), obj.MessageType)
                    error(message('robotics:ros:message:NoTypeMatch', obj.MessageType, ...
                        char(MessageInfo.getType(msg(1))) ));
                end
                obj.JavaMessage = msg(1);
                return;
            end
            
            % Check that this is a vector of scalar messages. Since this
            % is an object array, use arrayfun to verify.
            if ~all(arrayfun(@isscalar, msg))
                error(message('robotics:ros:message:MessageArraySizeError'));
            end
            
            % Check that all messages in the array have the correct type
            if ~all(arrayfun(@(x) MessageInfo.compareTypes(x, obj.MessageType), msg))
                error(message('robotics:ros:message:NoTypeMatchArray', obj.MessageType));
            end
            
            % Construct array of objects if necessary
            objType = class(obj);
            for i = 1:length(msg)
                obj(i,1) = feval(objType, msg(i)); %#ok<AGROW>
            end
        end
        
        function mac = get.Mac(obj)
            %get.Mac Get the value for property Mac
            mac = char(obj.JavaMessage.getMac);
        end
        
        function set.Mac(obj, mac)
            %set.Mac Set the value for property Mac
            validateattributes(mac, {'char'}, {}, 'AuthenticationRequest', 'Mac');
            
            obj.JavaMessage.setMac(mac);
        end
        
        function client = get.Client(obj)
            %get.Client Get the value for property Client
            client = char(obj.JavaMessage.getClient);
        end
        
        function set.Client(obj, client)
            %set.Client Set the value for property Client
            validateattributes(client, {'char'}, {}, 'AuthenticationRequest', 'Client');
            
            obj.JavaMessage.setClient(client);
        end
        
        function dest = get.Dest(obj)
            %get.Dest Get the value for property Dest
            dest = char(obj.JavaMessage.getDest);
        end
        
        function set.Dest(obj, dest)
            %set.Dest Set the value for property Dest
            validateattributes(dest, {'char'}, {}, 'AuthenticationRequest', 'Dest');
            
            obj.JavaMessage.setDest(dest);
        end
        
        function rand = get.Rand(obj)
            %get.Rand Get the value for property Rand
            rand = char(obj.JavaMessage.getRand);
        end
        
        function set.Rand(obj, rand)
            %set.Rand Set the value for property Rand
            validateattributes(rand, {'char'}, {}, 'AuthenticationRequest', 'Rand');
            
            obj.JavaMessage.setRand(rand);
        end
        
        function t = get.T(obj)
            %get.T Get the value for property T
            if isempty(obj.Cache.T)
                obj.Cache.T = feval(obj.TimeClass, obj.JavaMessage.getT);
            end
            t = obj.Cache.T;
        end
        
        function set.T(obj, t)
            %set.T Set the value for property T
            validateattributes(t, {obj.TimeClass}, {'nonempty', 'scalar'}, 'AuthenticationRequest', 'T');
            
            obj.JavaMessage.setT(t.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.T)
                obj.Cache.T.setJavaObject(t.getJavaObject);
            end
        end
        
        function level = get.Level(obj)
            %get.Level Get the value for property Level
            level = char(obj.JavaMessage.getLevel);
        end
        
        function set.Level(obj, level)
            %set.Level Set the value for property Level
            validateattributes(level, {'char'}, {}, 'AuthenticationRequest', 'Level');
            
            obj.JavaMessage.setLevel(level);
        end
        
        function end_ = get.End(obj)
            %get.End Get the value for property End
            if isempty(obj.Cache.End)
                obj.Cache.End = feval(obj.TimeClass, obj.JavaMessage.getEnd);
            end
            end_ = obj.Cache.End;
        end
        
        function set.End(obj, end_)
            %set.End Set the value for property End
            validateattributes(end_, {obj.TimeClass}, {'nonempty', 'scalar'}, 'AuthenticationRequest', 'End');
            
            obj.JavaMessage.setEnd(end_.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.End)
                obj.Cache.End.setJavaObject(end_.getJavaObject);
            end
        end
    end
    
    methods (Access = protected)
        function resetCache(obj)
            %resetCache Resets any cached properties
            obj.Cache.T = [];
            obj.Cache.End = [];
        end
        
        function cpObj = copyElement(obj)
            %copyElement Implements deep copy behavior for message
            
            % Call default copy method for shallow copy
            cpObj = copyElement@robotics.ros.Message(obj);
            
            % Clear any existing cached properties
            cpObj.resetCache;
            
            % Create a new Java message object
            cpObj.JavaMessage = obj.createNewJavaMessage;
            
            % Iterate over all primitive properties
            cpObj.Mac = obj.Mac;
            cpObj.Client = obj.Client;
            cpObj.Dest = obj.Dest;
            cpObj.Rand = obj.Rand;
            cpObj.Level = obj.Level;
            
            % Recursively copy compound properties
            cpObj.T = copy(obj.T);
            cpObj.End = copy(obj.End);
        end
        
        function reload(obj, strObj)
            %reload Called by loadobj to assign properties
            obj.Mac = strObj.Mac;
            obj.Client = strObj.Client;
            obj.Dest = strObj.Dest;
            obj.Rand = strObj.Rand;
            obj.Level = strObj.Level;
            obj.T = feval([obj.TimeClass '.loadobj'], strObj.T);
            obj.End = feval([obj.TimeClass '.loadobj'], strObj.End);
        end
    end
    
    methods (Access = ?robotics.ros.Message)
        function strObj = saveobj(obj)
            %saveobj Implements saving of message to MAT file
            
            % Return an empty element if object array is empty
            if isempty(obj)
                strObj = struct.empty;
                return
            end
            
            strObj.Mac = obj.Mac;
            strObj.Client = obj.Client;
            strObj.Dest = obj.Dest;
            strObj.Rand = obj.Rand;
            strObj.Level = obj.Level;
            strObj.T = saveobj(obj.T);
            strObj.End = saveobj(obj.End);
        end
    end
    
    methods (Static, Access = {?matlab.unittest.TestCase, ?robotics.ros.Message})
        function obj = loadobj(strObj)
            %loadobj Implements loading of message from MAT file
            
            % Return an empty object array if the structure element is not defined
            if isempty(strObj)
                obj = robotics.ros.msggen.rosauth.AuthenticationRequest.empty(0,1);
                return
            end
            
            % Create an empty message object
            obj = robotics.ros.msggen.rosauth.AuthenticationRequest;
            obj.reload(strObj);
        end
    end
end