summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/EventHandler.h
blob: 04200f2d29ec8a50c658b85305edd1127ad7f1ed (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
// **********************************************************************
//
// Copyright (c) 2003-2012 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.
//
// **********************************************************************

#pragma once

#include <IceUtil/Shared.h>
#include <Ice/EventHandlerF.h>
#include <Ice/InstanceF.h>
#include <Ice/ThreadPoolF.h>
#include <Ice/BasicStream.h>
#include <Ice/Network.h>

namespace IceInternal
{

class ICE_API EventHandler : virtual public ::IceUtil::Shared
{
public:

#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
    //
    // Called to start a new asynchronous read or write operation.
    //
    virtual bool startAsync(SocketOperation) = 0;
    virtual bool finishAsync(SocketOperation) = 0;
#endif

    //
    // Called when there's a message ready to be processed.
    //
    virtual void message(ThreadPoolCurrent&) = 0;

    //
    // Called when the event handler is unregistered.
    //
    virtual void finished(ThreadPoolCurrent&) = 0;

    //
    // Get a textual representation of the event handler.
    //
    virtual std::string toString() const = 0;

    //
    // Get the native information of the handler, this is used by the selector.
    //
    virtual NativeInfoPtr getNativeInfo() = 0;

protected:
    
    EventHandler();
    virtual ~EventHandler();

#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT)
    SocketOperation _ready;
    SocketOperation _pending;
    SocketOperation _started;
    bool _finish;
#else
    SocketOperation _disabled;
#endif
    SocketOperation _registered;

    friend class ThreadPool;
    friend class Selector;
};

}