Qpid Proton C++  0.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
reactor.hpp
1 #ifndef REACTOR_HPP
2 #define REACTOR_HPP
3 
4 /*
5  * Licensed to the Apache Software Foundation (ASF) under one
6  * or more contributor license agreements. See the NOTICE file
7  * distributed with this work for additional information
8  * regarding copyright ownership. The ASF licenses this file
9  * to you under the Apache License, Version 2.0 (the
10  * "License"); you may not use this file except in compliance
11  * with the License. You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing,
16  * software distributed under the License is distributed on an
17  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  * KIND, either express or implied. See the License for the
19  * specific language governing permissions and limitations
20  * under the License.
21  */
22 
25 
26 #include "proton/object.hpp"
27 #include "proton/duration.hpp"
28 
29 struct pn_reactor_t;
30 struct pn_io_t;
31 
32 namespace proton {
33 
34 class connection;
35 class container;
36 class acceptor;
37 class url;
38 class handler;
39 class task;
40 
41 class reactor : public object<pn_reactor_t> {
42  public:
43  reactor(pn_reactor_t* r = 0) : object<pn_reactor_t>(r) {}
44 
46  PN_CPP_EXTERN static reactor create();
47 
49  PN_CPP_EXTERN acceptor listen(const proton::url &);
50 
52  PN_CPP_EXTERN void run();
53 
55  PN_CPP_EXTERN void start();
56 
58  PN_CPP_EXTERN bool process();
59 
61  PN_CPP_EXTERN void stop();
62 
64  PN_CPP_EXTERN std::string id() const;
65 
67  PN_CPP_EXTERN duration timeout();
68 
70  PN_CPP_EXTERN void timeout(duration timeout);
71 
72  PN_CPP_EXTERN amqp_timestamp mark();
73  PN_CPP_EXTERN amqp_timestamp now();
74 
75  PN_CPP_EXTERN task schedule(int, pn_handler_t*);
76 
77  class connection connection(pn_handler_t*) const;
78 
79  pn_handler_t* pn_handler() const;
80 
81  void pn_handler(pn_handler_t* );
82 
83  pn_handler_t* pn_global_handler() const;
84 
85  void pn_global_handler(pn_handler_t* );
86 
87  pn_io_t* pn_io() const;
88 
89  PN_CPP_EXTERN void wakeup();
90  PN_CPP_EXTERN bool quiesced();
91  PN_CPP_EXTERN void yield();
92 
93  friend class container_impl;
94  friend class container_context;
95 };
96 
97 }
98 
100 
101 #endif // REACTOR_HPP
A proton URL.
Definition: url.hpp:51