aron_conversions.cpp
Go to the documentation of this file.
1 #include "aron_conversions.h"
2 
5 
7 
8 
9 namespace armarx
10 {
12  const TimeStep& timestep,
13  const DataEntry& dataEntry)
14  {
15  switch (dataEntry.type)
16  {
17  case RobotUnitDataStreaming::NodeTypeFloat:
18  {
19  float value = RobotUnitDataStreamingReceiver::GetAs<Ice::Float>(timestep, dataEntry);
20  return std::make_shared<aron::data::Float>(value);
21  }
22  case RobotUnitDataStreaming::NodeTypeBool:
23  {
24  bool value = RobotUnitDataStreamingReceiver::GetAs<bool>(timestep, dataEntry);
25  return std::make_shared<aron::data::Bool>(value);
26  }
27  case RobotUnitDataStreaming::NodeTypeByte:
28  {
29  int value = RobotUnitDataStreamingReceiver::GetAs<Ice::Byte>(timestep, dataEntry);
30  return std::make_shared<aron::data::Int>(value);
31  }
32  case RobotUnitDataStreaming::NodeTypeShort:
33  {
34  int value = RobotUnitDataStreamingReceiver::GetAs<Ice::Short>(timestep, dataEntry);
35  return std::make_shared<aron::data::Int>(value);
36  }
37  case RobotUnitDataStreaming::NodeTypeInt:
38  {
39  int value = RobotUnitDataStreamingReceiver::GetAs<Ice::Int>(timestep, dataEntry);
40  return std::make_shared<aron::data::Int>(value);
41  }
42  case RobotUnitDataStreaming::NodeTypeLong:
43  {
44  long value = RobotUnitDataStreamingReceiver::GetAs<Ice::Long>(timestep, dataEntry);
45  return std::make_shared<aron::data::Long>(value);
46  }
47  case RobotUnitDataStreaming::NodeTypeDouble:
48  {
49  double value = 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 
58  const simox::meta::EnumNames<RobotUnitDataStreaming::DataEntryType> RobotUnitDataStreaming::DataEntryNames =
59  {
60  { NodeTypeBool, "Bool" },
61  { NodeTypeByte, "Byte" },
62  { NodeTypeShort, "Short" },
63  { NodeTypeInt, "Int" },
64  { NodeTypeLong, "Long" },
65  { NodeTypeFloat, "Float" },
66  { NodeTypeDouble, "Double" },
67  };
68 
69 }
ARMARX_UNEXPECTED_ENUM_VALUE
#define ARMARX_UNEXPECTED_ENUM_VALUE(EnumType, value)
Throw an UnexpectedEnumValueException.
Definition: UnexpectedEnumValueException.h:61
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:926
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:28