Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  17 Nov 2020, Stefan Ritt, Info, Equipment "common" settings in ODB 
    Reply  20 Nov 2020, Pierre-Andre Amaudruz, Info, Equipment "common" settings in ODB 
    Reply  27 Nov 2020, Konstantin Olchanski, Info, Equipment "common" settings in ODB 
       Reply  27 Nov 2020, Stefan Ritt, Info, Equipment "common" settings in ODB 
          Reply  27 Nov 2020, Konstantin Olchanski, Info, Equipment "common" settings in ODB 
             Reply  30 Nov 2020, Stefan Ritt, Info, Equipment "common" settings in ODB 
                Reply  30 Nov 2020, Stefan Ritt, Info, Equipment "common" settings in ODB 
                   Reply  30 Nov 2020, Konstantin Olchanski, Info, Equipment "common" settings in ODB 
Message ID: 2036     Entry time: 27 Nov 2020     In reply to: 2032     Reply to this: 2037
Author: Stefan Ritt 
Topic: Info 
Subject: Equipment "common" settings in ODB 
Ok, so what about the following proposal:

- I change back the mfe.cxx code to behave like before (ODB has precedence and does not get overwritten when the 
front-end restarts)

- I add a global flag

BOOL equipment_common_overwrite;

and pre-set it to FALSE;

- So if nothing is changed the flag stays false and ODB keeps precedence

- If a frontend wants to overwrite equipment/common on each start, the user sets

BOOL equipment_common_overwrite = TRUE;

near the equipment[] structure in the front-end code. 

- If the flag is true, the mfe.cxx init code copies the equipment[] structure to the ODB on each frontend start

I believe this way we can keep backward compatibility, and add the new way with minimal effort. The only downside 
is that all frontends on this plane have to add at least "BOOL equipment_common_overwrite = FALSE;" in their 
code.

I know global variables are evil, but this way the user can just add the line above to the equipment[] array, so 
one sees this when one edits the equipment[] array, giving motivation to change as needed. So the code would be



BOOL equipment_common_overwrite = TRUE;

EQUIPMENT equipment[] = {
 ....
}



An alternative way would be to add a function

  set_equipment_common_overwrite(TRUE);

into the frontend_init() code. That's somehow cleaner (still needs an internal global variable), but it has to go 
into frontend_init() so won't be at the same place as the EQUIPMENT list in the frontend.

Thoughts?

Best,
Stefan
ELOG V3.1.4-2e1708b5