libcamera: media_device: Make getEntityByName() const

The function does not modify the instance state. Mark it as const.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2019-01-02 11:55:43 +01:00
parent ea3fa2680c
commit 1b80471805
2 changed files with 2 additions and 2 deletions

View file

@ -38,7 +38,7 @@ public:
const std::string devnode() const { return devnode_; } const std::string devnode() const { return devnode_; }
const std::vector<MediaEntity *> &entities() const { return entities_; } const std::vector<MediaEntity *> &entities() const { return entities_; }
MediaEntity *getEntityByName(const std::string &name); MediaEntity *getEntityByName(const std::string &name) const;
private: private:
std::string driver_; std::string driver_;

View file

@ -297,7 +297,7 @@ int MediaDevice::populate()
* \return The entity with \a name * \return The entity with \a name
* \return nullptr if no entity with \a name is found * \return nullptr if no entity with \a name is found
*/ */
MediaEntity *MediaDevice::getEntityByName(const std::string &name) MediaEntity *MediaDevice::getEntityByName(const std::string &name) const
{ {
for (MediaEntity *e : entities_) for (MediaEntity *e : entities_)
if (e->name() == name) if (e->name() == name)