iCub-main
Loading...
Searching...
No Matches
LoggerInterfaces.h
Go to the documentation of this file.
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3/*
4 * Copyright (C) 2010 RobotCub Consortium, European Commission FP6 Project IST-004370
5 * Authors: Lorenzo Natale
6 * website: www.robotcub.org
7 * Permission is granted to copy, distribute, and/or modify this program
8 * under the terms of the GNU General Public License, version 2 or any
9 * later version published by the Free Software Foundation.
10 *
11 * A copy of the license can be found at
12 * http://www.robotcub.org/icub/license/gpl.txt
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17 * Public License for more details
18 */
19
25#ifndef __LOGGERINTERFACES__
26#define __LOGGERINTERFACES__
27
28#include <mutex>
29#include <yarp/os/Value.h>
30#include <yarp/dev/DeviceDriver.h>
31
32namespace yarp{
33 namespace dev {
34 class IClientLogger;
35 class IServerLogger;
36 //class LoggerDataRef;
37 }
38}
39
40#ifdef notdef
49class yarp::dev::LoggerDataRef
50{
51public:
58 LoggerDataRef(yarp::os::Value* data,bool *flag)
59 : pData(data),pFlag(flag),pMutex(NULL)
60 {
61 }
62
66 virtual ~LoggerDataRef(){}
67
72 void setMutex(std::mutex* pMtx)
73 {
74 pMutex=pMtx;
75 }
76
84 void write(const yarp::os::Value &data)
85 {
86 if (pMutex) pMutex->lock();
87 if (*pData!=data)
88 {
89 *pData=yarp::os::Value(data);
90 *pFlag=true;
91 }
92 if (pMutex) pMutex->unlock();
93 }
94
95protected:
96 std::mutex* pMutex;
97 yarp::os::Value* pData;
98 bool* pFlag;
99};
100#endif
101
108{
109public:
115 //virtual LoggerDataRef* getDataReference(const std::string &key)=0;
116
124 virtual bool log(const std::string &key,const yarp::os::Value &data)=0;
125
132 virtual bool log(const yarp::os::Bottle &data)=0;
133};
134
141{
142public:
143 /*
144 * Set data logger server.
145 * @param server is a pointer to a server implementing IServerLogger interface.
146 */
147 virtual void setServerLogger(const IServerLogger *server)=0;
148};
149
150#endif
@ data
Interface for a client that logs status messages to a server.
virtual void setServerLogger(const IServerLogger *server)=0
Interface for a server that logs status messages.
virtual bool log(const std::string &key, const yarp::os::Value &data)=0
Get a reference to log server data.
virtual bool log(const yarp::os::Bottle &data)=0
Log data to server.
bool write(const std::string filename, const FullRegulation &reg)
Copyright (C) 2008 RobotCub Consortium.