mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-17 01:15:06 +03:00
libcamera: pipeline: Add a get factory by name helper
Add a static helper to the PipelineHandlerFactoryBase class to allow retrieving a pipeline by name. Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
5ed35fca68
commit
353ccef143
2 changed files with 23 additions and 0 deletions
|
@ -114,6 +114,7 @@ public:
|
|||
const std::string &name() const { return name_; }
|
||||
|
||||
static std::vector<PipelineHandlerFactoryBase *> &factories();
|
||||
static const PipelineHandlerFactoryBase *getFactoryByName(const std::string &name);
|
||||
|
||||
private:
|
||||
static void registerType(PipelineHandlerFactoryBase *factory);
|
||||
|
|
|
@ -794,6 +794,28 @@ std::vector<PipelineHandlerFactoryBase *> &PipelineHandlerFactoryBase::factories
|
|||
return factories;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return the factory for the pipeline handler with name \a name
|
||||
* \param[in] name The pipeline handler name
|
||||
* \return The factory of the pipeline with name \a name, or nullptr if not found
|
||||
*/
|
||||
const PipelineHandlerFactoryBase *PipelineHandlerFactoryBase::getFactoryByName(const std::string &name)
|
||||
{
|
||||
const std::vector<PipelineHandlerFactoryBase *> &factories =
|
||||
PipelineHandlerFactoryBase::factories();
|
||||
|
||||
auto iter = std::find_if(factories.begin(),
|
||||
factories.end(),
|
||||
[&name](const PipelineHandlerFactoryBase *f) {
|
||||
return f->name() == name;
|
||||
});
|
||||
|
||||
if (iter != factories.end())
|
||||
return *iter;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* \class PipelineHandlerFactory
|
||||
* \brief Registration of PipelineHandler classes and creation of instances
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue