IDS peak genericC++  v1.6.0
peak_library.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 
13 
15 
21 namespace peak
22 {
23 
30 class Library final
31 {
32 public:
55  static void Initialize();
77  static void Close();
79 
89  static core::Version Version();
90 
91 private:
92  Library() = delete;
93  ~Library() = delete;
94  Library(const Library& other) = delete;
95  Library& operator=(const Library& other) = delete;
96  Library(Library&& other) = delete;
97  Library& operator=(Library&& other) = delete;
98 };
99 
100 } /* namespace peak */
101 
103 #include <peak/dll_interface/peak_dll_interface_util.hpp>
105 
106 
107 /* Implementation */
108 namespace peak
109 {
110  inline void Library::Initialize()
111  {
112  CallAndCheckCInterfaceFunction([] { return PEAK_C_ABI_PREFIX PEAK_Library_Initialize(); });
113 
114  DeviceManager::LifetimeTracker<>::Create();
115  }
116 
117  inline void Library::Close()
118  {
119  DeviceManager::LifetimeTracker<>::Destroy();
120 
121  CallAndCheckCInterfaceFunction([] { return PEAK_C_ABI_PREFIX PEAK_Library_Close(); });
122  }
123 
125  {
126  uint32_t versionMajor = QueryNumericFromCInterfaceFunction<uint32_t>(
128  uint32_t versionMinor = QueryNumericFromCInterfaceFunction<uint32_t>(
130  uint32_t versionSubminor = QueryNumericFromCInterfaceFunction<uint32_t>(
132 
133  return {versionMajor, versionMinor, versionSubminor};
134  }
135 } /* namespace peak */
Implements versioning functionality.
Definition: peak_version.hpp:33
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:124
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:110
A collection of global library functions.
Definition: peak_library.hpp:30
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 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.