Converter.h
Go to the documentation of this file.
1 #pragma once
2 
3 // STD/STL
4 #include <memory>
5 
6 // Simox
7 #include <SimoxUtility/json.h>
8 
9 // ArmarX
11 
12 #include "../../extractor/Extractor.h"
13 
15 {
17  {
18  public:
19  enum class ConverterType
20  {
21  Str,
22  Binary
23  };
24 
26  {
27  std::vector<unsigned char> data;
28  std::string suffix;
29  };
30 
32  const std::string& id,
33  const std::string& s,
35  std::unique_ptr<Extractor>&& ex) :
36  type(t), identifier(id), suffix(s), convertsType(c), extractor(std::move(ex))
37  {
38  }
39 
40  virtual ~DataConverter() = default;
41 
42  virtual ConversionResult convert(const aron::data::VariantPtr& data) = 0;
43  virtual aron::data::VariantPtr convert(const ConversionResult&,
44  const armarx::aron::Path& p) = 0;
45 
46  virtual void configure(const nlohmann::json& json);
47 
48  public:
50  const std::string identifier;
51  const std::string suffix;
53 
54  const std::unique_ptr<Extractor> extractor;
55  };
56 } // namespace armarx::armem::server::ltm::processor
armarx::armem::server::ltm::processor
Definition: Converter.cpp:3
armarx::armem::server::ltm::processor::DataConverter
Definition: Converter.h:16
armarx::armem::server::ltm::processor::DataConverter::identifier
const std::string identifier
Definition: Converter.h:50
armarx::armem::server::ltm::processor::DataConverter::ConversionResult::suffix
std::string suffix
Definition: Converter.h:28
armarx::armem::server::ltm::processor::DataConverter::convert
virtual ConversionResult convert(const aron::data::VariantPtr &data)=0
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::armem::server::ltm::processor::DataConverter::configure
virtual void configure(const nlohmann::json &json)
Definition: Converter.cpp:6
armarx::armem::server::ltm::processor::DataConverter::DataConverter
DataConverter(const ConverterType t, const std::string &id, const std::string &s, const aron::type::Descriptor c, std::unique_ptr< Extractor > &&ex)
Definition: Converter.h:31
Dict.h
armarx::aron::Path
The Path class.
Definition: Path.h:36
armarx::aron::data::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition: forward_declarations.h:11
armarx::armem::server::ltm::processor::DataConverter::type
const ConverterType type
Definition: Converter.h:49
armarx::armem::server::ltm::processor::DataConverter::~DataConverter
virtual ~DataConverter()=default
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::armem::server::ltm::processor::DataConverter::ConverterType::Binary
@ Binary
armarx::armem::server::ltm::processor::DataConverter::convertsType
const aron::type::Descriptor convertsType
Definition: Converter.h:52
armarx::armem::server::ltm::processor::DataConverter::ConverterType::Str
@ Str
std
Definition: Application.h:66
armarx::armem::server::ltm::processor::DataConverter::suffix
const std::string suffix
Definition: Converter.h:51
armarx::armem::server::ltm::processor::DataConverter::ConversionResult
Definition: Converter.h:25
armarx::armem::server::ltm::processor::DataConverter::extractor
const std::unique_ptr< Extractor > extractor
Definition: Converter.h:54
armarx::aron::type::Descriptor
Descriptor
Definition: Descriptor.h:76
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx::armem::server::ltm::processor::DataConverter::ConversionResult::data
std::vector< unsigned char > data
Definition: Converter.h:27
armarx::armem::server::ltm::processor::DataConverter::ConverterType
ConverterType
Definition: Converter.h:19