Agora RTC Objective-C API Reference Refactor

AgoraExtensionVersion.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2021 Agora.io. All rights reserved
3
4 // This program is confidential and proprietary to Agora.io.
5 // And may not be copied, reproduced, modified, disclosed to others, published
6 // or used, in whole or in part, without the express prior written permission
7 // of Agora.io.
8
9 #pragma once
10
11 namespace agora {
12 namespace rtc {
13
14 struct ExtensionVersion {
15 // Extension Framework Version : major.minor.micro
16 int major_v;
17 int minor_v;
18 int micro_v;
19
20 ExtensionVersion()
21 : major_v(0), minor_v(0), micro_v(0) {}
22 ExtensionVersion(int majorV, int minorV = 0, int microV = 0)
23 : major_v(majorV), minor_v(minorV), micro_v(microV) {}
24
25 bool operator==(const ExtensionVersion& other) const {
26 return major_v == other.major_v && minor_v == other.minor_v && micro_v == other.micro_v;
27 }
28
29 bool operator>(const ExtensionVersion& other) const {
30 return major_v > other.major_v || (major_v == other.major_v && minor_v > other.minor_v)
31 || (major_v == other.major_v && minor_v == other.minor_v && micro_v > other.micro_v);
32 }
33
34 bool operator<(const ExtensionVersion& other) const {
35 return major_v < other.major_v || (major_v == other.major_v && minor_v < other.minor_v)
36 || (major_v == other.major_v && minor_v == other.minor_v && micro_v < other.micro_v);
37 }
38
39 bool operator<=(const ExtensionVersion& other) const {
40 return !operator>(other);
41 }
42
43 bool operator>=(const ExtensionVersion& other) const {
44 return !operator<(other);
45 }
46 };
47
48 #define BUMP_MAJOR_VERSION(VERSION) \
49 ExtensionVersion(VERSION.major_v + 1, 0, 0); \
50
51 #define BUMP_MINOR_VERSION(VERSION) \
52 ExtensionVersion(VERSION.major_v, VERSION.minor_v + 1, 0); \
53
54 #define BUMP_MICRO_VERSION(VERSION) \
55 ExtensionVersion(VERSION.major_v, VERSION.minor_v, VERSION.micro_v + 1); \
56
57 class IExtensionProvider;
58 class IExtensionProviderV2;
59 class IExtensionProviderV3;
60 class IAudioFilter;
61 class IExtensionVideoFilter;
62 class IScreenCaptureSource;
63
64 template <class T>
65 struct ExtensionInterfaceVersion;
66
67 template <>
68 struct ExtensionInterfaceVersion<IExtensionProvider> {
69 static ExtensionVersion Version() {
70 return ExtensionVersion(1, 0, 0);
71 }
72 };
73
74 template <>
75 struct ExtensionInterfaceVersion<IExtensionProviderV2> {
76 static ExtensionVersion Version() {
77 return BUMP_MAJOR_VERSION(ExtensionInterfaceVersion<IExtensionProvider>::Version());
78 }
79 };
80
81 template <>
82 struct ExtensionInterfaceVersion<IAudioFilter> {
83 static ExtensionVersion Version() {
84 return ExtensionVersion(1, 0, 0);
85 }
86 };
87
88 template <>
89 struct ExtensionInterfaceVersion<IExtensionVideoFilter> {
90 static ExtensionVersion Version() {
91 return ExtensionVersion(1, 0, 0);
92 }
93 };
94
95 template <>
96 struct ExtensionInterfaceVersion<IScreenCaptureSource> {
97 static ExtensionVersion Version() {
98 return ExtensionVersion(1, 0, 0);
99 }
100 };
101
102 } // namespace rtc
103 } // namespace agora
agora::rtc::ExtensionInterfaceVersion< IExtensionProvider >::Version
static ExtensionVersion Version()
Definition: AgoraExtensionVersion.h:69
agora::rtc::ExtensionVersion::ExtensionVersion
ExtensionVersion()
Definition: AgoraExtensionVersion.h:20
agora::rtc::ExtensionInterfaceVersion< IExtensionProviderV2 >::Version
static ExtensionVersion Version()
Definition: AgoraExtensionVersion.h:76
agora::rtc::ExtensionVersion
Definition: AgoraExtensionVersion.h:14
agora::rtc::ExtensionVersion::operator>=
bool operator>=(const ExtensionVersion &other) const
Definition: AgoraExtensionVersion.h:43
agora::rtc::ExtensionInterfaceVersion< IExtensionVideoFilter >::Version
static ExtensionVersion Version()
Definition: AgoraExtensionVersion.h:90
agora::rtc::ExtensionVersion::micro_v
int micro_v
Definition: AgoraExtensionVersion.h:18
agora::rtc::ExtensionVersion::major_v
int major_v
Definition: AgoraExtensionVersion.h:16
agora::rtc::IExtensionProviderV2
Definition: NGIAgoraExtensionProvider.h:116
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::IAudioFilter
Definition: NGIAgoraMediaNode.h:71
agora::rtc::ExtensionVersion::operator>
bool operator>(const ExtensionVersion &other) const
Definition: AgoraExtensionVersion.h:29
agora::rtc::ExtensionInterfaceVersion< IAudioFilter >::Version
static ExtensionVersion Version()
Definition: AgoraExtensionVersion.h:83
agora::rtc::ExtensionVersion::minor_v
int minor_v
Definition: AgoraExtensionVersion.h:17
agora::rtc::ExtensionVersion::operator<=
bool operator<=(const ExtensionVersion &other) const
Definition: AgoraExtensionVersion.h:39
agora::rtc::ExtensionVersion::operator<
bool operator<(const ExtensionVersion &other) const
Definition: AgoraExtensionVersion.h:34
agora::rtc::IExtensionProvider
Definition: NGIAgoraExtensionProvider.h:35
agora::rtc::ExtensionVersion::operator==
bool operator==(const ExtensionVersion &other) const
Definition: AgoraExtensionVersion.h:25
agora::rtc::IScreenCaptureSource
Definition: NGIAgoraExtensionScreenSource.h:41
agora::rtc::IExtensionVideoFilter
Definition: NGIAgoraMediaNode.h:246
agora::rtc::ExtensionInterfaceVersion
Definition: AgoraExtensionVersion.h:65
agora::rtc::ExtensionInterfaceVersion< IScreenCaptureSource >::Version
static ExtensionVersion Version()
Definition: AgoraExtensionVersion.h:97
BUMP_MAJOR_VERSION
#define BUMP_MAJOR_VERSION(VERSION)
Definition: AgoraExtensionVersion.h:48
agora::rtc::ExtensionVersion::ExtensionVersion
ExtensionVersion(int majorV, int minorV=0, int microV=0)
Definition: AgoraExtensionVersion.h:22