summaryrefslogtreecommitdiff
path: root/cpp/src/IceStorm/QueuedProxy.h
blob: 8fc2e4de66c7e762759a3a8d81c603e719888274 (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
// **********************************************************************
//
// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

#ifndef QUEUED_PROXY_H
#define QUEUED_PROXY_H

#include <Ice/Proxy.h>
#include <IceStorm/Event.h>

namespace IceStorm
{

//
// QueuedProxy encapsulates a subscriber proxy in order to maintain a
// queue of events to be delivered to the subscriber. QueuedProxy
// manages the event queue, but delegates delivery to subclasses.
//
class QueuedProxy : public IceUtil::Shared
{
public:

    QueuedProxy();

    virtual void publish(const EventPtr&);

    virtual Ice::ObjectPrx proxy() const = 0;

protected:

    virtual void deliver(const std::vector<EventPtr>&) = 0;

    IceUtil::Mutex _mutex;
    std::auto_ptr<Ice::LocalException> _exception;
    bool _busy;
    std::vector<EventPtr> _events;
};

typedef IceUtil::Handle<QueuedProxy> QueuedProxyPtr;

}

#endif