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 }
yarp::os::Bottle
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
yarp::dev::ImplementRemoteVariables::ImplementRemoteVariables
ImplementRemoteVariables(yarp::dev::IRemoteVariablesRaw *y)
Definition: ImplementRemoteVariables.cpp:17
yarp::dev::ImplementRemoteVariables::setRemoteVariable
bool setRemoteVariable(std::string key, const yarp::os::Bottle &val) override
Definition: ImplementRemoteVariables.cpp:69
ret
bool ret
Definition: ImplementAxisInfo.cpp:72
yarp::dev::ImplementRemoteVariables::uninitialize
bool uninitialize()
Clean up internal data and memory.
Definition: ImplementRemoteVariables.cpp:48
yarp::dev
An interface for the device drivers.
Definition: audioBufferSizeData.cpp:17
yarp::dev::ImplementRemoteVariables::initialize
bool initialize(int size, const int *amap)
Initialize the internal data and alloc memory.
Definition: ImplementRemoteVariables.cpp:30
yarp::dev::ImplementRemoteVariables::getRemoteVariable
bool getRemoteVariable(std::string key, yarp::os::Bottle &val) override
Definition: ImplementRemoteVariables.cpp:62
yarp::dev::ImplementRemoteVariables::temp1
double * temp1
Definition: ImplementRemoteVariables.h:25
yarp::dev::ImplementRemoteVariables::ivar
IRemoteVariablesRaw * ivar
Definition: ImplementRemoteVariables.h:23
yarp::dev::ImplementRemoteVariables::temp2
double * temp2
Definition: ImplementRemoteVariables.h:26
yarp::dev::IRemoteVariablesRaw::getRemoteVariablesListRaw
virtual bool getRemoteVariablesListRaw(yarp::os::Bottle *listOfKeys)=0
yarp::dev::ImplementRemoteVariables::~ImplementRemoteVariables
virtual ~ImplementRemoteVariables()
Definition: ImplementRemoteVariables.cpp:25
yarp::dev::ImplementRemoteVariables::helper
void * helper
Definition: ImplementRemoteVariables.h:24
ControlBoardHelper.h
checkAndDestroy
void checkAndDestroy(T *&p)
Definition: ControlBoardHelper.h:45
yarp::dev::IRemoteVariablesRaw::getRemoteVariableRaw
virtual bool getRemoteVariableRaw(std::string key, yarp::os::Bottle &val)=0
castToMapper
yarp::dev::ControlBoardHelper * castToMapper(void *p)
Definition: ControlBoardHelper.h:180
yarp::dev::ControlBoardHelper
Definition: ControlBoardHelper.h:60
yarp::dev::IRemoteVariablesRaw::setRemoteVariableRaw
virtual bool setRemoteVariableRaw(std::string key, const yarp::os::Bottle &val)=0
ControlBoardInterfacesImpl.h
yarp::dev::ImplementRemoteVariables::getRemoteVariablesList
bool getRemoteVariablesList(yarp::os::Bottle *listOfKeys) override
Definition: ImplementRemoteVariables.cpp:77
yAssert
#define yAssert(x)
Definition: Log.h:297
yarp::dev::IRemoteVariablesRaw
IRemoteVariablesRaw interface.
Definition: IRemoteVariables.h:31