|
| 1 | +// Copyright (c) Meta Platforms, Inc. and its affiliates. |
| 2 | +// This source code is licensed under the MIT license found in the |
| 3 | +// LICENSE file in the root directory of this source tree. |
| 4 | + |
| 5 | +#ifndef ESP_SENSOR_MANAGEDCUBEMAPSENSORBASE_H_ |
| 6 | +#define ESP_SENSOR_MANAGEDCUBEMAPSENSORBASE_H_ |
| 7 | + |
| 8 | +#include "ManagedVisualSensorBase.h" |
| 9 | +#include "esp/sensor/CubeMapSensorBase.h" |
| 10 | + |
| 11 | +namespace esp { |
| 12 | +namespace sensor { |
| 13 | + |
| 14 | +/** |
| 15 | + * @brief Class Template for wrapper for CubeMap sensor objects |
| 16 | + */ |
| 17 | +template <class T> |
| 18 | +class AbstractManagedCubeMapSensorBase |
| 19 | + : public esp::sensor::AbstractManagedVisualSensor<T> { |
| 20 | + public: |
| 21 | + static_assert( |
| 22 | + std::is_base_of<esp::sensor::CubeMapSensorBase, T>::value, |
| 23 | + "AbstractManagedCubeMapSensorBase :: Managed CubeMap sensor object " |
| 24 | + "type must be derived from esp::sensor::CubeMapSensorBase"); |
| 25 | + |
| 26 | + explicit AbstractManagedCubeMapSensorBase(const std::string& classKey) |
| 27 | + : AbstractManagedVisualSensor<T>(classKey) {} |
| 28 | + |
| 29 | + // TODO Add appropriate camera sensor getters/setters here |
| 30 | + |
| 31 | + protected: |
| 32 | + /** |
| 33 | + * @brief Retrieve a comma-separated string holding the header values for |
| 34 | + * the info returned for this managed visual sensor, type-specific. |
| 35 | + */ |
| 36 | + std::string getVisualSensorObjInfoHeaderInternal() const override { |
| 37 | + return "" + getCubeMapSensorObjInfoHeaderInternal(); |
| 38 | + } |
| 39 | + |
| 40 | + /** |
| 41 | + * @brief Retrieve a comma-separated string holding the header values for |
| 42 | + * the info returned for this managed visual sensor, type-specific. |
| 43 | + */ |
| 44 | + |
| 45 | + virtual std::string getCubeMapSensorObjInfoHeaderInternal() const = 0; |
| 46 | + /** |
| 47 | + * @brief Specialization-specific extension of getObjectInfo, comma |
| 48 | + * separated info ideal for saving to csv |
| 49 | + */ |
| 50 | + |
| 51 | + std::string getVisualSensorObjInfoInternal( |
| 52 | + CORRADE_UNUSED std::shared_ptr<T>& sp) const override { |
| 53 | + // TODO provide info stream for sensors |
| 54 | + std::string res = |
| 55 | + Cr::Utility::formatString("{},", getCubeMapSensorObjInfoInternal()); |
| 56 | + |
| 57 | + return res; |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * @brief Specialization-specific extension of getSensorObjInfoInternal, comma |
| 62 | + * separated info ideal for saving to csv |
| 63 | + */ |
| 64 | + virtual std::string getCubeMapSensorObjInfoInternal( |
| 65 | + std::shared_ptr<T>& sp) const = 0; |
| 66 | + |
| 67 | + public: |
| 68 | + ESP_SMART_POINTERS(AbstractManagedCubeMapSensorBase<T>) |
| 69 | +}; // class ManagedCubeMapSensorBase |
| 70 | + |
| 71 | +} // namespace sensor |
| 72 | +} // namespace esp |
| 73 | + |
| 74 | +#endif // ESP_SENSOR_MANAGEDCUBEMAPSENSORBASE_H_ |
0 commit comments