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 51 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 253 of file config_api_get.cpp.

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

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

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