YARP
Yet Another Robot Platform
RFModule.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_OS_RFMODULE_H
8#define YARP_OS_RFMODULE_H
9
10#include <yarp/os/Port.h>
12#include <yarp/os/RpcServer.h>
13
14namespace yarp::os {
15
20{
21public:
25 RFModule();
26
30 virtual ~RFModule();
31
39 virtual double getPeriod();
40
59 virtual bool updateModule() = 0;
60
83 virtual int runModule();
84
92 virtual int runModule(yarp::os::ResourceFinder& rf);
93
116 virtual int runModuleThreaded();
117
126 virtual int runModuleThreaded(yarp::os::ResourceFinder& rf);
127
131 virtual int getThreadKey();
132
148 virtual bool configure(yarp::os::ResourceFinder& rf);
149
161 virtual bool respond(const Bottle& command, Bottle& reply);
162
169 virtual bool attach(yarp::os::Port& source);
170
177 virtual bool attach(yarp::os::RpcServer& source);
178
187 bool attachTerminal();
188
192 bool detachTerminal();
193
206 virtual bool interruptModule();
207
218 virtual bool close();
219
229 void stopModule(bool wait = false);
230
236 bool isStopping();
237
251 bool joinModule(double seconds = -1);
252
267 std::string getName(const std::string& subName = "");
268
274 void setName(const char* name);
275
279 bool safeRespond(const Bottle& command, Bottle& reply);
280
281private:
282 ResourceFinder resourceFinder;
283 bool stopFlag;
285
286 virtual bool basicRespond(const Bottle& command, Bottle& reply);
287
288#ifndef DOXYGEN_SHOULD_SKIP_THIS
289private:
290 class Private;
291 Private* mPriv;
292#endif // DOXYGEN_SHOULD_SKIP_THIS
293};
294
295} // namespace yarp::os
296
297#endif // YARP_OS_RFMODULE_H
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:64
A mini-server for network communication.
Definition: Port.h:46
A base-class for standard YARP modules that supports ResourceFinder.
Definition: RFModule.h:20
virtual bool updateModule()=0
Override this to do whatever your module needs to do.
Helper class for finding config files and other external resources.
A port that is specialized as an RPC server.
Definition: RpcServer.h:23
An interface to the operating system, including Port based communication.
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:338
#define YARP_os_API
Definition: api.h:18