YARP
Yet Another Robot Platform
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 
8 
9 #include <cstdio>
10 using namespace yarp::dev;
11 
13 // Encoder Interface Timed Implementation
15 {
16  ivar=y;
17  helper = nullptr;
18  temp1=nullptr;
19  temp2=nullptr;
20 }
21 
23 {
24  uninitialize();
25 }
26 
27 bool ImplementRemoteVariables::initialize(int size, const int *amap)
28 {
29  if (helper != nullptr) {
30  return false;
31  }
32 
33  helper=(void *)(new ControlBoardHelper(size, amap));
34  yAssert (helper != nullptr);
35  temp1=new double [size];
36  yAssert (temp1 != nullptr);
37  temp2=new double [size];
38  yAssert (temp2 != nullptr);
39  return true;
40 }
41 
47 {
48  if (helper!=nullptr)
49  {
50  delete castToMapper(helper);
51  helper=nullptr;
52  }
53 
56 
57  return true;
58 }
59 
61 {
62  bool ret;
63  ret = ivar->getRemoteVariableRaw(key, val);
64  return ret;
65 }
66 
68 {
69  bool ret;
70  ret = ivar->setRemoteVariableRaw(key, val);
71  return ret;
72 }
73 
74 
76 {
77  bool ret;
78  ret = ivar->getRemoteVariablesListRaw(listOfKeys);
79  return ret;
80 }
void checkAndDestroy(T *&p)
yarp::dev::ControlBoardHelper * castToMapper(void *p)
bool ret
#define yAssert(x)
Definition: Log.h:294
IRemoteVariablesRaw interface.
virtual bool getRemoteVariableRaw(std::string key, yarp::os::Bottle &val)=0
virtual bool getRemoteVariablesListRaw(yarp::os::Bottle *listOfKeys)=0
virtual bool setRemoteVariableRaw(std::string key, const yarp::os::Bottle &val)=0
bool setRemoteVariable(std::string key, const yarp::os::Bottle &val) override
ImplementRemoteVariables(yarp::dev::IRemoteVariablesRaw *y)
bool getRemoteVariablesList(yarp::os::Bottle *listOfKeys) override
bool getRemoteVariable(std::string key, yarp::os::Bottle &val) override
bool initialize(int size, const int *amap)
Initialize the internal data and alloc memory.
bool uninitialize()
Clean up internal data and memory.
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:74
An interface for the device drivers.