summaryrefslogtreecommitdiff
path: root/matlab/lib/+Ice/ImplicitContext.m
blob: ea958294b70ec44bfdc02552c678ba457261c4da (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
classdef ImplicitContext < IceInternal.WrapperObject
    % ImplicitContext   Summary of ImplicitContext
    %
    % An interface to associate implict contexts with communicators.
    %
    % When you make a remote invocation without an explicit context parameter,
    % Ice uses the per-proxy context (if any) combined with the ImplicitContext
    % associated with the communicator.
    %
    % Ice provides several implementations of ImplicitContext. The implementation
    % used depends on the value of the Ice.ImplicitContext property.
    %
    % * None (default)
    %   No implicit context at all.
    % * PerThread
    %   The implementation maintains a context per thread.
    % * Shared
    %   The implementation maintains a single context shared by all threads.
    %
    % ImplicitContext also provides a number of operations to create, update or
    % retrieve an entry in the underlying context without first retrieving a
    % copy of the entire context. These operations correspond to a subset of
    % the java.util.Map methods, with java.lang.Object replaced by string and
    % null replaced by the empty string.
    %
    % ImplicitContext Methods:
    %   getContext - Get a copy of the underlying context.
    %   setContext - Set the underlying context.
    %   containsKey - Check if this key has an associated value in the
    %     underlying context.
    %   get - Get the value associated with the given key in the underlying
    %     context.
    %   put - Create or update a key/value entry in the underlying context.
    %   remove - Remove the entry for the given key in the underlying context.

    % Copyright (c) ZeroC, Inc. All rights reserved.

    methods
        function obj = ImplicitContext(impl)
            if ~isa(impl, 'lib.pointer')
                throw(MException('Ice:ArgumentException', 'invalid argument'));
            end
            obj = obj@IceInternal.WrapperObject(impl);
        end
        function r = getContext(obj)
            % getContext - Get a copy of the underlying context.
            %
            % Returns (containers.Map): A copy of the underlying context.

            r = obj.iceCallWithResult('getContext');
        end
        function setContext(obj, newContext)
            % setContext - Set the underlying context.
            %
            % Parameters:
            %   newContext (containers.Map) - The new context.

            obj.iceCall('setContext', newContext);
        end
        function r = containsKey(obj, key)
            % containsKey - Check if this key has an associated value in the
            %   underlying context.
            %
            % Parameters:
            %   key (char) - The key.
            %
            % Returns (logical) - True if the key has an associated value,
            %   false otherwise.

            r = obj.iceCallWithResult('containsKey', key);
        end
        function r = get(obj, key)
            % get - Get the value associated with the given key in the
            %   underlying context. Returns an empty string if no value is
            %   associated with the key. containsKey allows you to distinguish
            %   between an empty string value and no value at all.
            %
            % Parameters:
            %   key (char) - The key.
            %
            % Returns (char) - The value associated with the key.

            r = obj.iceCallWithResult('get', key);
        end
        function r = put(obj, key, value)
            % put - Create or update a key/value entry in the underlying
            %   context.
            %
            % Parameters:
            %   key (char) - The key.
            %   value (char) - The value.
            %
            % Returns (char) - The previous value associated with the key,
            %   if any.

            r = obj.iceCallWithResult('put', key, value);
        end
        function r = remove(obj, key)
            % remove - Remove the entry for the given key in the underlying
            %   context.
            %
            % Parameters:
            %   key (char) - The key.
            %
            % Returns (char) - The value associated with the key, if any.

            r = obj.iceCallWithResult('remove', key);
        end
    end
end