Honghai Zhang | cc411c0 | 2016-03-30 00:27:21 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 11 | #ifndef P2P_BASE_CANDIDATE_PAIR_INTERFACE_H_ |
| 12 | #define P2P_BASE_CANDIDATE_PAIR_INTERFACE_H_ |
Honghai Zhang | cc411c0 | 2016-03-30 00:27:21 | [diff] [blame] | 13 | |
| 14 | namespace cricket { |
| 15 | |
| 16 | class Candidate; |
| 17 | |
| 18 | class CandidatePairInterface { |
| 19 | public: |
| 20 | virtual ~CandidatePairInterface() {} |
| 21 | |
| 22 | virtual const Candidate& local_candidate() const = 0; |
| 23 | virtual const Candidate& remote_candidate() const = 0; |
Honghai Zhang | cc411c0 | 2016-03-30 00:27:21 | [diff] [blame] | 24 | }; |
| 25 | |
Harald Alvestrand | 9a953b2 | 2024-01-26 07:11:50 | [diff] [blame] | 26 | // Specific implementation of the interface, suitable for being a |
| 27 | // data member of other structs. |
| 28 | struct CandidatePair final : public CandidatePairInterface { |
| 29 | ~CandidatePair() override = default; |
| 30 | |
| 31 | const Candidate& local_candidate() const override { return local; } |
| 32 | const Candidate& remote_candidate() const override { return remote; } |
| 33 | |
| 34 | Candidate local; |
| 35 | Candidate remote; |
| 36 | }; |
| 37 | |
Honghai Zhang | cc411c0 | 2016-03-30 00:27:21 | [diff] [blame] | 38 | } // namespace cricket |
| 39 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 40 | #endif // P2P_BASE_CANDIDATE_PAIR_INTERFACE_H_ |