YARP
Yet Another Robot Platform
ImplementRemoteVariables.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
11 
12 #include <cstdio>
13 using namespace yarp::dev;
14 
16 // Encoder Interface Timed Implementation
18 {
19  ivar=y;
20  helper = nullptr;
21  temp1=nullptr;
22  temp2=nullptr;
23 }
24 
26 {
27  uninitialize();
28 }
29 
30 bool ImplementRemoteVariables::initialize(int size, const int *amap)
31 {
32  if (helper!=nullptr)
33  return false;
34 
35  helper=(void *)(new ControlBoardHelper(size, amap));
36  yAssert (helper != nullptr);
37  temp1=new double [size];
38  yAssert (temp1 != nullptr);
39  temp2=new double [size];
40  yAssert (temp2 != nullptr);
41  return true;
42 }
43 
49 {
50  if (helper!=nullptr)
51  {
52  delete castToMapper(helper);
53  helper=nullptr;
54  }
55 
58 
59  return true;
60 }
61 
63 {
64  bool ret;
65  ret = ivar->getRemoteVariableRaw(key, val);
66  return ret;
67 }
68 
70 {
71  bool ret;
72  ret = ivar->setRemoteVariableRaw(key, val);
73  return ret;
74 }
75 
76 
78 {
79  bool ret;
80  ret = ivar->getRemoteVariablesListRaw(listOfKeys);
81  return ret;
82 }
void checkAndDestroy(T *&p)
yarp::dev::ControlBoardHelper * castToMapper(void *p)
bool ret
#define yAssert(x)
Definition: Log.h:297
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:73
An interface for the device drivers.