YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
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>
16
18#include <list>
19
20namespace yarp::os::impl {
21
23{
24 std::mutex mut;
26 std::list<yarp::os::Bottle> messages;
27
28 void process();
29
30public:
31 void run() override;
33 void insert(const yarp::os::Bottle& bot);
34 void terminate();
35public:
37 ~ThreadedPort() override;
38};
39
40//----------------------------------------------------------------
41
43{
44public:
46 static LogForwarder& getInstance();
47
48 void forward(const std::string& message);
49 std::string getLogPortName();
50 static void shutdown();
51
52private:
54 LogForwarder(LogForwarder const&) = delete;
55 LogForwarder& operator=(LogForwarder const&) = delete;
56
57 ThreadedPort tport;
59 static bool started;
60};
61
62} // namespace yarp::os::impl
63
64#endif // YARP_OS_IMPL_LOGFORWARDER_H
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
A mini-server for performing network communication in the background.
An abstraction for a periodic thread.
void run() override
Loop function.
void attach(yarp::os::BufferedPort< yarp::os::Bottle > *port)
void insert(const yarp::os::Bottle &bot)
The components from which ports and connections are built.
#define YARP_os_impl_API
Definition api.h:46