Qpid Proton C++  0.12.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
reconnect_timer.hpp
1 #ifndef PROTON_CPP_RECONNECT_H
2 #define PROTON_CPP_RECONNECT_H
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 
27 
28 #include "proton/export.hpp"
29 #include "proton/types.hpp"
30 #include "proton/reactor.hpp"
31 #include <string>
32 
33 namespace proton {
34 
36 class reconnect_timer
37 {
38  public:
41  PN_CPP_EXTERN reconnect_timer(uint32_t first = 0, int32_t max = -1, uint32_t increment = 100,
42  bool doubling = true, int32_t max_retries = -1, int32_t timeout = -1);
43 
45  PN_CPP_EXTERN void reset();
46 
48  PN_CPP_EXTERN int next_delay();
49 
50  private:
51  int32_t first_delay_;
52  int32_t max_delay_;
53  int32_t increment_;
54  bool doubling_;
55  int32_t max_retries_;
56  int32_t timeout_;
57  int32_t retries_;
58  int32_t next_delay_;
59  pn_timestamp_t timeout_deadline_;
60  reactor reactor_;
61 
62  friend class connector;
63 };
64 
66 
67 }
68 
69 #endif // PROTON_CPP_RECONNECT_H
Defines C++ types representing AMQP types.