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

    classdef ImageExposureStatistics < robotics.ros.Message
    %ImageExposureStatistics MATLAB implementation of image_exposure_msgs/ImageExposureStatistics
    %   This class was automatically generated by
    %   robotics.ros.msg.internal.gen.MessageClassGenerator.
    
    %   Copyright 2014-2016 The MathWorks, Inc.
    
    %#ok<*INUSD>
    
    properties (Constant)
        MessageType = 'image_exposure_msgs/ImageExposureStatistics' % The ROS message type
    end
    
    properties (Constant, Hidden)
        MD5Checksum = '334dc170ce6287d1de470f25be78dd9e' % The MD5 Checksum of the message definition
    end
    
    properties (Access = protected)
        JavaMessage % The Java message object
    end
    
    properties (Constant, Access = protected)
        StatisticsMsgsStats1DClass = robotics.ros.msg.internal.MessageFactory.getClassForType('statistics_msgs/Stats1D') % Dispatch to MATLAB class for message type statistics_msgs/Stats1D
        TimeClass = robotics.ros.msg.internal.MessageFactory.getClassForType('time') % Dispatch to MATLAB class for message type time
    end
    
    properties (Dependent)
        Stamp
        TimeReference
        Shutterms
        Gaindb
        UnderExposed
        OverExposed
        PixelVal
        PixelAge
        MeanIrradiance
        MinMeasurableIrradiance
        MaxMeasurableIrradiance
        MinObservedIrradiance
        MaxObservedIrradiance
    end
    
    properties (Access = protected)
        Cache = struct('Stamp', [], 'PixelVal', [], 'PixelAge', []) % The cache for fast data access
    end
    
    properties (Constant, Hidden)
        PropertyList = {'Gaindb', 'MaxMeasurableIrradiance', 'MaxObservedIrradiance', 'MeanIrradiance', 'MinMeasurableIrradiance', 'MinObservedIrradiance', 'OverExposed', 'PixelAge', 'PixelVal', 'Shutterms', 'Stamp', 'TimeReference', 'UnderExposed'} % List of non-constant message properties
        ROSPropertyList = {'gaindb', 'maxMeasurableIrradiance', 'maxObservedIrradiance', 'meanIrradiance', 'minMeasurableIrradiance', 'minObservedIrradiance', 'overExposed', 'pixelAge', 'pixelVal', 'shutterms', 'stamp', 'time_reference', 'underExposed'} % List of non-constant ROS message properties
    end
    
    methods
        function obj = ImageExposureStatistics(msg)
            %ImageExposureStatistics Construct the message object ImageExposureStatistics
            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 stamp = get.Stamp(obj)
            %get.Stamp Get the value for property Stamp
            if isempty(obj.Cache.Stamp)
                obj.Cache.Stamp = feval(obj.TimeClass, obj.JavaMessage.getStamp);
            end
            stamp = obj.Cache.Stamp;
        end
        
        function set.Stamp(obj, stamp)
            %set.Stamp Set the value for property Stamp
            validateattributes(stamp, {obj.TimeClass}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'Stamp');
            
            obj.JavaMessage.setStamp(stamp.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.Stamp)
                obj.Cache.Stamp.setJavaObject(stamp.getJavaObject);
            end
        end
        
        function timereference = get.TimeReference(obj)
            %get.TimeReference Get the value for property TimeReference
            timereference = char(obj.JavaMessage.getTimeReference);
        end
        
        function set.TimeReference(obj, timereference)
            %set.TimeReference Set the value for property TimeReference
            validateattributes(timereference, {'char'}, {}, 'ImageExposureStatistics', 'TimeReference');
            
            obj.JavaMessage.setTimeReference(timereference);
        end
        
        function shutterms = get.Shutterms(obj)
            %get.Shutterms Get the value for property Shutterms
            shutterms = single(obj.JavaMessage.getShutterms);
        end
        
        function set.Shutterms(obj, shutterms)
            %set.Shutterms Set the value for property Shutterms
            validateattributes(shutterms, {'numeric'}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'Shutterms');
            
            obj.JavaMessage.setShutterms(shutterms);
        end
        
        function gaindb = get.Gaindb(obj)
            %get.Gaindb Get the value for property Gaindb
            gaindb = single(obj.JavaMessage.getGaindb);
        end
        
        function set.Gaindb(obj, gaindb)
            %set.Gaindb Set the value for property Gaindb
            validateattributes(gaindb, {'numeric'}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'Gaindb');
            
            obj.JavaMessage.setGaindb(gaindb);
        end
        
        function underexposed = get.UnderExposed(obj)
            %get.UnderExposed Get the value for property UnderExposed
            underexposed = typecast(int32(obj.JavaMessage.getUnderExposed), 'uint32');
        end
        
        function set.UnderExposed(obj, underexposed)
            %set.UnderExposed Set the value for property UnderExposed
            validateattributes(underexposed, {'numeric'}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'UnderExposed');
            
            obj.JavaMessage.setUnderExposed(underexposed);
        end
        
        function overexposed = get.OverExposed(obj)
            %get.OverExposed Get the value for property OverExposed
            overexposed = typecast(int32(obj.JavaMessage.getOverExposed), 'uint32');
        end
        
        function set.OverExposed(obj, overexposed)
            %set.OverExposed Set the value for property OverExposed
            validateattributes(overexposed, {'numeric'}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'OverExposed');
            
            obj.JavaMessage.setOverExposed(overexposed);
        end
        
        function pixelval = get.PixelVal(obj)
            %get.PixelVal Get the value for property PixelVal
            if isempty(obj.Cache.PixelVal)
                obj.Cache.PixelVal = feval(obj.StatisticsMsgsStats1DClass, obj.JavaMessage.getPixelVal);
            end
            pixelval = obj.Cache.PixelVal;
        end
        
        function set.PixelVal(obj, pixelval)
            %set.PixelVal Set the value for property PixelVal
            validateattributes(pixelval, {obj.StatisticsMsgsStats1DClass}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'PixelVal');
            
            obj.JavaMessage.setPixelVal(pixelval.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.PixelVal)
                obj.Cache.PixelVal.setJavaObject(pixelval.getJavaObject);
            end
        end
        
        function pixelage = get.PixelAge(obj)
            %get.PixelAge Get the value for property PixelAge
            if isempty(obj.Cache.PixelAge)
                obj.Cache.PixelAge = feval(obj.StatisticsMsgsStats1DClass, obj.JavaMessage.getPixelAge);
            end
            pixelage = obj.Cache.PixelAge;
        end
        
        function set.PixelAge(obj, pixelage)
            %set.PixelAge Set the value for property PixelAge
            validateattributes(pixelage, {obj.StatisticsMsgsStats1DClass}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'PixelAge');
            
            obj.JavaMessage.setPixelAge(pixelage.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.PixelAge)
                obj.Cache.PixelAge.setJavaObject(pixelage.getJavaObject);
            end
        end
        
        function meanirradiance = get.MeanIrradiance(obj)
            %get.MeanIrradiance Get the value for property MeanIrradiance
            meanirradiance = double(obj.JavaMessage.getMeanIrradiance);
        end
        
        function set.MeanIrradiance(obj, meanirradiance)
            %set.MeanIrradiance Set the value for property MeanIrradiance
            validateattributes(meanirradiance, {'numeric'}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'MeanIrradiance');
            
            obj.JavaMessage.setMeanIrradiance(meanirradiance);
        end
        
        function minmeasurableirradiance = get.MinMeasurableIrradiance(obj)
            %get.MinMeasurableIrradiance Get the value for property MinMeasurableIrradiance
            minmeasurableirradiance = double(obj.JavaMessage.getMinMeasurableIrradiance);
        end
        
        function set.MinMeasurableIrradiance(obj, minmeasurableirradiance)
            %set.MinMeasurableIrradiance Set the value for property MinMeasurableIrradiance
            validateattributes(minmeasurableirradiance, {'numeric'}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'MinMeasurableIrradiance');
            
            obj.JavaMessage.setMinMeasurableIrradiance(minmeasurableirradiance);
        end
        
        function maxmeasurableirradiance = get.MaxMeasurableIrradiance(obj)
            %get.MaxMeasurableIrradiance Get the value for property MaxMeasurableIrradiance
            maxmeasurableirradiance = double(obj.JavaMessage.getMaxMeasurableIrradiance);
        end
        
        function set.MaxMeasurableIrradiance(obj, maxmeasurableirradiance)
            %set.MaxMeasurableIrradiance Set the value for property MaxMeasurableIrradiance
            validateattributes(maxmeasurableirradiance, {'numeric'}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'MaxMeasurableIrradiance');
            
            obj.JavaMessage.setMaxMeasurableIrradiance(maxmeasurableirradiance);
        end
        
        function minobservedirradiance = get.MinObservedIrradiance(obj)
            %get.MinObservedIrradiance Get the value for property MinObservedIrradiance
            minobservedirradiance = double(obj.JavaMessage.getMinObservedIrradiance);
        end
        
        function set.MinObservedIrradiance(obj, minobservedirradiance)
            %set.MinObservedIrradiance Set the value for property MinObservedIrradiance
            validateattributes(minobservedirradiance, {'numeric'}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'MinObservedIrradiance');
            
            obj.JavaMessage.setMinObservedIrradiance(minobservedirradiance);
        end
        
        function maxobservedirradiance = get.MaxObservedIrradiance(obj)
            %get.MaxObservedIrradiance Get the value for property MaxObservedIrradiance
            maxobservedirradiance = double(obj.JavaMessage.getMaxObservedIrradiance);
        end
        
        function set.MaxObservedIrradiance(obj, maxobservedirradiance)
            %set.MaxObservedIrradiance Set the value for property MaxObservedIrradiance
            validateattributes(maxobservedirradiance, {'numeric'}, {'nonempty', 'scalar'}, 'ImageExposureStatistics', 'MaxObservedIrradiance');
            
            obj.JavaMessage.setMaxObservedIrradiance(maxobservedirradiance);
        end
    end
    
    methods (Access = protected)
        function resetCache(obj)
            %resetCache Resets any cached properties
            obj.Cache.Stamp = [];
            obj.Cache.PixelVal = [];
            obj.Cache.PixelAge = [];
        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.TimeReference = obj.TimeReference;
            cpObj.Shutterms = obj.Shutterms;
            cpObj.Gaindb = obj.Gaindb;
            cpObj.UnderExposed = obj.UnderExposed;
            cpObj.OverExposed = obj.OverExposed;
            cpObj.MeanIrradiance = obj.MeanIrradiance;
            cpObj.MinMeasurableIrradiance = obj.MinMeasurableIrradiance;
            cpObj.MaxMeasurableIrradiance = obj.MaxMeasurableIrradiance;
            cpObj.MinObservedIrradiance = obj.MinObservedIrradiance;
            cpObj.MaxObservedIrradiance = obj.MaxObservedIrradiance;
            
            % Recursively copy compound properties
            cpObj.Stamp = copy(obj.Stamp);
            cpObj.PixelVal = copy(obj.PixelVal);
            cpObj.PixelAge = copy(obj.PixelAge);
        end
        
        function reload(obj, strObj)
            %reload Called by loadobj to assign properties
            obj.TimeReference = strObj.TimeReference;
            obj.Shutterms = strObj.Shutterms;
            obj.Gaindb = strObj.Gaindb;
            obj.UnderExposed = strObj.UnderExposed;
            obj.OverExposed = strObj.OverExposed;
            obj.MeanIrradiance = strObj.MeanIrradiance;
            obj.MinMeasurableIrradiance = strObj.MinMeasurableIrradiance;
            obj.MaxMeasurableIrradiance = strObj.MaxMeasurableIrradiance;
            obj.MinObservedIrradiance = strObj.MinObservedIrradiance;
            obj.MaxObservedIrradiance = strObj.MaxObservedIrradiance;
            obj.Stamp = feval([obj.TimeClass '.loadobj'], strObj.Stamp);
            obj.PixelVal = feval([obj.StatisticsMsgsStats1DClass '.loadobj'], strObj.PixelVal);
            obj.PixelAge = feval([obj.StatisticsMsgsStats1DClass '.loadobj'], strObj.PixelAge);
        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.TimeReference = obj.TimeReference;
            strObj.Shutterms = obj.Shutterms;
            strObj.Gaindb = obj.Gaindb;
            strObj.UnderExposed = obj.UnderExposed;
            strObj.OverExposed = obj.OverExposed;
            strObj.MeanIrradiance = obj.MeanIrradiance;
            strObj.MinMeasurableIrradiance = obj.MinMeasurableIrradiance;
            strObj.MaxMeasurableIrradiance = obj.MaxMeasurableIrradiance;
            strObj.MinObservedIrradiance = obj.MinObservedIrradiance;
            strObj.MaxObservedIrradiance = obj.MaxObservedIrradiance;
            strObj.Stamp = saveobj(obj.Stamp);
            strObj.PixelVal = saveobj(obj.PixelVal);
            strObj.PixelAge = saveobj(obj.PixelAge);
        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.image_exposure_msgs.ImageExposureStatistics.empty(0,1);
                return
            end
            
            % Create an empty message object
            obj = robotics.ros.msggen.image_exposure_msgs.ImageExposureStatistics;
            obj.reload(strObj);
        end
    end
end