Skip to content

Commit 87d68ce

Browse files
committed
--add missing wrapper classes
1 parent 4ecbf17 commit 87d68ce

7 files changed

+252
-4
lines changed

src/esp/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,10 @@ set(
472472
sensor/sensorManagers/SensorWrapperManager.h
473473
sensor/sensorManagers/SensorWrapperBaseManager.h
474474
sensor/sensorWrappers/ManagedAudioSensor.h
475+
sensor/sensorWrappers/ManagedCameraSensor.h
476+
sensor/sensorWrappers/ManagedCubeMapSensorBase.h
477+
sensor/sensorWrappers/ManagedEquirectangularSensor.h
478+
sensor/sensorWrappers/ManagedFisheyeSensor.h
475479
sensor/sensorWrappers/ManagedSensorBase.h
476480
sensor/sensorWrappers/ManagedSensorTemplates.h
477481
sensor/sensorWrappers/ManagedVisualSensorBase.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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_MANAGEDCAMERASENSOR_H_
6+
#define ESP_SENSOR_MANAGEDCAMERASENSOR_H_
7+
8+
#include "ManagedVisualSensorBase.h"
9+
#include "esp/sensor/CameraSensor.h"
10+
11+
namespace esp {
12+
namespace sensor {
13+
14+
/**
15+
* @brief Class for wrapper for camera sensor objects
16+
*/
17+
class ManagedCameraSensor : public AbstractManagedVisualSensor<CameraSensor> {
18+
public:
19+
explicit ManagedCameraSensor(
20+
const std::string& classKey = "ManagedCameraSensor")
21+
: AbstractManagedVisualSensor<CameraSensor>::AbstractManagedVisualSensor(
22+
classKey) {}
23+
24+
// TODO Add appropriate camera sensor getters/setters here
25+
26+
protected:
27+
/**
28+
* @brief Retrieve a comma-separated string holding the header values for
29+
* the info returned for this managed visual sensor, type-specific.
30+
*/
31+
std::string getVisualSensorObjInfoHeaderInternal() const override {
32+
return "";
33+
}
34+
35+
/**
36+
* @brief Specialization-specific extension of getObjectInfo, comma
37+
* separated info ideal for saving to csv
38+
*/
39+
40+
std::string getVisualSensorObjInfoInternal(
41+
CORRADE_UNUSED std::shared_ptr<esp::sensor::CameraSensor>& sp)
42+
const override {
43+
// TODO provide info stream for sensors
44+
return "";
45+
}
46+
47+
public:
48+
ESP_SMART_POINTERS(ManagedCameraSensor)
49+
}; // class ManagedCameraSensor
50+
51+
} // namespace sensor
52+
} // namespace esp
53+
54+
#endif // ESP_SENSOR_MANAGEDCAMERASENSOR_H_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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_MANAGEDEQUIRECTANGULARSENSOR_H_
6+
#define ESP_SENSOR_MANAGEDEQUIRECTANGULARSENSOR_H_
7+
8+
#include "ManagedCubeMapSensorBase.h"
9+
#include "esp/sensor/EquirectangularSensor.h"
10+
11+
namespace esp {
12+
namespace sensor {
13+
14+
/**
15+
* @brief Class for wrapper for sensor objects of all kinds to
16+
* enable Managed Container access.
17+
*/
18+
class ManagedEquirectangularSensor
19+
: public AbstractManagedCubeMapSensorBase<EquirectangularSensor> {
20+
public:
21+
explicit ManagedEquirectangularSensor(
22+
const std::string& classKey = "ManagedEquirectangularSensor")
23+
: AbstractManagedCubeMapSensorBase<
24+
EquirectangularSensor>::AbstractManagedCubeMapSensorBase(classKey) {
25+
}
26+
27+
// TODO Add appropriate equirectangular sensor getters/setters here
28+
29+
protected:
30+
/**
31+
* @brief Retrieve a comma-separated string holding the header values for
32+
* the info returned for this managed Equirectangular CubeMap sensor,
33+
* type-specific.
34+
*/
35+
std::string getCubeMapSensorObjInfoHeaderInternal() const override {
36+
return "";
37+
}
38+
39+
/**
40+
* @brief Specialization-specific extension of getObjectInfo, comma
41+
* separated info ideal for saving to csv
42+
*/
43+
44+
std::string getCubeMapSensorObjInfoInternal(
45+
CORRADE_UNUSED std::shared_ptr<EquirectangularSensor>& sp)
46+
const override {
47+
// TODO provide info stream for sensors
48+
return "";
49+
}
50+
51+
public:
52+
ESP_SMART_POINTERS(ManagedEquirectangularSensor)
53+
}; // namespace sensor
54+
55+
} // namespace sensor
56+
} // namespace esp
57+
58+
#endif // ESP_SENSOR_MANAGEDEQUIRECTANGULARSENSOR_H_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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_MANAGEDFISHEYESENSOR_H_
6+
#define ESP_SENSOR_MANAGEDFISHEYESENSOR_H_
7+
8+
#include "ManagedCubeMapSensorBase.h"
9+
#include "esp/sensor/FisheyeSensor.h"
10+
11+
namespace esp {
12+
namespace sensor {
13+
14+
/**
15+
* @brief Class for wrapper for sensor objects of all kinds to
16+
* enable Managed Container access.
17+
*/
18+
class ManagedFisheyeSensor
19+
: public AbstractManagedCubeMapSensorBase<FisheyeSensor> {
20+
public:
21+
explicit ManagedFisheyeSensor(
22+
const std::string& classKey = "ManagedFisheyeSensor")
23+
: AbstractManagedCubeMapSensorBase<
24+
FisheyeSensor>::AbstractManagedCubeMapSensorBase(classKey) {}
25+
26+
// TODO Add appropriate fisheye sensor getters/setters here
27+
28+
protected:
29+
/**
30+
* @brief Retrieve a comma-separated string holding the header values for
31+
* the info returned for this managed visual sensor, type-specific.
32+
*/
33+
std::string getCubeMapSensorObjInfoHeaderInternal() const override {
34+
return "";
35+
}
36+
37+
/**
38+
* @brief Specialization-specific extension of getObjectInfo, comma
39+
* separated info ideal for saving to csv
40+
*/
41+
42+
std::string getCubeMapSensorObjInfoInternal(
43+
CORRADE_UNUSED std::shared_ptr<FisheyeSensor>& sp) const override {
44+
// TODO provide info stream for sensors
45+
return "";
46+
}
47+
48+
public:
49+
ESP_SMART_POINTERS(ManagedFisheyeSensor)
50+
}; // namespace sensor
51+
52+
} // namespace sensor
53+
} // namespace esp
54+
55+
#endif // ESP_SENSOR_MANAGEDFISHEYESENSOR_H_

src/esp/sensor/sensorWrappers/ManagedSensorTemplates.h

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ class AbstractManagedSensor : public ManagedSensorBase {
2525
"AbstractManagedSensor :: Managed sensor object type must be "
2626
"derived from esp::sensor::Sensor");
2727

28+
/**
29+
* @brief Alias for weak pointer to the @ref esp::sensor::Sensor this construct wraps.
30+
*/
2831
typedef std::weak_ptr<T> WeakObjRef;
2932

3033
explicit AbstractManagedSensor(const std::string& classKey)

src/esp/sensor/sensorWrappers/ManagedVisualSensorBase.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace esp {
1515
namespace sensor {
1616

1717
/**
18-
* @brief Base class template for wrapper for visual sensor objects of all kinds
18+
* @brief Class template for wrapper for visual sensor objects of all kinds
1919
* that extends AbstractManagedSensorAccess
2020
*/
2121

@@ -51,10 +51,10 @@ class AbstractManagedVisualSensor
5151
* separated info ideal for saving to csv
5252
*/
5353
std::string getSensorObjInfoInternal(
54-
CORRADE_UNUSED std::shared_ptr<VisualSensor>& sp) const override {
54+
CORRADE_UNUSED std::shared_ptr<T>& sp) const override {
5555
// TODO provide info stream for sensors
56-
std::string res = Cr::Utility::formatString(
57-
"{},{}", "VisualSensor", getVisualSensorObjInfoInternal());
56+
std::string res =
57+
Cr::Utility::formatString("{},", getVisualSensorObjInfoInternal());
5858

5959
return res;
6060
}

0 commit comments

Comments
 (0)