You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/configurationParameters.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ The *receiverFMQ-\** section defines parameters for the test receiverFMQ.exe pro
11
11
12
12
Please see the provided example configuration files to see how they are usually arranged.
13
13
14
+
It is possible to define some default parameters to be used in all matching sections by creating a section which name ends with "-\*" and containing some key-value pairs. These pairs are applied to all sections with similar names. Existing key-value pairs are not overwritten, but are defined according to these defaults if they don't exist. It can be useful to create multiple equipments with similar settings.
15
+
14
16
## Parameter types
15
17
16
18
The following table describes the types used in the configuration, giving:
Copy file name to clipboardExpand all lines: doc/releaseNotes.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -520,3 +520,6 @@ This file describes the main feature changes for each readout.exe released versi
520
520
- added equipment-cruemulator-*.PayloadSizeStdev: generate payload with random size (gaussian distribution mean=PayloadSize sigma=PayloadSizeStdev).
521
521
- added equipment-cruemulator-*.linkThroughput: set incoming link data throughput (in Gbps).
522
522
- Minor logging updates.
523
+
524
+
## nect version
525
+
- Updated configuration syntax: section names ending with "-*" can be used to define default parameters. They are applied to all section with similar names. Existing key-value pairs are not overwritten, but are defined according to defaults if they don't exist. For example, it is possible to define the TFperiod for all equipments by adding a section named "equipment-*" with "TFperiod=32".
// function returns true when end of string matches tag
679
+
auto isEndOfStringMatching = [&](const std::string &s, constchar* tag) {
680
+
if (s.length()<=strlen(tag)) returnfalse;
681
+
if (s.substr(s.length()-strlen(tag)) != tag) returnfalse;
682
+
returntrue;
683
+
};
684
+
for (boost::property_tree::ptree::iterator pos = cfg.get().begin(); pos != cfg.get().end();) {
685
+
const std::string section = pos->first;
686
+
if (!isEndOfStringMatching(section, defaultTag)) {
687
+
++pos;
688
+
continue;
689
+
}
690
+
auto smatch = section.substr(0,section.length()-strlen(defaultTag));
691
+
for (boost::property_tree::ptree::iterator pos2 = cfg.get().begin(); pos2 != cfg.get().end();++pos2) {
692
+
if (pos2 == pos) continue; // do not self-overwrite
693
+
const std::string section2 = pos2->first;
694
+
if (section2.compare(0,smatch.length(),smatch)) continue; // mismatch
695
+
if (isEndOfStringMatching(section2, defaultTag)) continue; // do not overwrite other defaults sections
696
+
theLog.log(LogInfoDevel_(3002), "Updating configuration section [%s] with defaults from [%s]", pos2->first.c_str(), pos->first.c_str());
697
+
appendConfig(pos2->second,pos->second);
698
+
}
699
+
// delete section with defaults, to avoid it is used further
700
+
pos = cfg.get().erase(pos);
701
+
}
702
+
663
703
// extract optional configuration parameters
664
704
// configuration parameter: | readout | customCommands | string | | List of key=value pairs defining some custom shell commands to be executed at before/after state change commands. |
665
705
if (customCommandsShellPid) {
@@ -846,11 +886,8 @@ int Readout::configure(const boost::property_tree::ptree& properties)
846
886
for (autokName : ConfigFileBrowser(&cfg, "bank-")) {
847
887
// skip disabled
848
888
int enabled = 1;
849
-
try {
850
-
// configuration parameter: | bank-* | enabled | int | 1 | Enable (1) or disable (0) the memory bank. |
851
-
enabled = cfg.getValue<int>(kName + ".enabled");
852
-
} catch (...) {
853
-
}
889
+
// configuration parameter: | bank-* | enabled | int | 1 | Enable (1) or disable (0) the memory bank. |
@@ -957,7 +987,11 @@ int Readout::configure(const boost::property_tree::ptree& properties)
957
987
try {
958
988
// configuration parameter: | consumer-* | consumerType | string | | The type of consumer to be instanciated. One of:stats, FairMQDevice, DataSampling, FairMQChannel, fileRecorder, checker, processor, tcp. |
0 commit comments