Ocean
system/usb/USB.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_SYSTEM_USB_USB_H
9 #define META_OCEAN_SYSTEM_USB_USB_H
10 
11 #include "ocean/system/System.h"
12 
14 
15 #include <libusb.h>
16 
17 namespace Ocean
18 {
19 
20 namespace System
21 {
22 
23 namespace USB
24 {
25 
26 /**
27  * @ingroup system
28  * @defgroup systemusb Ocean System USB Library
29  * @{
30  * The Ocean System USB Library provides access to USB functionalities.
31  * The library is platform independent.
32  * @}
33  */
34 
35 /**
36  * @namespace Ocean::System::USB Namespace of the System library USB.<p>
37  * The Namespace Ocean::System::USB is used in the entire Ocean System USB Library.
38  */
39 
40 // Defines OCEAN_SYSTEM_USB_EXPORT for dll export and import.
41 #if defined(_WINDOWS) && defined(OCEAN_RUNTIME_SHARED)
42  #ifdef USE_OCEAN_SYSTEM_USB_EXPORT
43  #define OCEAN_SYSTEM_USB_EXPORT __declspec(dllexport)
44  #else
45  #define OCEAN_SYSTEM_USB_EXPORT __declspec(dllimport)
46  #endif
47 #else
48  #define OCEAN_SYSTEM_USB_EXPORT
49 #endif
50 
51 /**
52  * Helper function to free a libusb transfer.
53  * @param libusbTransfer The transfer to be release
54  * @ingroup systemusb
55  */
56 OCEAN_SYSTEM_USB_EXPORT void releaseTransfer(libusb_transfer* libusbTransfer);
57 
58 /**
59  * Definition of a scoped libusb transfer object.
60  * @ingroup systemusb
61  */
63 
64 /**
65  * Definition of a vector holding scoped libusb transfer objects.
66  * @ingroup systemusb
67  */
68 using ScopedTransfers = std::vector<ScopedTransfer>;
69 
70 /**
71  * Definition of an unordered map mapping libusb transfer points to indices.
72  */
73 using TransferIndexMap = std::unordered_map<libusb_transfer*, size_t>;
74 
75 }
76 
77 }
78 
79 }
80 
81 #endif // META_OCEAN_SYSTEM_USB_USB_H
This class wraps an unmanaged object (or reference) which needs to be released after usage.
Definition: ScopedObject.h:166
std::vector< ScopedTransfer > ScopedTransfers
Definition of a vector holding scoped libusb transfer objects.
Definition: system/usb/USB.h:68
OCEAN_SYSTEM_USB_EXPORT void releaseTransfer(libusb_transfer *libusbTransfer)
Helper function to free a libusb transfer.
std::unordered_map< libusb_transfer *, size_t > TransferIndexMap
Definition of an unordered map mapping libusb transfer points to indices.
Definition: system/usb/USB.h:73
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15