GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
DynamicLibrary.h
Go to the documentation of this file.
1#ifndef DYNAMICLIBRARY_H
2#define DYNAMICLIBRARY_H
3
4#include <string>
5
6/// Loads a Shared Object library
7/**
8 The be moved, but not copied.
9 When the object is destroyed, the library is closed.
10 The caller is responsible for keeping the object alive
11 while symbols from the object are being used.
12 */
14public:
15 /// Loads a shared object library.
16 /**
17 @param libname_param Path to the library to be loaded.
18 @param unique_name Generates a uniquely named symlink to the file, which is then opened.
19
20 dlopen/dlclose maintains a reference count,
21 caching shared objects in case a library is loaded multiple times.
22 However, if a library is going to change as the program runs,
23 then this caching works against us.
24 In this case, "unique_name" should be set to true.
25 */
26 explicit DynamicLibrary(std::string libname_param, bool unique_name = false);
27
28 /// Destructs the shared object library
29 /**
30 Closes the shared object library.
31 All symbols from the shared object library become invalid.
32 The caller is responsible for keeping the DynamicLibrary alive,
33 while symbols from the library are in use.
34 */
36
37 /// Move constructor
38 DynamicLibrary(DynamicLibrary&& other) noexcept;
39
40 /// Move assignment operator
41 DynamicLibrary& operator=(DynamicLibrary&& other) noexcept;
42
43#ifdef __CINT__
44private:
47
48public:
49#else
52#endif
53
54 /// Extracts a symbol from the shared library.
55 void* GetSymbol(const char* symbol);
56
57private:
58 void swap(DynamicLibrary& other);
59
60 void* fLibrary;
61 std::string fLibName;
62 std::string fTempName;
63};
64
65#endif /* _DYNAMICLIBRARY_H_ */
Loads a Shared Object library.
DynamicLibrary(std::string libname_param, bool unique_name=false)
Loads a shared object library.
~DynamicLibrary()
Destructs the shared object library.
DynamicLibrary & operator=(DynamicLibrary &&other) noexcept
Move assignment operator.
DynamicLibrary(const DynamicLibrary &)=delete
std::string fTempName
void * GetSymbol(const char *symbol)
Extracts a symbol from the shared library.
void swap(DynamicLibrary &other)
DynamicLibrary & operator=(const DynamicLibrary &)=delete
std::string fLibName