YARP
Yet Another Robot Platform
LogForwarder.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_IMPL_LOGFORWARDER_H
7 #define YARP_OS_IMPL_LOGFORWARDER_H
8 
9 #include <yarp/os/api.h>
10 
11 #include <yarp/os/Port.h>
12 
13 #include <mutex>
14 #include <string>
15 
16 namespace yarp {
17 namespace os {
18 namespace impl {
19 
21 {
22 public:
24  static LogForwarder& getInstance();
25 
26  void forward(const std::string& message);
27  static void shutdown();
28 
29 private:
30  LogForwarder();
31  LogForwarder(LogForwarder const&) = delete;
32  LogForwarder& operator=(LogForwarder const&) = delete;
33 
34  std::mutex mutex;
35  yarp::os::Port outputPort;
36  static bool started;
37 };
38 
39 } // namespace impl
40 } // namespace os
41 } // namespace yarp
42 
43 #endif // YARP_OS_IMPL_LOGFORWARDER_H
A mini-server for network communication.
Definition: Port.h:47
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_os_impl_API
Definition: api.h:46