summaryrefslogtreecommitdiff
path: root/cpp/src/IceStorm/QueuedProxy.h
blob: 4338a4d164041ae1f697a316e9d22571e9a2104e (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
// **********************************************************************
//
// Copyright (c) 2003
// ZeroC, Inc.
// Billerica, MA, USA
//
// All Rights Reserved.
//
// Ice is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License version 2 as published by
// the Free Software Foundation.
//
// **********************************************************************

#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 subsclasses.
//
class QueuedProxy : public IceUtil::Shared
{
public:

    QueuedProxy();

    void publish(const EventPtr&);

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

protected:

    virtual void deliver(const EventPtr&) = 0;

private:

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

typedef IceUtil::Handle<QueuedProxy> QueuedProxyPtr;

}

#endif