Skip to content

Commit

Permalink
--add missing wrapper classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jturner65 committed Jan 8, 2025
1 parent f760326 commit a124c25
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/esp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,10 @@ set(
sensor/sensorManagers/SensorWrapperManager.h
sensor/sensorManagers/SensorWrapperBaseManager.h
sensor/sensorWrappers/ManagedAudioSensor.h
sensor/sensorWrappers/ManagedCameraSensor.h
sensor/sensorWrappers/ManagedCubeMapSensorBase.h
sensor/sensorWrappers/ManagedEquirectangularSensor.h
sensor/sensorWrappers/ManagedFisheyeSensor.h
sensor/sensorWrappers/ManagedSensorBase.h
sensor/sensorWrappers/ManagedSensorTemplates.h
sensor/sensorWrappers/ManagedVisualSensorBase.h
Expand Down
54 changes: 54 additions & 0 deletions src/esp/sensor/sensorWrappers/ManagedCameraSensor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

#ifndef ESP_SENSOR_MANAGEDCAMERASENSOR_H_
#define ESP_SENSOR_MANAGEDCAMERASENSOR_H_

#include "ManagedVisualSensorBase.h"
#include "esp/sensor/CameraSensor.h"

namespace esp {
namespace sensor {

/**
* @brief Class for wrapper for camera sensor objects
*/
class ManagedCameraSensor : public AbstractManagedVisualSensor<CameraSensor> {
public:
explicit ManagedCameraSensor(
const std::string& classKey = "ManagedCameraSensor")
: AbstractManagedVisualSensor<CameraSensor>::AbstractManagedVisualSensor(
classKey) {}

// TODO Add appropriate camera sensor getters/setters here

protected:
/**
* @brief Retrieve a comma-separated string holding the header values for
* the info returned for this managed visual sensor, type-specific.
*/
std::string getVisualSensorObjInfoHeaderInternal() const override {
return "";
}

/**
* @brief Specialization-specific extension of getObjectInfo, comma
* separated info ideal for saving to csv
*/

std::string getVisualSensorObjInfoInternal(
CORRADE_UNUSED std::shared_ptr<esp::sensor::CameraSensor>& sp)
const override {
// TODO provide info stream for sensors
return "";
}

public:
ESP_SMART_POINTERS(ManagedCameraSensor)
}; // class ManagedCameraSensor

} // namespace sensor
} // namespace esp

#endif // ESP_SENSOR_MANAGEDCAMERASENSOR_H_
74 changes: 74 additions & 0 deletions src/esp/sensor/sensorWrappers/ManagedCubeMapSensorBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

#ifndef ESP_SENSOR_MANAGEDCUBEMAPSENSORBASE_H_
#define ESP_SENSOR_MANAGEDCUBEMAPSENSORBASE_H_

#include "ManagedVisualSensorBase.h"
#include "esp/sensor/CubeMapSensorBase.h"

namespace esp {
namespace sensor {

/**
* @brief Class Template for wrapper for CubeMap sensor objects
*/
template <class T>
class AbstractManagedCubeMapSensorBase
: public esp::sensor::AbstractManagedVisualSensor<T> {
public:
static_assert(
std::is_base_of<esp::sensor::CubeMapSensorBase, T>::value,
"AbstractManagedCubeMapSensorBase :: Managed CubeMap sensor object "
"type must be derived from esp::sensor::CubeMapSensorBase");

explicit AbstractManagedCubeMapSensorBase(const std::string& classKey)
: AbstractManagedVisualSensor<T>(classKey) {}

// TODO Add appropriate camera sensor getters/setters here

protected:
/**
* @brief Retrieve a comma-separated string holding the header values for
* the info returned for this managed visual sensor, type-specific.
*/
std::string getVisualSensorObjInfoHeaderInternal() const override {
return "" + getCubeMapSensorObjInfoHeaderInternal();
}

/**
* @brief Retrieve a comma-separated string holding the header values for
* the info returned for this managed visual sensor, type-specific.
*/

virtual std::string getCubeMapSensorObjInfoHeaderInternal() const = 0;
/**
* @brief Specialization-specific extension of getObjectInfo, comma
* separated info ideal for saving to csv
*/

std::string getVisualSensorObjInfoInternal(
CORRADE_UNUSED std::shared_ptr<T>& sp) const override {
// TODO provide info stream for sensors
std::string res =
Cr::Utility::formatString("{},", getCubeMapSensorObjInfoInternal());

return res;
}

/**
* @brief Specialization-specific extension of getSensorObjInfoInternal, comma
* separated info ideal for saving to csv
*/
virtual std::string getCubeMapSensorObjInfoInternal(
std::shared_ptr<T>& sp) const = 0;

public:
ESP_SMART_POINTERS(AbstractManagedCubeMapSensorBase<T>)
}; // class ManagedCubeMapSensorBase

} // namespace sensor
} // namespace esp

#endif // ESP_SENSOR_MANAGEDCUBEMAPSENSORBASE_H_
58 changes: 58 additions & 0 deletions src/esp/sensor/sensorWrappers/ManagedEquirectangularSensor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

#ifndef ESP_SENSOR_MANAGEDEQUIRECTANGULARSENSOR_H_
#define ESP_SENSOR_MANAGEDEQUIRECTANGULARSENSOR_H_

#include "ManagedCubeMapSensorBase.h"
#include "esp/sensor/EquirectangularSensor.h"

namespace esp {
namespace sensor {

/**
* @brief Class for wrapper for sensor objects of all kinds to
* enable Managed Container access.
*/
class ManagedEquirectangularSensor
: public AbstractManagedCubeMapSensorBase<EquirectangularSensor> {
public:
explicit ManagedEquirectangularSensor(
const std::string& classKey = "ManagedEquirectangularSensor")
: AbstractManagedCubeMapSensorBase<
EquirectangularSensor>::AbstractManagedCubeMapSensorBase(classKey) {
}

// TODO Add appropriate equirectangular sensor getters/setters here

protected:
/**
* @brief Retrieve a comma-separated string holding the header values for
* the info returned for this managed Equirectangular CubeMap sensor,
* type-specific.
*/
std::string getCubeMapSensorObjInfoHeaderInternal() const override {
return "";
}

/**
* @brief Specialization-specific extension of getObjectInfo, comma
* separated info ideal for saving to csv
*/

std::string getCubeMapSensorObjInfoInternal(
CORRADE_UNUSED std::shared_ptr<EquirectangularSensor>& sp)
const override {
// TODO provide info stream for sensors
return "";
}

public:
ESP_SMART_POINTERS(ManagedEquirectangularSensor)
}; // namespace sensor

} // namespace sensor
} // namespace esp

#endif // ESP_SENSOR_MANAGEDEQUIRECTANGULARSENSOR_H_
55 changes: 55 additions & 0 deletions src/esp/sensor/sensorWrappers/ManagedFisheyeSensor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright (c) Meta Platforms, Inc. and its affiliates.
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

#ifndef ESP_SENSOR_MANAGEDFISHEYESENSOR_H_
#define ESP_SENSOR_MANAGEDFISHEYESENSOR_H_

#include "ManagedCubeMapSensorBase.h"
#include "esp/sensor/FisheyeSensor.h"

namespace esp {
namespace sensor {

/**
* @brief Class for wrapper for sensor objects of all kinds to
* enable Managed Container access.
*/
class ManagedFisheyeSensor
: public AbstractManagedCubeMapSensorBase<FisheyeSensor> {
public:
explicit ManagedFisheyeSensor(
const std::string& classKey = "ManagedFisheyeSensor")
: AbstractManagedCubeMapSensorBase<
FisheyeSensor>::AbstractManagedCubeMapSensorBase(classKey) {}

// TODO Add appropriate fisheye sensor getters/setters here

protected:
/**
* @brief Retrieve a comma-separated string holding the header values for
* the info returned for this managed visual sensor, type-specific.
*/
std::string getCubeMapSensorObjInfoHeaderInternal() const override {
return "";
}

/**
* @brief Specialization-specific extension of getObjectInfo, comma
* separated info ideal for saving to csv
*/

std::string getCubeMapSensorObjInfoInternal(
CORRADE_UNUSED std::shared_ptr<FisheyeSensor>& sp) const override {
// TODO provide info stream for sensors
return "";
}

public:
ESP_SMART_POINTERS(ManagedFisheyeSensor)
}; // namespace sensor

} // namespace sensor
} // namespace esp

#endif // ESP_SENSOR_MANAGEDFISHEYESENSOR_H_
3 changes: 3 additions & 0 deletions src/esp/sensor/sensorWrappers/ManagedSensorTemplates.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class AbstractManagedSensor : public ManagedSensorBase {
"AbstractManagedSensor :: Managed sensor object type must be "
"derived from esp::sensor::Sensor");

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

explicit AbstractManagedSensor(const std::string& classKey)
Expand Down
8 changes: 4 additions & 4 deletions src/esp/sensor/sensorWrappers/ManagedVisualSensorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace esp {
namespace sensor {

/**
* @brief Base class template for wrapper for visual sensor objects of all kinds
* @brief Class template for wrapper for visual sensor objects of all kinds
* that extends AbstractManagedSensorAccess
*/

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

return res;
}
Expand Down

0 comments on commit a124c25

Please sign in to comment.