YARP
Yet Another Robot Platform
yarpbroker.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_MANAGER_YARPBROKER
7 #define YARP_MANAGER_YARPBROKER
8 
9 #include <string>
10 #include <iostream>
11 #include <yarp/os/Time.h>
12 #include <yarp/os/Port.h>
13 #include <yarp/os/BufferedPort.h>
14 #include <yarp/os/Network.h>
15 #include <yarp/os/Property.h>
16 #include <string>
17 #include <yarp/os/Semaphore.h>
18 #include <yarp/os/PeriodicThread.h>
19 
20 // FIXME Do not use yarp/os/impl in .h files
21 #include <yarp/os/SystemInfo.h>
23 
24 #include <yarp/manager/broker.h>
26 
27 namespace yarp {
28 namespace manager {
29 
30 
35 
36 public:
37  YarpBroker();
38  ~YarpBroker() override;
39  bool init() override;
40  bool init(const char* szcmd, const char* szparam,
41  const char* szhost, const char* szstdio,
42  const char* szworkdir, const char* szenv ) override;
43  void fini() override;
44  bool start() override;
45  bool stop() override;
46  bool kill() override;
47  bool connect(const char* from, const char* to,
48  const char* carrier, bool persist=false) override;
49  bool disconnect(const char* from, const char* to, const char* carrier) override;
50  bool rmconnect(const char* from, const char* to);
51  int running() override;
52  bool exists(const char* port) override;
53  const char* requestRpc(const char* szport, const char* request, double timeout) override;
54  bool connected(const char* from, const char* to, const char* carrier) override;
55  const char* error() override;
56  bool initialized() override { return bInitialized;}
57  bool attachStdout() override;
58  void detachStdout() override;
59 
60  bool getSystemInfo(const char* server,
62  bool getAllProcesses(const char* server,
63  ProcessContainer &processes);
64  bool getAllPorts(std::vector<std::string> &stingList);
65 
66  bool setQos(const char* from, const char* to,
67  const char* qosFrom, const char* qosTo);
68 
69 public: // for rate thread
70  void run() override;
71  bool threadInit() override;
72  void threadRelease() override;
73 
74 protected:
75 
76 private:
77  std::string strCmd;
78  std::string strParam;
79  std::string strHost;
80  std::string strStdio;
81  std::string strWorkdir;
82  std::string strTag;
83  std::string strEnv;
84  unsigned int ID;
85  yarp::os::Property command;
86  std::string strError;
87  bool bOnlyConnector;
88  bool bInitialized;
89  yarp::os::Semaphore semParam;
90  std::string strStdioUUID;
91  std::string __trace_message;
92 
94  //yarp::os::Port port;
95 
96  bool timeout(double base, double timeout);
97  yarp::os::Property& runProperty();
98  int requestServer(yarp::os::Property& config);
99  int SendMsg(yarp::os::Bottle& msg, std::string target,
100  yarp::os::Bottle& resp, float fTimeout=5.0);
101  bool getQosFromString(const char* qos, yarp::os::QosStyle& style);
102 
103 };
104 
105 } // namespace yarp
106 } // namespace manager
107 
108 
109 #endif // __YARP_MANAGER_YARPBROKER__
Class Broker.
Definition: broker.h:31
void threadRelease() override
Release method.
Definition: yarpbroker.cpp:861
const char * error() override
Definition: yarpbroker.cpp:807
bool connected(const char *from, const char *to, const char *carrier) override
Definition: yarpbroker.cpp:579
bool getAllPorts(std::vector< std::string > &stingList)
Definition: yarpbroker.cpp:651
const char * requestRpc(const char *szport, const char *request, double timeout) override
Definition: yarpbroker.cpp:532
bool init() override
Definition: yarpbroker.cpp:61
bool getSystemInfo(const char *server, yarp::os::SystemInfoSerializer &info)
Definition: yarpbroker.cpp:591
bool getAllProcesses(const char *server, ProcessContainer &processes)
Definition: yarpbroker.cpp:684
void detachStdout() override
Definition: yarpbroker.cpp:382
bool connect(const char *from, const char *to, const char *carrier, bool persist=false) override
connection broker
Definition: yarpbroker.cpp:411
void fini() override
Definition: yarpbroker.cpp:53
bool initialized() override
Definition: yarpbroker.h:56
bool rmconnect(const char *from, const char *to)
Definition: yarpbroker.cpp:732
bool threadInit() override
Initialization method.
Definition: yarpbroker.cpp:822
bool setQos(const char *from, const char *to, const char *qosFrom, const char *qosTo)
Definition: yarpbroker.cpp:746
bool disconnect(const char *from, const char *to, const char *carrier) override
Definition: yarpbroker.cpp:474
void run() override
Loop function.
Definition: yarpbroker.cpp:849
bool attachStdout() override
Definition: yarpbroker.cpp:377
bool exists(const char *port) override
Definition: yarpbroker.cpp:524
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:74
An abstraction for a periodic thread.
A class for storing options and configuration information.
Definition: Property.h:34
Preferences for the port's Quality of Service.
Definition: QosStyle.h:24
A class for thread synchronization and mutual exclusion.
Definition: Semaphore.h:26
A helper class to pass the SystemInfo object around the YARP network.
std::vector< Process > ProcessContainer
Definition: primresource.h:169
The main, catch-all namespace for YARP.
Definition: dirs.h:16