mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-12 23:09:45 +03:00
libcamera: camera_manager: Take camera id in std::string_view
Do not force the caller to have an `std::string` object as a simple string view is sufficient to do the lookup. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
056ebf0b6e
commit
37283b68ea
3 changed files with 4 additions and 3 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <sys/types.h>
|
||||
#include <vector>
|
||||
|
||||
|
@ -31,7 +32,7 @@ public:
|
|||
void stop();
|
||||
|
||||
std::vector<std::shared_ptr<Camera>> cameras() const;
|
||||
std::shared_ptr<Camera> get(const std::string &id);
|
||||
std::shared_ptr<Camera> get(std::string_view id);
|
||||
|
||||
static const std::string &version() { return version_; }
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ std::vector<std::shared_ptr<Camera>> CameraManager::cameras() const
|
|||
*
|
||||
* \return Shared pointer to Camera object or nullptr if camera not found
|
||||
*/
|
||||
std::shared_ptr<Camera> CameraManager::get(const std::string &id)
|
||||
std::shared_ptr<Camera> CameraManager::get(std::string_view id)
|
||||
{
|
||||
Private *const d = _d();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
~PyCameraManager();
|
||||
|
||||
pybind11::list cameras();
|
||||
std::shared_ptr<Camera> get(const std::string &name) { return cameraManager_->get(name); }
|
||||
std::shared_ptr<Camera> get(std::string_view name) { return cameraManager_->get(name); }
|
||||
|
||||
static const std::string &version() { return CameraManager::version(); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue