RobotTestingFramework 2.0.1
Robot Testing Framework
Loading...
Searching...
No Matches
SharedLibraryFactory.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_SHAREDLIBRARYFACTORY_H
23#define ROBOTTESTINGFRAMEWORK_SHAREDLIBRARYFACTORY_H
24
28
29#include <string>
30
31
32namespace shlibpp {
33class SharedLibraryFactory;
34}
35
43{
44public:
54 enum
55 {
57 STATUS_OK = VOCAB('o', 'k'),
58 STATUS_LIBRARY_NOT_FOUND = VOCAB('f', 'o', 'u', 'n'),
59 STATUS_LIBRARY_NOT_LOADED = VOCAB('l', 'o', 'a', 'd'),
60 STATUS_FACTORY_NOT_FOUND = VOCAB('f', 'a', 'c', 't'),
61 STATUS_FACTORY_NOT_FUNCTIONAL = VOCAB('r', 'u', 'n')
62 };
63
68
75 SharedLibraryFactory(const char* dll_name,
76 const char* fn_name = nullptr);
77
82
90 bool open(const char* dll_name, const char* fn_name = nullptr);
91
97 bool isValid() const;
98
104 int getStatus() const;
105
111 std::string getError() const;
112
120
126 int getReferenceCount() const;
127
133 int addRef();
134
141
147 std::string getName() const;
148
154 std::string getClassName() const;
155
161 std::string getBaseClassName() const;
162
172 bool useFactoryFunction(void* factory);
173
174private:
179 int rct;
180 std::string name;
181 std::string className;
182 std::string baseClassName;
183 std::string error;
184};
185
186
187#endif // ROBOTTESTINGFRAMEWORK_SHAREDLIBRARYFACTORY_H
A wrapper for a named factory method in a named shared library.
bool open(const char *dll_name, const char *fn_name=nullptr)
Configure the factory.
bool useFactoryFunction(void *factory)
Specify function to use as factory.
int addRef()
Increment the reference count of this factory.
SharedLibraryFactory(const char *dll_name, const char *fn_name=nullptr)
Constructor.
bool isValid() const
Check if factory is configured and present.
virtual ~SharedLibraryFactory()
Destructor.
std::string getName() const
Get the name associated with this factory.
int getStatus() const
Get the status of the factory.
std::string getClassName() const
Get the type associated with this factory.
std::string getError() const
Get the latest error of the factory.
int removeRef()
Decrement the reference count of this factory.
@ STATUS_LIBRARY_NOT_LOADED
Named shared library failed to load.
@ STATUS_FACTORY_NOT_FOUND
Named method wasn't present in library.
@ STATUS_LIBRARY_NOT_FOUND
Named shared library was not found.
@ STATUS_FACTORY_NOT_FUNCTIONAL
Named method is not working right.
std::string getBaseClassName() const
Get the base type associated with this factory.
SharedLibraryFactory()
Constructor for unconfigured factory.
int getReferenceCount() const
Get the current reference count of this factory.
const SharedLibraryClassApi & getApi() const
Get the factory API, which has creation/deletion methods.
Low-level wrapper for loading shared libraries (DLLs) and accessing symbols within it.
constexpr int32_t VOCAB(char a, char b=0, char c=0, char d=0)
Definition Vocab.h:31
Collection of hooks for creating/destroying a plugin.