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>
15 #include <yarp/os/RpcServer.h>
16 #include <yarp/os/ResourceFinder.h>
17 
18 namespace yarp {
19  namespace os {
20  class RFModule;
21  }
22 }
23 
24 
28 class YARP_OS_API yarp::os::RFModule {
29 
30 public:
34  RFModule();
35 
39  virtual ~RFModule();
40 
48  virtual double getPeriod();
49 
68  virtual bool updateModule() = 0;
69 
92  virtual int runModule();
93 
101  virtual int runModule(yarp::os::ResourceFinder &rf);
102 
125  virtual int runModuleThreaded();
126 
135  virtual int runModuleThreaded(yarp::os::ResourceFinder &rf);
136 
152  virtual bool configure(yarp::os::ResourceFinder &rf);
153 
165  virtual bool respond(const Bottle& command, Bottle& reply);
166 
173  virtual bool attach(yarp::os::Port& source);
174 
181  virtual bool attach(yarp::os::RpcServer& source);
182 
191  bool attachTerminal();
192 
196  bool detachTerminal();
197 
210  virtual bool interruptModule();
211 
222  virtual bool close();
223 
233  void stopModule(bool wait = false);
234 
240  bool isStopping();
241 
255  bool joinModule(double seconds = -1);
256 
271  std::string getName(const std::string& subName = "");
272 
278  void setName(const char *name);
279 
280 #ifndef DOXYGEN_SHOULD_SKIP_THIS
281 
284  bool safeRespond(const Bottle& command, Bottle& reply);
285 #endif /*DOXYGEN_SHOULD_SKIP_THIS*/
286 
287 private:
290  bool stopFlag;
291  YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::string) name;
292 
293  virtual bool basicRespond(const Bottle& command, Bottle& reply);
294 };
295 
296 #endif // YARP_OS_RFMODULE_H
A port that is specialized as an RPC server.
Definition: RpcServer.h:29
A mini-server for network communication.
Definition: Port.h:50
The main, catch-all namespace for YARP.
A simple collection of objects that can be described and transmitted in a portable way...
Definition: Bottle.h:70
ResourceFinder resourceFinder
Definition: RFModule.h:288
virtual void close() override
Definition: TcpRosStream.h:99
void * implementation
Definition: RFModule.h:289
A base-class for standard Yarp modules that supports ResourceFinder.
Definition: RFModule.h:28
Helper class for finding config files and other external resources.