32 std::map<MediaId,MediaProcessUnit::Manager*> m_pipelineManagers;
33 std::map<std::string,std::map<MediaId,std::shared_ptr<MediaProcessUnitPipeline>> > m_pipelines;
36 std::map<std::string,std::map<MediaId,std::shared_ptr<MediaAnalysisDumper> > > m_analysisDumpers;
45MediaProcessorsPrivate::MediaProcessorsPrivate() :
46 m_pipelineManagers(), m_pipelines(), m_analysisDumpers()
50MediaProcessors::MediaProcessors() :
64 for (
auto it = m_d->m_pipelineManagers.begin();
65 it != m_d->m_pipelineManagers.end(); it++ )
82 return m_d->m_pipelineManagers;
91 LDEBUG <<
"MediaProcessors::initMedia" << med;
104 auto&
module = m_d->m_pipelineManagers[med]->getModuleConfigurationStructure();
105 m_d->includeProcessors(module, module);
110 const std::deque<std::string>& pipelines )
115 std::deque<std::string> pipelinesToInit ( pipelines );
116 std::map<std::string, std::map<std::string, std::string> > allpipelines;
119 allpipelines = confGroup.
getMaps();
124 LERROR <<
"no group 'declaration' to configure linguistic pipelines ";
129 if ( pipelinesToInit.empty() )
131 for (
auto mapItr = allpipelines.cbegin();
132 mapItr != allpipelines.cend(); mapItr++ )
134 pipelinesToInit.push_back( mapItr->first );
139 LDEBUG <<
"MediaProcessors::initPipelines ";
140 for (
auto pipItr = pipelinesToInit.cbegin();
141 pipItr != pipelinesToInit.cend(); pipItr++ )
143 LDEBUG <<
"\t" << *pipItr <<
", ";
147 for (
auto pipItr = pipelinesToInit.cbegin();
148 pipItr != pipelinesToInit.cend(); pipItr++ )
151 const map<string,string>& pipelineMapping=allpipelines[*pipItr];
152 if ( pipelineMapping.empty() )
155 LERROR <<
"no pipeline '" << *pipItr
156 <<
"' defined in pipeline declaration module!";
159 for (
auto mapItr = m_d->m_pipelineManagers.cbegin();
160 mapItr != m_d->m_pipelineManagers.cend(); mapItr++ )
162 const std::string& mediaStr=MediaticData::single().getMediaId ( mapItr->first );
163 auto entryItr = pipelineMapping.find ( mediaStr );
164 if ( entryItr == pipelineMapping.end() )
167 LINFO <<
"no pipeline '" << *pipItr <<
"' for media " << mediaStr;
171 LDEBUG <<
"MediaProcessors::initPipelines instanciating"
174 std::shared_ptr<MediaProcessUnit> pu =
nullptr;
177 pu = mapItr->second->getObject( entryItr->second );
185 LERROR <<
"no process unit '" << entryItr->second <<
"' for media " << mediaStr;
188 auto pipeline = std::dynamic_pointer_cast<MediaProcessUnitPipeline> ( pu );
189 if ( pipeline==
nullptr )
192 LERROR <<
"pipeline '" << *pipItr <<
"' for media "
193 << mediaStr <<
" is not of type ProcessUnitPipeline!";
196 m_d->m_pipelines[*pipItr][mapItr->first]=pipeline;
204 const std::string&
id )
const
206 auto pipItr = m_d->m_pipelines.find (
id );
207 if ( pipItr == m_d->m_pipelines.end() )
210 LERROR <<
"no pipeline type '" <<
id <<
"' defined in media " << med
211 <<
" configuration file !";
214 auto medItr = pipItr->second.find ( med );
215 if ( medItr==pipItr->second.end() )
218 LERROR <<
"no media [" << med <<
":"
219 << MediaticData::single().getMediaId(med).c_str()
220 <<
"] defined for pipeline '" <<
id.c_str()
221 <<
"' in the configuration file!";
224 return medItr->second;
229 const std::string& type )
const
232 auto dumpItr = m_d->m_analysisDumpers.find ( type );
233 if ( dumpItr == m_d->m_analysisDumpers.end() )
235 LWARN <<
"no dumper type '" << type <<
"' defined in media " << med
236 <<
" configuration file ";
239 auto medItr = dumpItr->second.find ( med );
240 if ( medItr==dumpItr->second.end() )
242 LWARN <<
"no media [" << med <<
":"
243 << MediaticData::single().getMediaId(med) <<
"] defined for dumper '"
244 << type <<
"' in the configuration file !";
247 return medItr->second;
253 for (
auto & kv : m_d->m_pipelines )
255 for (
auto & id2pipeline : kv.second )
257 ids.insert(id2pipeline.first);
265 for (
auto & kv : m_d->m_pipelines )
267 if (kv.second.cend() != kv.second.find(
id))
269 pipelines.insert(kv.first);
276void MediaProcessorsPrivate::includeProcessors(
284 for (
auto it = includeList.cbegin(); it!=includeList.cend(); it++)
286 string::size_type i=(*it).find(
"/");
287 if ( i== string::npos)
295 std::string moduleName(
"");
301 std::string((*it),0,i).c_str());
303 moduleName = std::string((*it),i+1);
307 module.addModule(newMod);
319 includeProcessors(module,newMod);
327 catch (std::exception& )
#define PROCESSORSLOGINIT
const std::map< std::string, std::map< std::string, std::string > > & getMaps()
std::deque< std::string > & getListValuesAtKeyOfGroupNamed(const std::string &key, const std::string &name)
return a message when a 'group' was not found
return a message when a 'list' was not found
return a message when a 'module' is not found
Parser class for the lima's xml configuration files.
InitializableObjectManager< Base, InitializationParameters > Manager
Manager is the type of the Manager associated to the initializableObject.
Use this exception to signal an error in one of the configuration files.
virtual const char * what() const override
Defines access method for the singleton pattern.
static const MediaticData & single()
const singleton accessor
originally detectModuleConfigurationStructure.h in detectlibraries
QString findFileInPaths(const QString &paths, const QString &fileName, const QChar &separator)
Find the given file in the given paths.
launch exception related to the configuration file parsing