RobotTestingFramework  2.0.1
Robot Testing Framework
SharedLibrary.h
Go to the documentation of this file.
1 /*
2  * Robot Testing Framework
3  *
4  * Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 
22 #ifndef ROBOTTESTINGFRAMEWORK_SHAREDLIBRARY_H
23 #define ROBOTTESTINGFRAMEWORK_SHAREDLIBRARY_H
24 
25 #include <string>
26 
27 namespace shlibpp {
28 class SharedLibrary;
29 }
30 
36 {
37 public:
41  SharedLibrary();
42 
48  SharedLibrary(const char* filename);
49 
53  virtual ~SharedLibrary();
54 
64  bool open(const char* filename);
65 
70  bool close();
71 
78  std::string error();
79 
83  void* getSymbol(const char* symbolName);
84 
90  bool isValid() const;
91 
92 private:
94  std::string err_message;
95  SharedLibrary(const SharedLibrary&); // Not implemented
96  SharedLibrary& operator=(const SharedLibrary&); // Not implemented
97 };
98 
99 #endif // ROBOTTESTINGFRAMEWORK_SHAREDLIBRARY_H
SharedLibrary & operator=(const SharedLibrary &)
void * getSymbol(const char *symbolName)
Look up a symbol in the shared library.
Low-level wrapper for loading shared libraries (DLLs) and accessing symbols within it...
Definition: SharedLibrary.h:35
bool close()
Shared library no longer needed, unload if not in use elsewhere.
bool open(const char *filename)
Load the named shared library / DLL.
SharedLibrary()
Initialize, without opening a shared library yet.
std::string error()
Returns a human-readable string describing the most recent error that occurred from a call to one of ...
bool isValid() const
Check if the shared library is valid.
virtual ~SharedLibrary()
Destructor.