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>
13
14#include <mutex>
15#include <string>
17
19#include <list>
20
21namespace yarp::os::impl {
22
24{
25 std::mutex mut;
27 std::list<yarp::os::Bottle> messages;
28
29 void process();
30
31public:
32 void run() override;
34 void insert(const yarp::os::Bottle& bot);
35 void terminate();
36public:
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:65
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