~ubuntu-branches/ubuntu/vivid/unity-scopes-api/vivid-proposed

1.1.4 by Ubuntu daily release
Import upstream version 0.2.0+14.04.20140120
1
/*
2
 * Copyright (C) 2013 Canonical Ltd
3
 *
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU Lesser General Public License version 3 as
6
 * published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 * GNU Lesser General Public License for more details.
12
 *
13
 * You should have received a copy of the GNU Lesser General Public License
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 *
16
 * Authored by: Michi Henning <michi.henning@canonical.com>
17
 */
18
1.1.46 by Ubuntu daily release
Import upstream version 0.6.9+15.04.20141129
19
#pragma once
1.1.4 by Ubuntu daily release
Import upstream version 0.2.0+14.04.20140120
20
1.1.5 by Ubuntu daily release
Import upstream version 0.2.4+14.04.20140124
21
#include <unity/scopes/internal/ReplyObjectBase.h>
1.1.4 by Ubuntu daily release
Import upstream version 0.2.0+14.04.20140120
22
#include <unity/scopes/internal/Reaper.h>
23
#include <unity/scopes/ListenerBase.h>
24
#include <unity/scopes/Variant.h>
25
26
#include <atomic>
27
#include <condition_variable>
28
29
namespace unity
30
{
31
32
namespace scopes
33
{
34
35
namespace internal
36
{
37
1.1.53 by Ubuntu daily release
Import upstream version 0.6.12+15.04.20150127.2
38
struct InvokeInfo;
1.1.4 by Ubuntu daily release
Import upstream version 0.2.0+14.04.20140120
39
class RuntimeImpl;
40
41
// A ReplyObject sits in between the incoming requests from the middleware layer and the
42
// ListenerBase-derived implementation provided by the scope.
43
// This allows us to intercept all replies.
44
1.1.5 by Ubuntu daily release
Import upstream version 0.2.4+14.04.20140124
45
class ReplyObject : public ReplyObjectBase
1.1.4 by Ubuntu daily release
Import upstream version 0.2.0+14.04.20140120
46
{
47
public:
48
    UNITY_DEFINES_PTRS(ReplyObject);
49
1.1.39 by Ubuntu daily release
Import upstream version 0.6.3+14.10.20140826
50
    ReplyObject(ListenerBase::SPtr const& receiver_base, RuntimeImpl const* runtime,
51
                std::string const& scope_proxy, bool dont_reap);
1.1.5 by Ubuntu daily release
Import upstream version 0.2.4+14.04.20140124
52
    virtual ~ReplyObject();
1.1.4 by Ubuntu daily release
Import upstream version 0.2.0+14.04.20140120
53
1.1.12 by Ubuntu daily release
Import upstream version 0.4.0+14.04.20140312.1
54
    virtual bool process_data(VariantMap const& data) = 0;
55
56
    std::string origin_proxy() const;
1.1.4 by Ubuntu daily release
Import upstream version 0.2.0+14.04.20140120
57
58
    // Remote operation implementations
1.1.5 by Ubuntu daily release
Import upstream version 0.2.4+14.04.20140124
59
    void push(VariantMap const& result) noexcept override;
1.1.34 by Ubuntu daily release
Import upstream version 0.6.0+14.10.20140804.1
60
    void finished(CompletionDetails const& details) noexcept override;
61
    void info(OperationInfo const& op_info) noexcept override;
1.1.4 by Ubuntu daily release
Import upstream version 0.2.0+14.04.20140120
62
63
private:
1.1.47 by Ubuntu daily release
Import upstream version 0.6.10+15.04.20141210.2
64
    RuntimeImpl const* runtime_;
1.1.19 by Ubuntu daily release
Import upstream version 0.4.3+14.10.20140428
65
    ListenerBase::SPtr listener_base_;
1.1.4 by Ubuntu daily release
Import upstream version 0.2.0+14.04.20140120
66
    ReapItem::SPtr reap_item_;
67
    std::atomic_bool finished_;
68
    std::mutex mutex_;
69
    std::condition_variable idle_;
1.1.8 by Ubuntu daily release
Import upstream version 0.3.1+14.04.20140211.2
70
    std::string origin_proxy_;
1.1.4 by Ubuntu daily release
Import upstream version 0.2.0+14.04.20140120
71
    int num_push_;
1.1.34 by Ubuntu daily release
Import upstream version 0.6.0+14.10.20140804.1
72
    std::vector<OperationInfo> info_list_;
1.1.4 by Ubuntu daily release
Import upstream version 0.2.0+14.04.20140120
73
};
74
75
} // namespace internal
76
77
} // namespace scopes
78
79
} // namespace unity