25#include <unordered_set>
49 sequenced_command_stack (
new QUndoStack() ),
51 coreconfig (
nullptr ),
52 this_change_enabled (
false ),
53 this_total_objects ( 0 )
72 return ref().this_change_enabled;
127 return ref().this_dblocation;
132 return ref().this_resource_location;
161 return ref().this_total_objects;
166 ref().this_total_objects += i;
171 ref().this_total_objects = i;
181 static QString
const implementation (
"oksconflibs" );
183 this_dblocation = location;
184 this_resource_location = implementation +
":" + location;
192 this_dblocation = location;
193 static QString
const implementation (
"roksconflibs" );
194 this_resource_location = implementation +
":" + location;
195 t_lock l ( this_change_enabled_mutex );
196 this_change_enabled =
true;
202 static QString
const implementation (
"rdbconfig" );
203 this_resource_location = implementation +
":" + location;
204 this_dblocation = this_resource_location;
205 t_lock l ( this_change_enabled_mutex );
206 this_change_enabled =
true;
234 ref().this_resource_location = Implementation;
249 if ( not fn.endsWith (
".schema.xml" ) )
254 catch ( dunedaq::conffwk::Generic
const & ex )
257 "\n\nCheck filename:", fn.toStdString() );
268 ref().get_commands()->clear();
270 ref().get_internal_change_stack()->swap ( cleared );
284 std::list<std::string> dbs;
301 if ( subscribeToChanges ==
true ) {
320 catch ( dunedaq::conffwk::Exception
const & e )
332 std::list<std::string> tobecommited{};
343 catch ( dunedaq::conffwk::Exception
const & e )
346 throw daq::dbe::CouldNotCommitChanges (
ERS_HERE,
"confaccessor", e );
355 QString DUNEDAQ_DB_PATH = getenv (
"DUNEDAQ_DB_PATH" );
356 QString GUI_DATA = getenv (
"OKS_GUI_INIT_DATA" );
358 QStringList CONFIG_DATABASE = GUI_DATA.split (
":", Qt::SkipEmptyParts );
359 QStringList DUNEDAQ_DB_PATH_SPLIT = DUNEDAQ_DB_PATH.split (
":", Qt::SkipEmptyParts );
363 std::vector<std::string> full_path_names;
365 for ( QString & FileName : CONFIG_DATABASE )
368 for ( QString & PATH : DUNEDAQ_DB_PATH_SPLIT )
370 QFileInfo CheckFile ( PATH +
"/" + FileName );
372 if ( CheckFile.exists() and CheckFile.isFile() )
374 QString fullpathname = PATH +
"/" + FileName;
375 full_path_names.push_back ( fullpathname.toStdString() );
396 throw daq::dbe::ChangeNotAllowed (
ERS_HERE );
407 throw daq::dbe::ChangeNotAllowed (
ERS_HERE );
427 Q_UNUSED ( parameter );
434 const auto& cl = Change->get_class_name();
435 const auto& mod = Change->get_modified_objs();
436 const auto& cre = Change->get_created_objs();
437 const auto& rem = Change->get_removed_objs();
std::lock_guard< t_mutex > t_lock
static int get_total_objects()
QList< QStringList > IncludedFileCache
void force_emit_object_created(QString const &, dref const)
static cptr< datahandler > gethandler()
cptr< t_internal_changes_stack > t_internal_changes_stack_cptr
void GetFileCache(QList< QStringList > &FileCache)
void object_created(QString const &source, dref const &obj)
static void setdblocation(const QString &Implementation)
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()
cptr< t_undo_stack > t_undo_stack_cptr
void ExternalChangesAccepted()
static void unsubscribe()
t_external_changes_stack external_change_stack
static std::list< std::string > uncommitted_files()
std::stack< t_internal_change, std::vector< t_internal_change > > t_internal_changes_stack
void db_committed(const std::list< std::string > &files, const std::string &msg)
t_undo_stack * sequenced_command_stack
std::shared_ptr< t_internal_changes_stack > internal_change_stack
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)
void object_deleted(QString const &source, dref const &obj)
void object_renamed(QString const &source, dref const &obj)
static bool check_file_rw(const QString &FileName)
void object_changed(QString const &source, dref const &obj)
static QString dbfullname()
static t_internal_changes_stack_cptr get_internal_change_stack()
static bool load(bool subscribeToChanges=true)
QString this_resource_location
t_mutex this_change_enabled_mutex
static std::list< std::string > save(QString const &)
void docallback(std::vector< dunedaq::conffwk::ConfigurationChange * > const &changes, void *parameter)
void set_dbinfo(QString const &p)
static void setdbinfo(QString const &location, dbinfo const itype=dbinfo::oks)
static confaccessor & ref()
dunedaq::conffwk::Configuration::CallbackId CallId
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.
char const *const dbe_lib_internal_version
std::string const parse(ers::Issue const &)
config_object_description dref
#define dbe_compiled_version