summaryrefslogtreecommitdiff
path: root/implementation/service_discovery/src/subscription.cpp
blob: 19d115ca074787304cbf6b79a40a353c07c3a412 (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
// Copyright (C) 2014 BMW Group
// Author: Lutz Bichler (lutz.bichler@bmw.de)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include "../include/subscription.hpp"

namespace vsomeip {
namespace sd {

subscription::subscription(major_version_t _major, ttl_t _ttl,
                           std::shared_ptr<endpoint> _reliable,
                               std::shared_ptr<endpoint> _unreliable)
    : major_(_major),
      ttl_(_ttl),
      reliable_(_reliable),
      unreliable_(_unreliable),
      is_acknowledged_(false) {
}

subscription::~subscription() {
}

major_version_t subscription::get_major() const {
  return major_;
}

ttl_t subscription::get_ttl() const {
  return ttl_;
}

void subscription::set_ttl(ttl_t _ttl) {
  ttl_ = _ttl;
}

std::shared_ptr<endpoint> subscription::get_endpoint(bool _reliable) const {
  return (_reliable ? reliable_ : unreliable_);
}

void subscription::set_endpoint(std::shared_ptr<endpoint> _endpoint,
                                  bool _reliable) {
  if (_reliable)
    reliable_ = _endpoint;
  else
    unreliable_ = _endpoint;
}

bool subscription::is_acknowleged() const {
  return is_acknowledged_;
}

void subscription::set_acknowledged(bool _is_acknowledged) {
  is_acknowledged_ = _is_acknowledged;
}

} // namespace sd
} // namespace vsomeip