1- // Copyright CERN and copyright holders of ALICE O2 . This software is
1+ // Copyright CERN and copyright holders of ALICE O3 . This software is
22// distributed under the terms of the GNU General Public License v3 (GPL
33// Version 3), copied verbatim in the file "COPYING".
44//
@@ -118,7 +118,6 @@ inline CardDescriptor findCard(const Parameters::CardIdType& id)
118118 BOOST_THROW_EXCEPTION (Exception () << ErrorInfo::Message (" Invalid Card ID" ));
119119 }
120120}
121- #endif
122121
123122// / Helper template method for the channel factories.
124123// / \param serialNumber Serial number of the card
@@ -143,11 +142,6 @@ std::unique_ptr<Interface> channelFactoryHelper(const Parameters& params, int du
143142 }
144143 };
145144
146- #ifndef ALICEO2_READOUTCARD_PDA_ENABLED
147- // If PDA is NOT enabled we only make dummies
148- return makeDummy ();
149- #else
150-
151145 auto id = params.getCardIdRequired ();
152146
153147 // First check if we got a dummy serial number
@@ -168,7 +162,27 @@ std::unique_ptr<Interface> channelFactoryHelper(const Parameters& params, int du
168162 BOOST_THROW_EXCEPTION (Exception () << ErrorInfo::Message (" Instantiation function for card type not available" )
169163 << ErrorInfo::CardType (cardDescriptor.cardType ) << ErrorInfo::CardId (id));
170164 }
165+ #else
166+
167+ template <typename Interface>
168+ std::unique_ptr<Interface> channelFactoryHelper (const Parameters& /* params*/ , int /* dummySerial*/ ,
169+ const std::map<CardType::type, std::function<std::unique_ptr<Interface>()>>& map)
170+ {
171+ auto makeDummy = [&]() {
172+ auto iter = map.find (CardType::Dummy);
173+ if (iter != map.end ()) {
174+ return iter->second ();
175+ } else {
176+ BOOST_THROW_EXCEPTION (Exception ()
177+ << ErrorInfo::Message (" Instantiation function for Dummy card type not available" ));
178+ }
179+ };
180+
181+ // If PDA is NOT enabled we only make dummies
182+ return makeDummy ();
183+
171184#endif
185+
172186}
173187
174188} // namespace ChannelFactoryUtils
0 commit comments