YARP
Yet Another Robot Platform
RFModule.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2018 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_RFMODULE_H
11 #define YARP_OS_RFMODULE_H
12 
13 #include <yarp/os/Port.h>
14 #include <yarp/os/ResourceFinder.h>
15 #include <yarp/os/RpcServer.h>
16 
17 namespace yarp {
18 namespace os {
19 
24 {
25 public:
29  RFModule();
30 
34  virtual ~RFModule();
35 
43  virtual double getPeriod();
44 
63  virtual bool updateModule() = 0;
64 
87  virtual int runModule();
88 
96  virtual int runModule(yarp::os::ResourceFinder& rf);
97 
120  virtual int runModuleThreaded();
121 
130  virtual int runModuleThreaded(yarp::os::ResourceFinder& rf);
131 
147  virtual bool configure(yarp::os::ResourceFinder& rf);
148 
160  virtual bool respond(const Bottle& command, Bottle& reply);
161 
168  virtual bool attach(yarp::os::Port& source);
169 
176  virtual bool attach(yarp::os::RpcServer& source);
177 
186  bool attachTerminal();
187 
191  bool detachTerminal();
192 
205  virtual bool interruptModule();
206 
217  virtual bool close();
218 
228  void stopModule(bool wait = false);
229 
235  bool isStopping();
236 
250  bool joinModule(double seconds = -1);
251 
266  std::string getName(const std::string& subName = "");
267 
273  void setName(const char* name);
274 
275 #ifndef DOXYGEN_SHOULD_SKIP_THIS
276 
279  bool safeRespond(const Bottle& command, Bottle& reply);
280 #endif /*DOXYGEN_SHOULD_SKIP_THIS*/
281 
282 private:
285  bool stopFlag;
287 
288  virtual bool basicRespond(const Bottle& command, Bottle& reply);
289 };
290 
291 } // namespace os
292 } // namespace yarp
293 
294 #endif // YARP_OS_RFMODULE_H
A port that is specialized as an RPC server.
Definition: RpcServer.h:26
A mini-server for network communication.
Definition: Port.h:49
#define YARP_OS_API
Definition: api.h:19
The main, catch-all namespace for YARP.
Definition: numeric.h:47
A simple collection of objects that can be described and transmitted in a portable way...
Definition: Bottle.h:72
ResourceFinder resourceFinder
Definition: RFModule.h:283
std::string name
Definition: RFModule.h:286
void * implementation
Definition: RFModule.h:284
A base-class for standard YARP modules that supports ResourceFinder.
Definition: RFModule.h:23
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:346
Helper class for finding config files and other external resources.