aron_conversions.cpp
Go to the documentation of this file.
1 #include "aron_conversions.h"
2 
4 
7 
8 namespace armarx
9 {
11  RobotUnitDataStreaming::toAron(const TimeStep& timestep, const DataEntry& dataEntry)
12  {
13  switch (dataEntry.type)
14  {
15  case RobotUnitDataStreaming::NodeTypeFloat:
16  {
17  float value =
18  RobotUnitDataStreamingReceiver::GetAs<Ice::Float>(timestep, dataEntry);
19  return std::make_shared<aron::data::Float>(value);
20  }
21  case RobotUnitDataStreaming::NodeTypeBool:
22  {
23  bool value = RobotUnitDataStreamingReceiver::GetAs<bool>(timestep, dataEntry);
24  return std::make_shared<aron::data::Bool>(value);
25  }
26  case RobotUnitDataStreaming::NodeTypeByte:
27  {
28  int value = RobotUnitDataStreamingReceiver::GetAs<Ice::Byte>(timestep, dataEntry);
29  return std::make_shared<aron::data::Int>(value);
30  }
31  case RobotUnitDataStreaming::NodeTypeShort:
32  {
33  int value = RobotUnitDataStreamingReceiver::GetAs<Ice::Short>(timestep, dataEntry);
34  return std::make_shared<aron::data::Int>(value);
35  }
36  case RobotUnitDataStreaming::NodeTypeInt:
37  {
38  int value = RobotUnitDataStreamingReceiver::GetAs<Ice::Int>(timestep, dataEntry);
39  return std::make_shared<aron::data::Int>(value);
40  }
41  case RobotUnitDataStreaming::NodeTypeLong:
42  {
43  long value = RobotUnitDataStreamingReceiver::GetAs<Ice::Long>(timestep, dataEntry);
44  return std::make_shared<aron::data::Long>(value);
45  }
46  case RobotUnitDataStreaming::NodeTypeDouble:
47  {
48  double value =
49  RobotUnitDataStreamingReceiver::GetAs<Ice::Double>(timestep, dataEntry);
50  return std::make_shared<aron::data::Double>(value);
51  }
52  default:
53  ARMARX_UNEXPECTED_ENUM_VALUE(RobotUnitDataStreaming::NodeType, dataEntry.type);
54  }
55  }
56 
57  const simox::meta::EnumNames<RobotUnitDataStreaming::DataEntryType>
59  {NodeTypeBool, "Bool"},
60  {NodeTypeByte, "Byte"},
61  {NodeTypeShort, "Short"},
62  {NodeTypeInt, "Int"},
63  {NodeTypeLong, "Long"},
64  {NodeTypeFloat, "Float"},
65  {NodeTypeDouble, "Double"},
66  };
67 
68 } // namespace armarx
ARMARX_UNEXPECTED_ENUM_VALUE
#define ARMARX_UNEXPECTED_ENUM_VALUE(EnumType, value)
Throw an UnexpectedEnumValueException.
Definition: UnexpectedEnumValueException.h:58
armarx::RobotUnitDataStreaming::toAron
aron::data::VariantPtr toAron(const TimeStep &timestep, const DataEntry &dataEntry)
Definition: aron_conversions.cpp:11
UnexpectedEnumValueException.h
RobotUnitDataStreamingReceiver.h
armarx::aron::data::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition: forward_declarations.h:11
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:855
All.h
aron_conversions.h
armarx::RobotUnitDataStreaming::DataEntryNames
const simox::meta::EnumNames< DataEntryType > DataEntryNames
Definition: aron_conversions.cpp:58
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27