ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
MapFileParser.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4#include "MapFileParser.h"
5
6#include "JsonMapFileParser.h"
8
9#include <boost/algorithm/string/predicate.hpp>
10
11namespace ChimeraTK {
12
13 /********************************************************************************************************************/
14
15 std::pair<NumericAddressedRegisterCatalogue, MetadataCatalogue> MapFileParser::parse(const std::string& fileName) {
16 std::ifstream file;
17
18 file.open(fileName.c_str());
19 if(!file) {
20 throw ChimeraTK::logic_error("Cannot open file \"" + fileName + "\"");
21 }
22
23 if(boost::ends_with(fileName, ".jmap")) {
24 detail::JsonMapFileParser parser(fileName);
25 return parser.parse(file);
26 }
27 detail::TraditionalMapFileParser parser(fileName);
28 return parser.parse(file);
29 }
30
31 /********************************************************************************************************************/
32
33} // namespace ChimeraTK
static std::pair< NumericAddressedRegisterCatalogue, MetadataCatalogue > parse(const std::string &fileName)
Performs parsing of specified MAP file, resulting in catalogue objects describing all registers and m...
Exception thrown when a logic error has occured.
Definition Exception.h:51