LCOV - code coverage report
Current view: top level - conffwk/src - DalObject.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 45 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 10 0

            Line data    Source code
       1              : #include "conffwk/DalObject.hpp"
       2              : 
       3              : namespace dunedaq {
       4              : namespace conffwk {
       5              : 
       6              : 
       7              : bool
       8            0 : DalObject::get_rel_objects(const std::string &name, bool upcast_unregistered, std::vector<const DalObject*> &objs) const
       9              : {
      10            0 :   std::vector<conffwk::ConfigObject> c_objs;
      11              : 
      12            0 :   if (const_cast<conffwk::ConfigObject*>(&p_obj)->rel(name, c_objs))
      13              :     {
      14              :       // Fixme: what about the lock?
      15              :       // std::lock_guard<std::mutex> scoped_lock(p_registry.m_tmpl_mutex);
      16            0 :       p_registry.get(c_objs, upcast_unregistered).swap(objs);
      17            0 :       return true;
      18              :     }
      19              : 
      20              :   return false;
      21            0 : }
      22              : 
      23              : 
      24              : bool
      25            0 : DalObject::get_algo_objects(const std::string& /* name */, std::vector<const DalObject*>& /* objs */) const
      26              : {
      27              :     // FIXME: Remove
      28              : //   const std::string &suitable_dal_class = DalFactory::instance().class4algo(p_registry, class_name(), name);
      29              : 
      30              : //   TLOG_DEBUG(2) << "suitable class for algorithm " << name << " on object " << this << " is " << suitable_dal_class;
      31              : 
      32              : //   if (!suitable_dal_class.empty())
      33              : //     if (const DalObject *obj = p_registry.make_dal_object(const_cast<conffwk::ConfigObject&>(p_obj), UID(), suitable_dal_class))
      34              : //       {
      35              : //         obj->get(name, false).swap(objs);
      36              : //         return true;
      37              : //       }
      38              : 
      39            0 :   return false;
      40              : }
      41              : 
      42              : 
      43              : 
      44              :   // DalObject helper
      45              : 
      46              : void
      47            0 : DalObject::p_null(std::ostream &s)
      48              : {
      49            0 :   s << "(null)";
      50            0 : }
      51              : 
      52              : void
      53            0 : DalObject::p_rm(std::ostream &s)
      54              : {
      55            0 :   s << "(deleted object)";
      56            0 : }
      57              : 
      58              : void
      59            0 : DalObject::p_error(std::ostream &s, dunedaq::conffwk::Exception &ex)
      60              : {
      61            0 :   s << "ERROR in generated DAL print method:\n\twas caused by: " << ex << std::endl;
      62            0 : }
      63              : 
      64              : void
      65            0 : DalObject::p_hdr(std::ostream &s, unsigned int indent, const std::string &cl, const char *nm) const
      66              : {
      67            0 :   const std::string str(indent, ' ');
      68            0 :   s << str;
      69            0 :   if (nm)
      70            0 :     s << nm << ' ';
      71            0 :   s << cl << " object:\n" << str << "  id: \'" << UID() << "\', class name: \'" << DalObject::class_name() << "\'\n";
      72            0 : }
      73              : 
      74            0 : void DalObject::throw_init_ex(dunedaq::conffwk::Exception& ex)
      75              : {
      76            0 :   std::ostringstream text;
      77            0 :   text << "failed to init " << this << ":\n\twas caused by: " << ex << std::endl;
      78            0 :   p_was_read = false;
      79            0 :   throw dunedaq::conffwk::Generic (ERS_HERE, text.str().c_str());
      80            0 : }
      81              : 
      82            0 : void DalObject::throw_get_ex(const std::string& what, const std::string& class_name, const DalObject * obj)
      83              : {
      84            0 :   std::ostringstream text;
      85            0 :   text << "cannot find relationship or algorithm \"" << what << "\" in c++ class \"" << class_name << "\" for object " << obj;
      86            0 :   throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
      87            0 : }
      88              :     
      89              :     
      90              : std::ostream&
      91            0 : operator<<(std::ostream& s, const DalObject * obj)
      92              : {
      93            0 :   if (obj == nullptr)
      94            0 :     DalObject::p_null(s);
      95            0 :   else if (obj->is_deleted())
      96            0 :     s << "(deleted object " << obj->UID() << '@' << obj->class_name() << ')';
      97              :   else
      98            0 :     s << '\'' << obj->UID() << '@' << obj->class_name() << '\'';
      99              : 
     100            0 :   return s;
     101              : }
     102              : 
     103              : 
     104              : void
     105            0 : p_sv_rel(std::ostream &s, const std::string &str, const std::string &name, const DalObject *obj)
     106              : {
     107            0 :   s << str << name << ": " << obj << '\n';
     108            0 : }
     109              : 
     110              :     
     111              : } // namespace conffwk
     112              :     
     113              : } // namespace dunedaq
        

Generated by: LCOV version 2.0-1