88#include " ReadoutCard/CardConfigurator.h"
99#include " ReadoutCard/ChannelFactory.h"
1010
11- namespace AliceO2 {
12- namespace roc {
11+ namespace AliceO2
12+ {
13+ namespace roc
14+ {
1315
1416CardConfigurator::CardConfigurator (Parameters::CardIdType cardId, std::string pathToConfigFile, bool forceConfigure)
15- {
17+ {
1618 auto parameters = Parameters::makeParameters (cardId, 2 ); // have to make parameters for this case, bar2
1719 try {
1820 parseConfigFile (pathToConfigFile, parameters);
@@ -38,7 +40,6 @@ CardConfigurator::CardConfigurator(Parameters& parameters, bool forceConfigure)
3840 }
3941}
4042
41-
4243// / pathToConfigFile: Has to start with "file:"
4344void CardConfigurator::parseConfigFile (std::string pathToConfigFile, Parameters& parameters)
4445{
@@ -56,7 +57,6 @@ void CardConfigurator::parseConfigFile(std::string pathToConfigFile, Parameters&
5657 GbtMode::type gbtMode = GbtMode::type::Gbt;
5758 DownstreamData::type downstreamData = DownstreamData::type::Ctp;
5859
59-
6060 // Open the file
6161 try {
6262 if (!strncmp (pathToConfigFile.c_str (), " file:" , 5 )) {
@@ -70,52 +70,52 @@ void CardConfigurator::parseConfigFile(std::string pathToConfigFile, Parameters&
7070 }
7171
7272 // * Global *//
73- for (auto globalGroup: ConfigFileBrowser (&configFile, " cru" )) { // Is there another way to do this?
73+ for (auto globalGroup : ConfigFileBrowser (&configFile, " cru" )) { // Is there another way to do this?
7474 std::string parsedString;
7575 try {
7676 parsedString = configFile.getValue <std::string>(globalGroup + " .clock" );
7777 clock = Clock::fromString (parsedString);
78- } catch (...) {
78+ } catch (...) {
7979 throw std::runtime_error (" Invalid or missing clock property" );
8080 }
8181
8282 try {
8383 parsedString = configFile.getValue <std::string>(globalGroup + " .datapathmode" );
8484 datapathMode = DatapathMode::fromString (parsedString);
85- } catch (...) {
85+ } catch (...) {
8686 throw std::runtime_error (" Invalid or missing datapath mode property" );
8787 }
8888
8989 try {
9090 parsedString = configFile.getValue <std::string>(globalGroup + " .gbtmode" );
9191 gbtMode = GbtMode::fromString (parsedString);
92- } catch (...) {
92+ } catch (...) {
9393 throw (" Invalid or missing gbtmode property" );
9494 }
9595
9696 try {
9797 parsedString = configFile.getValue <std::string>(globalGroup + " .downstreamdata" );
9898 downstreamData = DownstreamData::fromString (parsedString);
99- } catch (...) {
99+ } catch (...) {
100100 throw (" Invalid or missing downstreamdata property" );
101101 }
102102
103103 try {
104104 loopback = configFile.getValue <bool >(globalGroup + " .loopback" );
105- } catch (...) {
105+ } catch (...) {
106106 throw (" Invalid or missing loopback property" );
107107 }
108108
109109 try {
110110 ponUpstream = configFile.getValue <bool >(globalGroup + " .ponupstream" );
111- } catch (...) {
111+ } catch (...) {
112112 throw (" Invalid or missing ponupstream property" );
113113 }
114114
115115 try {
116116 parsedString = configFile.getValue <std::string>(globalGroup + " .onuaddress" );
117117 onuAddress = Hex::fromString (parsedString);
118- } catch (...) {
118+ } catch (...) {
119119 throw (" Invalid or missing onuAddress property" );
120120 }
121121
@@ -128,7 +128,7 @@ void CardConfigurator::parseConfigFile(std::string pathToConfigFile, Parameters&
128128
129129 try {
130130 allowRejection = configFile.getValue <bool >(globalGroup + " .allowrejection" );
131- } catch (...) {
131+ } catch (...) {
132132 throw (" Invalid or missing allowrejection property" );
133133 }
134134 }
@@ -144,7 +144,7 @@ void CardConfigurator::parseConfigFile(std::string pathToConfigFile, Parameters&
144144 parameters.setAllowRejection (allowRejection);
145145
146146 // * Per link *//
147- for (auto configGroup: ConfigFileBrowser (&configFile, " link" )) {
147+ for (auto configGroup : ConfigFileBrowser (&configFile, " link" )) {
148148
149149 bool enabled = false ;
150150 std::string gbtMux;
@@ -154,8 +154,8 @@ void CardConfigurator::parseConfigFile(std::string pathToConfigFile, Parameters&
154154 try {
155155 enabled = configFile.getValue <bool >(configGroup + " .enabled" );
156156 if (enabled) {
157- for (int i= 0 ; i< 24 ; i++) {
158- linkMask.insert ((uint32_t ) i);
157+ for (int i = 0 ; i < 24 ; i++) {
158+ linkMask.insert ((uint32_t )i);
159159 }
160160 }
161161 } catch (...) {
@@ -164,18 +164,18 @@ void CardConfigurator::parseConfigFile(std::string pathToConfigFile, Parameters&
164164
165165 try {
166166 gbtMux = configFile.getValue <std::string>(configGroup + " .gbtmux" );
167- for (int i= 0 ; i< 24 ; i++) {
168- gbtMuxMap.insert (std::make_pair ((uint32_t ) i, GbtMux::fromString (gbtMux)));
167+ for (int i = 0 ; i < 24 ; i++) {
168+ gbtMuxMap.insert (std::make_pair ((uint32_t )i, GbtMux::fromString (gbtMux)));
169169 }
170- } catch (...) {
170+ } catch (...) {
171171 throw (" Invalid or missing gbt mux property for all links" );
172172 }
173173 continue ;
174174 }
175175
176176 /* configure for individual links */
177177 std::string linkIndexString = configGroup.substr (configGroup.find (" k" ) + 1 );
178- uint32_t linkIndex = std::stoul (linkIndexString, NULL , 10 );
178+ uint32_t linkIndex = std::stoul (linkIndexString, NULL , 10 );
179179
180180 try {
181181 enabled = configFile.getValue <bool >(configGroup + " .enabled" );
@@ -184,7 +184,7 @@ void CardConfigurator::parseConfigFile(std::string pathToConfigFile, Parameters&
184184 } else {
185185 linkMask.erase (linkIndex);
186186 }
187- } catch (...) {
187+ } catch (...) {
188188 throw (" Invalid or missing enabled property for link: " + linkIndexString);
189189 }
190190
@@ -195,7 +195,7 @@ void CardConfigurator::parseConfigFile(std::string pathToConfigFile, Parameters&
195195 } else {
196196 gbtMuxMap.insert (std::make_pair (linkIndex, GbtMux::fromString (gbtMux)));
197197 }
198- } catch (...) {
198+ } catch (...) {
199199 throw (" Invalid or missing gbt mux set for link: " + linkIndexString);
200200 }
201201 }
0 commit comments