YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ImplementRemoteVariables.cpp
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
9
10#include <cstdio>
11using namespace yarp::dev;
12
13namespace {
14YARP_LOG_COMPONENT(IMPLEMENT_LAYER_COMPONENT, "yarp.ImplementRemoteVariables")
15}
16
18// Encoder Interface Timed Implementation
24
29
30bool ImplementRemoteVariables::initialize(int size, const int *amap)
31{
32 if (m_helper != nullptr) {
33 return false;
34 }
35
36 m_helper=(void *)(new ControlBoardHelper(size, amap));
37 yAssert (m_helper != nullptr);
38
39 m_buffer_ints.resize (size);
40 m_buffer_doubles.resize(size);
41
42 return true;
43}
44
50{
51 if (m_helper!=nullptr)
52 {
53 delete castToMapper(m_helper);
54 m_helper=nullptr;
55 }
56
57 return true;
58}
59
61{
62 std::lock_guard lock(m_imp_mutex);
63
64 ReturnValue ret;
65 ret = m_iraw->getRemoteVariableRaw(key, val);
66 return ret;
67}
68
70{
71 std::lock_guard lock(m_imp_mutex);
72
73 ReturnValue ret;
74 ret = m_iraw->setRemoteVariableRaw(key, val);
75 return ret;
76}
77
79{
80 std::lock_guard lock(m_imp_mutex);
81 POINTERCHECK(IMPLEMENT_LAYER_COMPONENT,listOfKeys);
82
83 ReturnValue ret;
84 ret = m_iraw->getRemoteVariablesListRaw(listOfKeys);
85 return ret;
86}
yarp::dev::ControlBoardHelper * castToMapper(void *p)
#define yAssert(x)
Definition Log.h:388
IRemoteVariablesRaw interface.
virtual yarp::dev::ReturnValue getRemoteVariablesListRaw(yarp::os::Bottle *listOfKeys)=0
virtual yarp::dev::ReturnValue setRemoteVariableRaw(std::string key, const yarp::os::Bottle &val)=0
virtual yarp::dev::ReturnValue getRemoteVariableRaw(std::string key, yarp::os::Bottle &val)=0
yarp::dev::ReturnValue setRemoteVariable(std::string key, const yarp::os::Bottle &val) override
ImplementRemoteVariables(yarp::dev::IRemoteVariablesRaw *y)
bool initialize(int size, const int *amap)
Initialize the internal data and alloc memory.
yarp::dev::ReturnValue getRemoteVariablesList(yarp::os::Bottle *listOfKeys) override
bool uninitialize()
Clean up internal data and memory.
yarp::dev::ReturnValue getRemoteVariable(std::string key, yarp::os::Bottle &val) override
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:65
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.