[libcamera-devel] [PATCH 1/8] ipa: camera_sensor_helper: Make factory createInstance() function const
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Oct 3 23:21:21 CEST 2022
The CameraSensorHelperFactory::createIsntace() function has no need to
modify the factory instance. Make it const.
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
src/ipa/libipa/camera_sensor_helper.cpp | 6 +++---
src/ipa/libipa/camera_sensor_helper.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
index d4dba4975e17..fde9bf5b8892 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -254,10 +254,10 @@ CameraSensorHelperFactory::CameraSensorHelperFactory(const std::string name)
*/
std::unique_ptr<CameraSensorHelper> CameraSensorHelperFactory::create(const std::string &name)
{
- std::vector<CameraSensorHelperFactory *> &factories =
+ const std::vector<CameraSensorHelperFactory *> &factories =
CameraSensorHelperFactory::factories();
- for (CameraSensorHelperFactory *factory : factories) {
+ for (const CameraSensorHelperFactory *factory : factories) {
if (name != factory->name_)
continue;
@@ -299,7 +299,7 @@ std::vector<CameraSensorHelperFactory *> &CameraSensorHelperFactory::factories()
}
/**
- * \fn CameraSensorHelperFactory::createInstance()
+ * \fn CameraSensorHelperFactory::createInstance() const
* \brief Create an instance of the CameraSensorHelper corresponding to the
* factory
*
diff --git a/src/ipa/libipa/camera_sensor_helper.h b/src/ipa/libipa/camera_sensor_helper.h
index 7351fc7c2928..2042847f29e8 100644
--- a/src/ipa/libipa/camera_sensor_helper.h
+++ b/src/ipa/libipa/camera_sensor_helper.h
@@ -70,7 +70,7 @@ public:
static std::vector<CameraSensorHelperFactory *> &factories();
protected:
- virtual CameraSensorHelper *createInstance() = 0;
+ virtual CameraSensorHelper *createInstance() const = 0;
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraSensorHelperFactory)
@@ -85,7 +85,7 @@ public: \
helper##Factory() : CameraSensorHelperFactory(name) {} \
\
private: \
- CameraSensorHelper *createInstance() \
+ CameraSensorHelper *createInstance() const \
{ \
return new helper(); \
} \
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list