summaryrefslogtreecommitdiff
path: root/matlab/lib/+IceInternal/UnsetI.m
blob: a4e68dc651103d65d27b091779fffd3b69534bf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
%
% Copyright (c) ZeroC, Inc. All rights reserved.
%

%
% Singleton used to indicate an unset optional value.
%
classdef UnsetI < handle
    methods(Access=private)
        function obj = UnsetI()
        end
    end
    methods
        function r = eq(obj, other)
            r = isequal(obj, other);
        end
        function r = ne(obj, other)
            r = ~isequal(obj, other);
        end
    end
    methods(Static)
        function obj = getInstance()
            persistent singleton;
            if isempty(singleton) || ~isvalid(singleton)
                singleton = IceInternal.UnsetI();
            end
            obj = singleton;
        end
    end
end