9 std::ifstream f(_cacheFilePath);
12 data = nlohmann::json::parse(f);
14 catch(nlohmann::json::exception& ex) {
15 throw ChimeraTK::logic_error(
"Failed to parse " + _cacheFilePath +
": " + ex.what());
18 auto registers = data[
"catalogue"];
20 if(!data[
"catalogue"].is_array()) {
21 throw ChimeraTK::logic_error(
"malformed cache file, missing \"catalogue\" " + _cacheFilePath);
25 for(
auto& reg : registers) {
26 Tango::AttributeInfoEx info;
27 info.name = reg[
"name"].get<std::string>();
28 info.max_dim_x = reg[
"length"].get<
int>();
29 info.max_dim_y = reg[
"channels"].get<
int>();
30 info.data_type = reg[
"tangoTypeId"].get<
int>();
31 info.writable =
static_cast<Tango::AttrWriteType
>(reg[
"writable"].get<
int>());
32 if(info.max_dim_x == 1 && info.max_dim_y == 0) {
33 info.data_format = Tango::AttrDataFormat::SCALAR;
35 else if(info.max_dim_x > 1 && info.max_dim_y == 0) {
36 info.data_format = Tango::AttrDataFormat::SPECTRUM;
38 else if(info.max_dim_x > 1 && info.max_dim_y > 0) {
39 info.data_format = Tango::AttrDataFormat::IMAGE;