20#include <unordered_set>
44 sequenced_command_stack (
new QUndoStack() ),
46 coreconfig (
nullptr ),
47 this_change_enabled (
false ),
48 this_total_objects ( 0 )
66 t_lock l ( ref().this_change_enabled_mutex );
67 return ref().this_change_enabled;
72 t_lock l ( this_change_enabled_mutex );
73 this_change_enabled =
true;
78 t_lock l ( this_change_enabled_mutex );
79 this_change_enabled =
false;
88 emit object_created ( src, obj );
94 emit object_renamed ( src, obj );
100 emit object_deleted ( src, obj );
106 emit object_changed ( src, obj );
114 IncludedFileCache = FileCache;
122 return ref().this_dblocation;
127 return ref().this_resource_location;
156 return ref().this_total_objects;
161 ref().this_total_objects += i;
166 ref().this_total_objects = i;
174void dbe::confaccessor::set_dbinfo<dbe::dbinfo::oks> ( QString
const & location )
176 static QString
const implementation (
"oksconflibs" );
178 this_dblocation = location;
179 this_resource_location = implementation +
":" + location;
185void dbe::confaccessor::set_dbinfo<dbe::dbinfo::roks> ( QString
const & location )
187 this_dblocation = location;
188 static QString
const implementation (
"roksconflibs" );
189 this_resource_location = implementation +
":" + location;
190 t_lock l ( this_change_enabled_mutex );
191 this_change_enabled =
true;
195void dbe::confaccessor::set_dbinfo<dbe::dbinfo::rdb> ( QString
const & location )
197 static QString
const implementation (
"rdbconfig" );
198 this_resource_location = implementation +
":" + location;
199 this_dblocation = this_resource_location;
200 t_lock l ( this_change_enabled_mutex );
201 this_change_enabled =
true;
229 ref().this_resource_location = Implementation;
244 if ( not fn.contains (
"schema" ) )
252 "\n\nCheck filename:", fn.toStdString() );
261 if ( ref().get_commands().get() )
263 ref().get_commands()->clear();
265 ref().get_internal_change_stack()->swap ( cleared );
279 std::list<std::string> dbs;
296 if ( subscribeToChanges ==
true ) {
315 catch ( dunedaq::conffwk::Exception
const & e )
327 std::list<std::string> tobecommited{};
329 if ( ref().is_database_loaded() )
338 catch ( dunedaq::conffwk::Exception
const & e )
349 QString DUNEDAQ_DB_PATH = getenv (
"DUNEDAQ_DB_PATH" );
350 QString GUI_DATA = getenv (
"OKS_GUI_INIT_DATA" );
352 QStringList CONFIG_DATABASE = GUI_DATA.split (
":", QString::SkipEmptyParts );
353 QStringList DUNEDAQ_DB_PATH_SPLIT = DUNEDAQ_DB_PATH.split (
":", QString::SkipEmptyParts );
357 std::vector<std::string> full_path_names;
359 for ( QString & FileName : CONFIG_DATABASE )
362 for ( QString & PATH : DUNEDAQ_DB_PATH_SPLIT )
364 QFileInfo CheckFile ( PATH +
"/" + FileName );
366 if ( CheckFile.exists() and CheckFile.isFile() )
368 QString fullpathname = PATH +
"/" + FileName;
369 full_path_names.push_back ( fullpathname.toStdString() );
380 return IncludedFileCache;
390 throw daq::dbe::ChangeNotAllowed (
ERS_HERE );
394 emit IncludeFileDone();
401 throw daq::dbe::ChangeNotAllowed (
ERS_HERE );
405 emit RemoveFileDone();
421 Q_UNUSED ( parameter );
424 external_change_stack.clear();
428 const auto& cl = Change->get_class_name();
429 const auto& mod = Change->get_modified_objs();
430 const auto& cre = Change->get_created_objs();
431 const auto& rem = Change->get_removed_objs();
433 external_change_stack.push_back ( { cl, mod, cre, rem } );
436 emit ExternalChangesAccepted();
std::stack< t_internal_change, std::vector< t_internal_change > > t_internal_changes_stack
static int get_total_objects()
void force_emit_object_created(QString const &, dref const)
static cptr< datahandler > gethandler()
void GetFileCache(QList< QStringList > &FileCache)
static void setdblocation(const QString &Implementation)
std::lock_guard< t_mutex > t_lock
void removefile(std::string const &db, std::string const &fn)
static t_undo_stack_cptr get_commands()
static void CallbackFunction(const std::vector< dunedaq::conffwk::ConfigurationChange * > &changes, void *parameter)
static void increase_total_objects(int const i)
static bool is_database_loaded()
static void unsubscribe()
static std::list< std::string > uncommitted_files()
void db_committed(const std::list< std::string > &files, const std::string &msg)
void force_emit_object_deleted(QString const &, dref const)
QList< QStringList > GetIncludedFileCache() const
static cptr< ui::config::info > guiconfig()
static void set_total_objects(int const i)
ui::config::info * coreconfig
static void clear_commands()
void force_emit_object_renamed(QString const &, dref const)
void force_emit_object_changed(QString const &, dref const)
static bool check_file_rw(const QString &FileName)
static QString dbfullname()
static t_internal_changes_stack_cptr get_internal_change_stack()
static bool load(bool subscribeToChanges=true)
static std::list< std::string > save(QString const &)
void docallback(std::vector< dunedaq::conffwk::ConfigurationChange * > const &changes, void *parameter)
static void setdbinfo(QString const &location, dbinfo const itype=dbinfo::oks)
static confaccessor & ref()
void addfile(std::string const &db, std::string const &fn)
static QString db_implementation_name()
static cptr< dunedaq::conffwk::Configuration > dbptr()
static cptr< dunedaq::conffwk::Configuration > database_concurrent_ptr
dbe::types::common::type_lock t_lock
static dunedaq::conffwk::Configuration * database
static dbe::types::common::type_mutex database_lock
Describes changes inside a class returned by the notification mechanism.
Describes a subscription criteria.
Defines base class for cache of template objects.
void prefetch_all_data()
Prefetch all data into client cache.
CallbackId subscribe(const ConfigurationSubscriptionCriteria &criteria, notify user_cb, void *user_param=nullptr)
Subscribe on configuration changes.
Generic configuration exception.
char const *const dbe_lib_internal_version
std::string const parse(ers::Issue const &)
#define dbe_compiled_version