IDS peak genericC++  v1.4.2
peak_library.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 
13 
15 
16 
22 namespace peak
23 {
24 
31 class Library final
32 {
33 public:
56  static void Initialize();
78  static void Close();
80 
90  static core::Version Version();
91 
92 private:
93  Library() = delete;
94  ~Library() = delete;
95  Library(const Library& other) = delete;
96  Library& operator=(const Library& other) = delete;
97  Library(Library&& other) = delete;
98  Library& operator=(Library&& other) = delete;
99 };
100 
101 } /* namespace peak */
102 
104 #include <peak/dll_interface/peak_dll_interface_util.hpp>
106 
107 
108 /* Implementation */
109 namespace peak
110 {
111 
112 inline void Library::Initialize()
113 {
114  CallAndCheckCInterfaceFunction([] { return PEAK_C_ABI_PREFIX PEAK_Library_Initialize(); });
115 }
116 
117 inline void Library::Close()
118 {
119  auto& deviceManager = DeviceManager::Instance();
120  CallAndCheckCInterfaceFunction([] { return PEAK_C_ABI_PREFIX PEAK_Library_Close(); });
121 
122  if (QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([](PEAK_BOOL8* isInitialized) {
123  return PEAK_C_ABI_PREFIX PEAK_Library_IsInitialized(isInitialized);
124  })
125  == 0)
126  {
128  }
129 }
130 
132 {
133  uint32_t versionMajor = QueryNumericFromCInterfaceFunction<uint32_t>(
135  uint32_t versionMinor = QueryNumericFromCInterfaceFunction<uint32_t>(
137  uint32_t versionSubminor = QueryNumericFromCInterfaceFunction<uint32_t>(
139 
140  return core::Version(versionMajor, versionMinor, versionSubminor);
141 }
142 
143 } /* namespace peak */
Implements versioning functionality.
Definition: peak_version.hpp:33
int8_t PEAK_BOOL8
Definition: peak_backend.h:26
PEAK_C_API PEAK_Library_Close()
Closes the IDS peak API library and cleans up any resources that are still in use.
static core::Version Version()
Returns the library version.
Definition: peak_library.hpp:131
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition: peak_dynamic_loader.h:32
static void Initialize()
Initializes the IDS peak API library.
Definition: peak_library.hpp:112
A collection of global library functions.
Definition: peak_library.hpp:31
PEAK_C_API PEAK_Library_IsInitialized(PEAK_BOOL8 *isInitialized)
Checks if the IDS peak API library is initialized.
PEAK_C_API PEAK_Library_GetVersionSubminor(uint32_t *libraryVersionSubminor)
Asks for the subminor component of the library version.
PEAK_C_API PEAK_Library_GetVersionMinor(uint32_t *libraryVersionMinor)
Asks for the minor component of the library version.
#define PEAK_C_ABI_PREFIX
Definition: peak_dll_defines.h:16
static DeviceManager & Instance()
Returns the global DeviceManager.
Definition: peak_device_manager.hpp:489
static void Close()
Closes the IDS peak API library and cleans up any resources that are still in use.
Definition: peak_library.hpp:117
PEAK_C_API PEAK_Library_GetVersionMajor(uint32_t *libraryVersionMajor)
Asks for the major component of the library version.
PEAK_C_API PEAK_Library_Initialize()
Initializes the IDS peak API library.