YARP
Yet Another Robot Platform
Loading...
Searching...
No Matches
SharedLibraryFactory.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3
* SPDX-License-Identifier: BSD-3-Clause
4
*/
5
6
#ifndef YARP_OS_SHAREDLIBRARYFACTORY_H
7
#define YARP_OS_SHAREDLIBRARYFACTORY_H
8
9
#include <
yarp/os/api.h
>
10
11
#include <
yarp/os/SharedLibrary.h
>
12
#include <
yarp/os/SharedLibraryClassApi.h
>
13
#include <
yarp/os/Vocab.h
>
14
15
#include <string>
16
17
18
namespace
yarp::os
{
19
26
class
YARP_os_API
SharedLibraryFactory
27
{
28
public
:
38
enum
39
{
40
STATUS_NONE
,
41
STATUS_OK =
yarp::os::createVocab32
(
'o'
,
'k'
),
42
STATUS_LIBRARY_NOT_FOUND =
yarp::os::createVocab32
(
'f'
,
'o'
,
'u'
,
'n'
),
43
STATUS_LIBRARY_NOT_LOADED =
yarp::os::createVocab32
(
'l'
,
'o'
,
'a'
,
'd'
),
44
STATUS_FACTORY_NOT_FOUND =
yarp::os::createVocab32
(
'f'
,
'a'
,
'c'
,
't'
),
45
STATUS_FACTORY_NOT_FUNCTIONAL =
yarp::os::createVocab32
(
'r'
,
'u'
,
'n'
)
46
};
47
51
explicit
SharedLibraryFactory
();
52
59
SharedLibraryFactory
(
const
char
* dll_name,
60
const
char
* fn_name =
nullptr
);
61
65
virtual
~SharedLibraryFactory
();
66
74
bool
open(
const
char
* dll_name,
const
char
* fn_name =
nullptr
);
75
81
bool
isValid()
const
;
82
88
int
getStatus()
const
;
89
95
std::string getError()
const
;
96
102
const
SharedLibraryClassApi
& getApi()
const
;
103
109
int
getReferenceCount()
const
;
110
116
int
addRef();
117
123
int
removeRef();
124
130
std::string getName()
const
;
131
137
std::string getClassName()
const
;
138
144
std::string getBaseClassName()
const
;
145
155
bool
useFactoryFunction(
void
*
factory
);
156
157
private
:
158
SharedLibrary
lib;
159
int
status;
160
SharedLibraryClassApi
api;
161
int
returnValue;
162
int
rct;
// FIXME Remove this reference counter and use a shared_ptr instead.
163
YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG
(std::string) name;
164
YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG
(std::string) className;
165
YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG
(std::string) baseClassName;
166
YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG
(std::string)
error
;
167
};
168
169
}
// namespace yarp::os
170
171
#endif
// YARP_OS_SHAREDLIBRARYFACTORY_H
SharedLibraryClassApi.h
SharedLibrary.h
Severity::error
@ error
Vocab.h
yarp::os::SharedLibraryFactory
A wrapper for a named factory method in a named shared library.
Definition
SharedLibraryFactory.h:27
yarp::os::SharedLibraryFactory::STATUS_NONE
@ STATUS_NONE
Not configured yet.
Definition
SharedLibraryFactory.h:40
yarp::os::SharedLibraryFactory::~SharedLibraryFactory
virtual ~SharedLibraryFactory()
Destructor.
yarp::os::SharedLibrary
Low-level wrapper for loading shared libraries (DLLs) and accessing symbols within it.
Definition
SharedLibrary.h:26
factory
DumpObj * factory(Bottle &obj)
Definition
main.cpp:82
yarp::os
An interface to the operating system, including Port based communication.
Definition
AbstractCarrier.h:13
yarp::os::createVocab32
constexpr yarp::conf::vocab32_t createVocab32(char a, char b=0, char c=0, char d=0)
Create a vocab from chars.
Definition
Vocab.h:27
yarp::os::SharedLibraryClassApi
Collection of hooks for creating/destroying a plugin.
Definition
SharedLibraryClassApi.h:32
YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition
system.h:338
api.h
YARP_os_API
#define YARP_os_API
Definition
api.h:18
YARP
3.11.100+20250603.4+gitaa77f8b5c
src
libYARP_os
src
yarp
os
SharedLibraryFactory.h
Generated on Wed Jun 4 2025 02:40:12 for YARP by
1.9.8