NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
INvSIPLDeviceInterfaceProvider.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 #ifndef NVSIPLDEVICEINTERFACEPROVIDERINTERFACE_HPP
13 #define NVSIPLDEVICEINTERFACEPROVIDERINTERFACE_HPP
14 
15 #include <cstring>
16 #include <cstdint>
24 namespace nvsipl
25 {
26 
28 class UUID
29 {
30 public:
32  uint32_t time_low;
34  uint16_t time_mid;
38  uint16_t clock_seq;
40  uint8_t node[6];
41 
59  constexpr UUID(uint32_t const low, uint16_t const mid,
60  uint16_t const high, uint16_t const seq,
61  uint8_t const n0, uint8_t const n1, uint8_t const n2,
62  uint8_t const n3, uint8_t const n4, uint8_t const n5)
63  : time_low(low)
64  , time_mid(mid)
65  , time_hi_and_version(high)
66  , clock_seq(seq)
67  , node{n0,n1,n2,n3,n4,n5}
68  { }
69 
71  UUID() : UUID(0U,0U,0U,0U,0U,0U,0U,0U,0U,0U)
72  { }
73 
75  friend bool operator==(const UUID &l, const UUID &r) noexcept
76  {
77  if (l.time_low != r.time_low){
78  return false;
79  } else if (l.time_mid != r.time_mid){
80  return false;
81  } else if (l.time_hi_and_version != r.time_hi_and_version){
82  return false;
83  } else if (l.clock_seq != r.clock_seq){
84  return false;
85  } else if (l.node[0] != r.node[0]){
86  return false;
87  } else if (l.node[1] != r.node[1]){
88  return false;
89  } else if (l.node[2] != r.node[2]){
90  return false;
91  } else if (l.node[3] != r.node[3]){
92  return false;
93  } else if (l.node[4] != r.node[4]){
94  return false;
95  } else if (l.node[5] != r.node[5]){
96  return false;
97  } else {
98  return true;
99  }
100  };
101 };
102 
103 static_assert(sizeof(UUID) ==
104  sizeof(uint32_t) +
105  sizeof(uint16_t) +
106  sizeof(uint16_t) +
107  sizeof(uint16_t) +
108  sizeof(uint8_t) * 6,
109  "Missing check in == operator as Structure shall not have padding");
110 
113 {
114 public:
116  NonCopyable() = default;
117 
119  NonCopyable(NonCopyable& other) = delete;
120 
122  NonCopyable& operator=(NonCopyable& other) & = delete;
123 
125  NonCopyable(NonCopyable&& other) = delete;
126 
128  NonCopyable& operator=(NonCopyable&& other) & = delete;
129 
130 protected:
132  ~NonCopyable() = default;
133 };
134 
141 class Interface : public NonCopyable
142 {
143 public:
148  virtual const UUID &getInstanceInterfaceID() const noexcept = 0;
149 
150 protected:
152  Interface() = default;
153 
155  Interface(Interface &) = delete;
156 
158  Interface(Interface &&) = delete;
159 
161  Interface& operator=(Interface &) & = delete;
162 
164  Interface& operator=(Interface &&) & = delete;
165 
167  ~Interface() = default;
168 };
169 
174 {
175 public:
210  virtual Interface* GetInterface(const UUID &interfaceId) = 0;
211 
212 protected:
214  IInterfaceProvider() = default;
215 
218 
221 
224 
227 
229  virtual ~IInterfaceProvider() = default;
230 };
231 
232 } // end of namespace nvsipl
233 #endif //NVSIPLDEVICEINTERFACEPROVIDERINTERFACE_HPP
nvsipl::UUID::time_hi_and_version
uint16_t time_hi_and_version
Member variable to store the third opaque field composing the UUID.
Definition: INvSIPLDeviceInterfaceProvider.hpp:36
nvsipl::UUID::time_mid
uint16_t time_mid
Member variable to store the second opaque field composing the UUID.
Definition: INvSIPLDeviceInterfaceProvider.hpp:34
nvsipl::UUID::UUID
UUID()
Construct for a new UUID object with default intialization values.
Definition: INvSIPLDeviceInterfaceProvider.hpp:71
nvsipl::IInterfaceProvider::IInterfaceProvider
IInterfaceProvider()=default
Default Constructor.
nvsipl::Interface::Interface
Interface()=default
Default Constructor.
nvsipl::Interface::~Interface
~Interface()=default
Default destructor for the class.
nvsipl::IInterfaceProvider::operator=
IInterfaceProvider & operator=(IInterfaceProvider &) &=delete
Delete copy assignment operator.
nvsipl::NonCopyable::operator=
NonCopyable & operator=(NonCopyable &other) &=delete
Delete copy assignment operator.
nvsipl::NonCopyable
A class to prevent drivers being copied and duplicating state.
Definition: INvSIPLDeviceInterfaceProvider.hpp:112
nvsipl::Interface::getInstanceInterfaceID
virtual const UUID & getInstanceInterfaceID() const noexcept=0
A call to get the ID from the instance of the class inheriting this interface.
nvsipl::UUID
A universally unique identifier.
Definition: INvSIPLDeviceInterfaceProvider.hpp:28
nvsipl::UUID::time_low
uint32_t time_low
Member variable to store the first opaque field composing the UUID.
Definition: INvSIPLDeviceInterfaceProvider.hpp:32
nvsipl::Interface
Top-level interface class implementable for a particular device.
Definition: INvSIPLDeviceInterfaceProvider.hpp:141
nvsipl::NonCopyable::~NonCopyable
~NonCopyable()=default
Default destructor.
nvsipl::Interface::operator=
Interface & operator=(Interface &) &=delete
Delete copy assignment operator.
nvsipl::IInterfaceProvider
Class providing access to device interfaces.
Definition: INvSIPLDeviceInterfaceProvider.hpp:173
nvsipl::IInterfaceProvider::GetInterface
virtual Interface * GetInterface(const UUID &interfaceId)=0
Get interface provided by this driver matching a provided ID.
nvsipl::UUID::UUID
constexpr UUID(uint32_t const low, uint16_t const mid, uint16_t const high, uint16_t const seq, uint8_t const n0, uint8_t const n1, uint8_t const n2, uint8_t const n3, uint8_t const n4, uint8_t const n5)
Constructs a new UUID object with parameter values.
Definition: INvSIPLDeviceInterfaceProvider.hpp:59
nvsipl
Contains the classes and variables for implementation of SIPL.
Definition: NvSIPLCamera.hpp:44
nvsipl::UUID::clock_seq
uint16_t clock_seq
Member variable to store the fourth opaque field composing the UUID.
Definition: INvSIPLDeviceInterfaceProvider.hpp:38
nvsipl::UUID::operator==
friend bool operator==(const UUID &l, const UUID &r) noexcept
comparison operator to compare contents of two SSID structures
Definition: INvSIPLDeviceInterfaceProvider.hpp:75
nvsipl::IInterfaceProvider::~IInterfaceProvider
virtual ~IInterfaceProvider()=default
Default destructor.
nvsipl::UUID::node
uint8_t node[6]
Member variable to store the fifth-tenth opaque field composing the UUID.
Definition: INvSIPLDeviceInterfaceProvider.hpp:40
nvsipl::NonCopyable::NonCopyable
NonCopyable()=default
Default Constructor.