Debian Codegraph @

cpp/src/terminus.cpp

raw
1 /*
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 */
21
22 #include "proton/terminus.hpp"
23 #include "proton/duration.hpp"
24 #include "proton/types.hpp"
25 #include "proton/value.hpp"
26
27 #include "proton_bits.hpp"
28
29 namespace proton {
30
31 terminus::terminus(pn_terminus_t* t) :
32 object_(t), parent_(0)
33 {}
34
35 enum terminus::expiry_policy terminus::expiry_policy() const {
36 return (enum expiry_policy)pn_terminus_get_expiry_policy(object_);
37 }
38
39 duration terminus::timeout() const {
40 return duration::SECOND * pn_terminus_get_timeout(object_);
41 }
42
43 enum terminus::durability_mode terminus::durability_mode() {
44 return (enum durability_mode) pn_terminus_get_durability(object_);
45 }
46
47 bool terminus::dynamic() const {
48 return pn_terminus_is_dynamic(object_);
49 }
50
51 bool terminus::anonymous() const {
52 return pn_terminus_get_address(object_) == NULL;
53 }
54
55 value terminus::node_properties() const {
56 return value(pn_terminus_properties(object_));
57 }
58
59 std::vector<symbol> terminus::capabilities() const {
60 value caps(pn_terminus_capabilities(object_));
61 return caps.empty() ? std::vector<symbol>() : caps.get<std::vector<symbol> >();
62 }
63
64 terminus::dynamic_property_map terminus::dynamic_properties() const {
65 value props(pn_terminus_properties(object_));
66 dynamic_property_map properties;
67 if (!props.empty()) {
68 properties.value(props);
69 }
70 return properties;
71 }
72 }