LCOV - code coverage report
Current view: top level - dbe/src/internal - config_api_set.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 11.8 % 85 10
Test Date: 2026-10-11 15:05:20 Functions: 50.0 % 4 2

            Line data    Source code
       1              : // DUNE DAQ modification notice:
       2              : // This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
       3              : // Fork baseline commit: dbe-02-12-17 (2022-05-12).
       4              : // Renamed since fork: no.
       5              : 
       6              : /*
       7              :  * config_api_set.cpp
       8              :  *
       9              :  *  Created on: Apr 19, 2016
      10              :  *      Author: Leonidas Georgopoulos
      11              :  */
      12              : 
      13              : #include "dbe/config_api_set.hpp"
      14              : #include "dbe/Conversion.hpp"
      15              : #include "dbe/config_api.hpp"
      16              : #include "dbe/config_api_commands.hpp"
      17              : #include "dbe/config_api_info.hpp"
      18              : #include "dbe/config_object_key.hpp"
      19              : #include "dbe/dbcontroller.hpp"
      20              : 
      21              : #include "conffwk/Schema.hpp"
      22              : 
      23              : #include <QString>
      24              : 
      25              : #include <algorithm>
      26              : #include <iterator>
      27              : #include <stdint.h>
      28              : #include <sys/types.h>
      29              : 
      30              : //------------------------------------------------------------------------------------------
      31              : // NAMESPACE DBE::CONFIG::API::SET::NOACTIONS
      32              : //------------------------------------------------------------------------------------------
      33              : namespace dbe {
      34              : namespace config {
      35              : namespace api {
      36              : namespace set {
      37              : namespace noactions {
      38              : 
      39              : void
      40            1 : relation(tref object, dunedaq::conffwk::relationship_t const& arelation, std::vector<dbe::cokey> const& keys)
      41              : {
      42            1 :   std::vector<dbe::inner::configobject::tref> trefs;
      43              : 
      44            1 :   for (dbe::cokey const& key : keys) {
      45            0 :     trefs.push_back(dbe::inner::dbcontroller::get(key));
      46              :   }
      47              : 
      48            1 :   dbe::config::api::set::noactions::relation(object, arelation, trefs);
      49            1 : }
      50              : 
      51              : void
      52            1 : relation(tref src, dunedaq::conffwk::relationship_t const& edge, std::vector<tref> const& targets)
      53              : {
      54            1 :   try {
      55            1 :     if (not targets.empty()) {
      56            0 :       if (info::relation::is_simple(edge)) {
      57            0 :         src.set_obj(edge.p_name, targets.back());
      58              :       } else {
      59            0 :         src.set_objs(edge.p_name, targets);
      60              :       }
      61              :     } else {
      62            1 :       src.set_obj_null(edge.p_name, info::relation::is_simple(edge));
      63              :     }
      64            0 :   } catch (dunedaq::conffwk::Exception const& e) {
      65            0 :     throw daq::dbe::ObjectChangeWasNotSuccessful(ERS_HERE, config::errors::parse(e));
      66            0 :   }
      67            1 : }
      68              : //------------------------------------------------------------------------------------------
      69              : }
      70              : }
      71              : }
      72              : }
      73              : }
      74              : //------------------------------------------------------------------------------------------
      75              : 
      76              : //------------------------------------------------------------------------------------------
      77              : // NAMESPACE DBE::CONFIG::API::SET
      78              : //------------------------------------------------------------------------------------------
      79              : namespace dbe {
      80              : namespace config {
      81              : namespace api {
      82              : namespace set {
      83              : 
      84              : //------------------------------------------------------------------------------------------
      85              : void
      86            0 : relation(tref src, dunedaq::conffwk::relationship_t const& edge, QStringList const& targets)
      87              : {
      88            0 :   std::vector<std::string> targetnames;
      89              : 
      90            0 :   for (QString const& name : targets) {
      91            0 :     targetnames.push_back(name.toStdString());
      92              :   }
      93              : 
      94            0 :   commands::modobj(src, edge, targetnames);
      95            0 : }
      96              : //------------------------------------------------------------------------------------------
      97              : 
      98              : //------------------------------------------------------------------------------------------
      99              : void
     100            0 : attribute(tref Object, dunedaq::conffwk::attribute_t const& attribute_info, QStringList const& values)
     101              : {
     102            0 :   switch (attribute_info.p_type) {
     103            0 :     case dunedaq::conffwk::bool_type: {
     104            0 :       if (attribute_info.p_is_multi_value) {
     105            0 :         commands::modobj(Object, attribute_info, convert::to<std::vector<bool>>(values, attribute_info.p_int_format));
     106              :       } else {
     107            0 :         commands::modobj(Object, attribute_info, convert::to<bool>(values, attribute_info.p_int_format));
     108              :       }
     109              : 
     110              :       break;
     111              :     }
     112              : 
     113            0 :     case dunedaq::conffwk::enum_type:
     114            0 :     case dunedaq::conffwk::date_type:
     115            0 :     case dunedaq::conffwk::time_type:
     116            0 :     case dunedaq::conffwk::string_type:
     117            0 :     case dunedaq::conffwk::class_type: {
     118            0 :       if (attribute_info.p_is_multi_value) {
     119            0 :         commands::modobj(Object, attribute_info, convert::to<std::vector<std::string>>(values));
     120              :       } else {
     121            0 :         commands::modobj(Object, attribute_info, convert::to<std::string>(values));
     122              :       }
     123              : 
     124              :       break;
     125              :     }
     126              : 
     127            0 :     case dunedaq::conffwk::float_type: {
     128            0 :       if (attribute_info.p_is_multi_value) {
     129            0 :         commands::modobj(Object, attribute_info, convert::to<std::vector<float>>(values, attribute_info.p_int_format));
     130              :       } else {
     131            0 :         commands::modobj(Object, attribute_info, convert::to<float>(values, attribute_info.p_int_format));
     132              :       }
     133              : 
     134              :       break;
     135              :     }
     136              : 
     137            0 :     case dunedaq::conffwk::double_type: {
     138            0 :       if (attribute_info.p_is_multi_value) {
     139            0 :         commands::modobj(Object, attribute_info, convert::to<std::vector<double>>(values, attribute_info.p_int_format));
     140              :       } else {
     141            0 :         commands::modobj(Object, attribute_info, convert::to<double>(values, attribute_info.p_int_format));
     142              :       }
     143              : 
     144              :       break;
     145              :     }
     146              : 
     147            0 :     case dunedaq::conffwk::s8_type: {
     148            0 :       if (attribute_info.p_is_multi_value) {
     149            0 :         commands::modobj(Object, attribute_info, convert::to<std::vector<int8_t>>(values, attribute_info.p_int_format));
     150              :       } else {
     151            0 :         commands::modobj(Object, attribute_info, convert::to<int8_t>(values, attribute_info.p_int_format));
     152              :       }
     153              : 
     154              :       break;
     155              :     }
     156              : 
     157            0 :     case dunedaq::conffwk::s16_type: {
     158            0 :       if (attribute_info.p_is_multi_value) {
     159            0 :         commands::modobj(
     160            0 :           Object, attribute_info, convert::to<std::vector<int16_t>>(values, attribute_info.p_int_format));
     161              :       } else {
     162            0 :         commands::modobj(Object, attribute_info, convert::to<int16_t>(values, attribute_info.p_int_format));
     163              :       }
     164              : 
     165              :       break;
     166              :     }
     167              : 
     168            0 :     case dunedaq::conffwk::s32_type: {
     169            0 :       if (attribute_info.p_is_multi_value) {
     170            0 :         commands::modobj(
     171            0 :           Object, attribute_info, convert::to<std::vector<int32_t>>(values, attribute_info.p_int_format));
     172              :       } else {
     173            0 :         commands::modobj(Object, attribute_info, convert::to<int32_t>(values, attribute_info.p_int_format));
     174              :       }
     175              : 
     176              :       break;
     177              :     }
     178              : 
     179            0 :     case dunedaq::conffwk::s64_type: {
     180            0 :       if (attribute_info.p_is_multi_value) {
     181            0 :         commands::modobj(
     182            0 :           Object, attribute_info, convert::to<std::vector<int64_t>>(values, attribute_info.p_int_format));
     183              :       } else {
     184            0 :         commands::modobj(Object, attribute_info, convert::to<int64_t>(values, attribute_info.p_int_format));
     185              :       }
     186              : 
     187              :       break;
     188              :     }
     189              : 
     190            0 :     case dunedaq::conffwk::u8_type: {
     191            0 :       if (attribute_info.p_is_multi_value) {
     192            0 :         commands::modobj(
     193            0 :           Object, attribute_info, convert::to<std::vector<u_int8_t>>(values, attribute_info.p_int_format));
     194              :       } else {
     195            0 :         commands::modobj(Object, attribute_info, convert::to<u_int8_t>(values, attribute_info.p_int_format));
     196              :       }
     197              : 
     198              :       break;
     199              :     }
     200              : 
     201            0 :     case dunedaq::conffwk::u16_type: {
     202            0 :       if (attribute_info.p_is_multi_value) {
     203            0 :         commands::modobj(
     204            0 :           Object, attribute_info, convert::to<std::vector<u_int16_t>>(values, attribute_info.p_int_format));
     205              :       } else {
     206            0 :         commands::modobj(Object, attribute_info, convert::to<u_int16_t>(values, attribute_info.p_int_format));
     207              :       }
     208              : 
     209              :       break;
     210              :     }
     211              : 
     212            0 :     case dunedaq::conffwk::u32_type: {
     213            0 :       if (attribute_info.p_is_multi_value) {
     214            0 :         commands::modobj(
     215            0 :           Object, attribute_info, convert::to<std::vector<u_int32_t>>(values, attribute_info.p_int_format));
     216              :       } else {
     217            0 :         commands::modobj(Object, attribute_info, convert::to<u_int32_t>(values, attribute_info.p_int_format));
     218              :       }
     219              : 
     220              :       break;
     221              :     }
     222              : 
     223            0 :     case dunedaq::conffwk::u64_type: {
     224            0 :       if (attribute_info.p_is_multi_value)
     225            0 :         commands::modobj(
     226            0 :           Object, attribute_info, convert::to<std::vector<u_int64_t>>(values, attribute_info.p_int_format));
     227              :       else
     228            0 :         commands::modobj(Object, attribute_info, convert::to<u_int64_t>(values, attribute_info.p_int_format));
     229              : 
     230              :       break;
     231              :     }
     232              : 
     233              :     default:
     234              :       break;
     235              :   }
     236            0 : }
     237              : //------------------------------------------------------------------------------------------
     238              : }
     239              : }
     240              : }
     241              : }
     242              : //------------------------------------------------------------------------------------------
        

Generated by: LCOV version 2.0-1