EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FairDbConfigurable.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FairDbConfigurable.cxx
1 #include "FairDbConfigurable.h"
2 #include "FairDbConf.h"
3 #include "FairDbConfDialog.h"
4 #include "FairDb.h"
5 
7 
8 //......................................................................
9 
10 FairDbConfigurable::FairDbConfigurable() : fDefConfig(), fConfig(false) { }
11 
12 //......................................................................
13 
15 
16 //......................................................................
17 
19 {
24  fDefConfig = r;
25 }
26 
27 //......................................................................
28 
30 {
35  return fDefConfig;
36 }
37 
39 {
44  return fConfig;
45 }
46 
48 {
54  return fConfig;
55 }
56 
57 //......................................................................
58 
60 {
66  if (! fConfig.IsDirty()) { return 0; } // Nothing to do if config is current
67  this->Config(); // Send the "reconfig" message
68  fConfig.SetDirty(false); // Mark the config. as current
69  return 1;
70 }
71 
72 //......................................................................
73 
75 {
76 //======================================================================
77 // Update the configuration parameters. Allow a FairDbDialog object to be
78 // passed in. If none is passed in use the default, text based dialog
79 // object.
80 //======================================================================
81  bool deleteDialog = false;
82  if (d==0) {
83  d = new FairDbConfDialog();
84  deleteDialog = true;
85  }
86 
87  // Set up d with the default configuration parameters
88  d->SetDefault(this->DefaultConfig());
89  d->SetCurrent(this->GetConfig());
90 
91  // Do the querry
92  FairRegistry r = d->Query();
93  this->GetConfig().UnLockValues();
94  this->GetConfig().Merge(r);
95  this->GetConfig().LockValues();
96 
97  // Clean up the dialog
98  if (deleteDialog) { delete d; d = 0; }
99 }
100 
101 //......................................................................
102 
103 void FairDbConfigurable::Set(const char* s)
104 {
109  FairRegistry r;
111  this->GetConfig().UnLockValues();
112  this->GetConfig().Merge(r);
113  this->GetConfig().LockValues();
114 }
115