1
1
/*
2
- * Copyright 2022 Robert Bosch GmbH
2
+ * Copyright 2023 Robert Bosch GmbH
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
21
21
*/
22
22
23
23
#pragma once
24
- #ifndef CLOE_COMPONENT_OSI_SENSOR_HPP_
25
- #define CLOE_COMPONENT_OSI_SENSOR_HPP_
26
24
27
- #include < memory > // for shared_ptr
25
+ #include < osi_sensordata.pb.h > // for SensorData
28
26
29
- #include " osi_groundtruth.pb.h" // for GroundTruth
30
- #include " osi_sensordata.pb.h" // for SensorData
31
- #include " osi_sensorview.pb.h" // for SensorView
32
-
33
- #include < cloe/component.hpp> // for Component, Json
27
+ #include < cloe/component.hpp> // for Component
34
28
35
29
namespace cloe_osi {
36
30
@@ -41,64 +35,10 @@ class OsiSensor : public cloe::Component {
41
35
virtual ~OsiSensor () noexcept = default ;
42
36
43
37
/* *
44
- * Return OSI data, if available.
45
- */
46
-
47
- virtual std::shared_ptr<osi3::GroundTruth> ground_truth () = 0;
48
-
49
- virtual std::shared_ptr<osi3::SensorView> sensor_view () = 0;
50
-
51
- virtual std::shared_ptr<osi3::SensorData> sensor_data () = 0;
52
-
53
- /* *
54
- * Writes JSON representation into j.
38
+ * Return OSI-SensorData
55
39
*/
56
- cloe::Json active_state () const override {
57
- return cloe::Json{
58
- /* {"ground_truth", this->ground_truth()},
59
- {"sensor_view", this->sensor_view()},
60
- {"sensor_data", this->sensor_data()},*/
61
- };
62
- }
63
- };
64
-
65
- class NopOsiSensor : public OsiSensor {
66
- public:
67
- using OsiSensor::OsiSensor;
68
- NopOsiSensor () : OsiSensor(" nop_osi_sensor" ) {}
69
- virtual ~NopOsiSensor () noexcept = default ;
70
-
71
- std::shared_ptr<osi3::GroundTruth> ground_truth () override { return ground_truth_; }
72
-
73
- std::shared_ptr<osi3::SensorView> sensor_view () override { return sensor_view_; }
74
-
75
- std::shared_ptr<osi3::SensorData> sensor_data () override { return sensor_data_; }
76
-
77
- void set_ground_truth (const osi3::GroundTruth& gt) {
78
- ground_truth_ = std::make_shared<osi3::GroundTruth>(gt);
79
- }
80
-
81
- void set_sensor_view (const osi3::SensorView& view) {
82
- sensor_view_ = std::make_shared<osi3::SensorView>(view);
83
- }
84
-
85
- void set_sensor_data (const osi3::SensorData& data) {
86
- sensor_data_ = std::make_shared<osi3::SensorData>(data);
87
- }
88
-
89
- void reset () override {
90
- OsiSensor::reset ();
91
- ground_truth_.reset ();
92
- sensor_view_.reset ();
93
- sensor_data_.reset ();
94
- }
95
-
96
- protected:
97
- std::shared_ptr<osi3::GroundTruth> ground_truth_{nullptr };
98
- std::shared_ptr<osi3::SensorView> sensor_view_{nullptr };
99
- std::shared_ptr<osi3::SensorData> sensor_data_{nullptr };
40
+ virtual const std::shared_ptr<osi3::SensorData>& get () const = 0;
41
+ virtual std::shared_ptr<osi3::SensorData>& get () = 0;
100
42
};
101
43
102
44
} // namespace cloe_osi
103
-
104
- #endif // CLOE_COMPONENT_OSI_SENSOR_HPP_
0 commit comments