| Wisp 1.2.0 C++ Unit Test Coverage |
|
|
|
|
|
Branch data Line data Source code
1 : : /*
2 : : * Copyright 2009 Savarese Software Research Corporation
3 : : *
4 : : * Licensed under the Apache License, Version 2.0 (the "License");
5 : : * you may not use this file except in compliance with the License.
6 : : * You may obtain a copy of the License at
7 : : *
8 : : * http://www.savarese.com/software/ApacheLicense-2.0
9 : : *
10 : : * Unless required by applicable law or agreed to in writing, software
11 : : * distributed under the License is distributed on an "AS IS" BASIS,
12 : : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 : : * See the License for the specific language governing permissions and
14 : : * limitations under the License.
15 : : */
16 : :
17 : : /**
18 : : * @file
19 : : * This header defines the SolarisEventPort class.
20 : : */
21 : :
22 : : #ifndef __SSRC_WISP_SERVICE_DETAIL_SOLARIS_EVENT_PORT_H
23 : : #define __SSRC_WISP_SERVICE_DETAIL_SOLARIS_EVENT_PORT_H
24 : :
25 : : #include <ssrc/wisp/service/EventHandler.h>
26 : :
27 : : namespace Solaris {
28 : : #include <port.h>
29 : : #include <poll.h>
30 : : }
31 : :
32 : : __BEGIN_NS_SSRC_WISP_SERVICE
33 : :
34 : : namespace detail {
35 : :
36 : : class SolarisEventPort {
37 : : int _port_fd;
38 : :
39 : : public:
40 : : typedef Solaris::port_event_t event_type;
41 : : typedef int events_type;
42 : :
43 : : enum EventIO {
44 : : None = 0,
45 : : Read = POLLIN,
46 : : Write = POLLOUT,
47 : : Error = POLLERR,
48 : : Hangup = POLLHUP
49 : : /*
50 : : Signal =
51 : : */
52 : : };
53 : :
54 : 8 : static EventHandler * get_handler(event_type & e) {
55 : 8 : return static_cast<EventHandler *>(e.portev_user);
56 : : }
57 : :
58 : 8 : static events_type get_events(const event_type & e) {
59 : 8 : return e.portev_events;
60 : : }
61 : :
62 : : SolarisEventPort() SSRC_DECL_THROW(std::runtime_error);
63 : :
64 : : ~SolarisEventPort();
65 : :
66 : : bool add(int fd, const events_type events, void *user_data, const bool once)
67 : : SSRC_DECL_THROW(std::runtime_error);
68 : :
69 : : bool remove(int fd) SSRC_DECL_THROW(std::runtime_error);
70 : :
71 : : int wait(event_type *events, int max_events, int timeout);
72 : : };
73 : :
74 : : }
75 : :
76 : : __END_NS_SSRC_WISP_SERVICE
77 : :
78 : : #endif
|
Copyright © 2010 Savarese Software Research Corporation. All rights reserved