DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::config::api::get::file Class Reference

#include <config_api_get.hpp>

Static Public Member Functions

static QStringList inclusions (QStringList const &candidates, QStringList files={ })
 
static QStringList inclusions_singlefile (QString const &)
 

Detailed Description

Definition at line 46 of file config_api_get.hpp.

Member Function Documentation

◆ inclusions()

QStringList dbe::config::api::get::file::inclusions ( QStringList const & candidates,
QStringList files = { } )
static

Retrieve a list of files included from the database created from the given filename by parsin all the files included in the file and its inclusions.

Parameters
rootfilename
Returns
a list of files

Definition at line 248 of file config_api_get.cpp.

249{
250 if ( candidates.isEmpty() )
251 {
252 return files;
253 }
254 else
255 {
256 QStringList newcandidates =
257 { };
258
259 for ( QString const & fname : candidates )
260 {
261 if ( not ( fname.contains ( "schema" ) or files.contains ( fname ) ) )
262 {
263 files.push_back ( fname );
264 // Query the current file for other inclusions
265 std::list<std::string> configfiles;
266
267 try
268 {
269 if ( not ( fname.contains ( "rdbconfig:" ) or fname.contains ( "roksconflibs:" ) ) )
270 {
271 // Process file based sources
272 dbaccessor::dbptr()->get_includes ( fname.toStdString(), configfiles );
273 }
274 else
275 {
276 // Process other sources (e.g. Oracle and RDB )
277 dbaccessor::dbptr()->get_includes ( "", configfiles );
278 files.removeAll ( fname ); // Once used RDB / Oracle sources must be removed
279 }
280 }
281 catch ( dunedaq::conffwk::Exception const & ex )
282 {
283 ERROR ( "Include did not succeed for ", dbe::config::errors::parse ( ex ).c_str(),
284 "filename:", fname.toStdString().c_str() );
285 }
286
287 // Keep only files that have not already been processed
288 // i.e. they are not in the list of given files.
289 for ( std::string const & configfile : configfiles )
290 {
291 QString const & qconfigfile = QString::fromStdString ( configfile );
292
293 if ( not files.contains ( qconfigfile ) )
294 {
295 newcandidates.push_back ( qconfigfile );
296 }
297 }
298
299 }
300
301 }
302
303 return get::file::inclusions ( newcandidates, files );
304 }
305}
static QStringList inclusions(QStringList const &candidates, QStringList files={ })
static cptr< dunedaq::conffwk::Configuration > dbptr()
#define ERROR(...)
Definition messenger.hpp:88
std::string const parse(ers::Issue const &)

◆ inclusions_singlefile()

QStringList dbe::config::api::get::file::inclusions_singlefile ( QString const & FileName)
static

Retrieve a list of of files from a single file

Parameters
thefile name to process
Returns
the list of files

Definition at line 310 of file config_api_get.cpp.

311{
312 std::string dbname = FileName.toStdString();
313 std::list<std::string> incList;
314
315 QStringList dbfiles;
316
317 try
318 {
319 dbaccessor::dbptr()->get_includes ( dbname, incList );
320
321 for ( std::string const & includeName : incList )
322 {
323 dbfiles.push_back ( QString ( includeName.c_str() ) );
324 }
325 }
326 catch ( dunedaq::conffwk::Exception & ex )
327 {
328 WARN ( "Include : Could not retrieve included files",
329 dbe::config::errors::parse ( ex ).c_str() );
330 }
331
332 return dbfiles;
333}
#define WARN(...)
Definition messenger.hpp:80

The documentation for this class was generated from the following files: