diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-08-06 14:32:33 +0200 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-08-16 13:49:07 +0200 |
commit | ef5f5c4db05e5d88d58b0d565f7716c59751b991 (patch) | |
tree | 2e3810856a1605266a7ec152df2d92a3a5663990 | |
parent | 27869c5f649c4b524e142014be073b40230ecbc4 (diff) |
libcamera: pipeline_handler: Add const version of cameraData()
Add a version of cameraData() that returns a const pointer and mark it
as a const operation. The assert in the non-const version of the
function already enforces that a std::map::at() operation would always
succeed so there is no change in operation from the non-const version.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r-- | include/libcamera/internal/pipeline_handler.h | 1 | ||||
-rw-r--r-- | src/libcamera/pipeline_handler.cpp | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index 22e629a8..c1873df0 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -97,6 +97,7 @@ protected: virtual int queueRequestDevice(Camera *camera, Request *request) = 0; CameraData *cameraData(const Camera *camera); + const CameraData *cameraData(const Camera *camera) const; CameraManager *manager_; diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index ccd45edc..73c51972 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -602,6 +602,19 @@ CameraData *PipelineHandler::cameraData(const Camera *camera) } /** + * \brief Retrieve the pipeline-specific data associated with a Camera + * \param[in] camera The camera whose data to retrieve + * \sa cameraData() + * \return A const pointer to the pipeline-specific data passed to + * registerCamera(). + */ +const CameraData *PipelineHandler::cameraData(const Camera *camera) const +{ + ASSERT(cameraData_.count(camera)); + return cameraData_.at(camera).get(); +} + +/** * \var PipelineHandler::manager_ * \brief The Camera manager associated with the pipeline handler * |