LCOV - code coverage report
Current view: top level - OdbDesignLib/App - OdbAppBase.cpp (source / functions) Coverage Total Hit
Test: OdbDesign Test Coverage Lines: 0.0 % 39 0
Test Date: 2026-11-21 03:51:50 Functions: 0.0 % 8 0
Legend: Lines: hit not hit

            Line data    Source code
       1              : #include "Logger.h"
       2              : #include <filesystem>
       3              : #include <exception>
       4              : #include "DesignCache.h"
       5              : #include "OdbAppBase.h"
       6              : #include "OdbDesignArgs.h"
       7              : #include <google/protobuf/stubs/common.h>
       8              : #include <ExitCode.h>
       9              : 
      10              : using namespace Utils;
      11              : using namespace std::filesystem;
      12              : 
      13              : namespace Odb::Lib::App
      14              : {
      15            0 :     OdbAppBase::OdbAppBase(int argc, char* argv[])
      16            0 :         : m_designCache(DEFAULT_DESIGNS_DIR)
      17            0 :         , m_commandLineArgs(argc, argv)
      18              :     {        
      19            0 :         GOOGLE_PROTOBUF_VERIFY_VERSION;
      20            0 :     }
      21              : 
      22            0 :     OdbAppBase::~OdbAppBase()
      23              :     {   
      24            0 :         Logger::instance()->stop();
      25            0 :         google::protobuf::ShutdownProtobufLibrary();
      26            0 :     }
      27              : 
      28            0 :     const OdbDesignArgs& OdbAppBase::args() const
      29              :     {
      30            0 :         return m_commandLineArgs;
      31              :     }
      32              : 
      33            0 :     DesignCache& OdbAppBase::designs()
      34              :     {
      35            0 :         return m_designCache;
      36              :     }
      37              : 
      38            0 :     Utils::ExitCode OdbAppBase::Run()
      39              :     {                
      40              :         //Logger::instance()->logLevel(Logger::Level::Debug);
      41            0 :         Logger::instance()->logLevel(Logger::Level::Info);
      42            0 :         Logger::instance()->start();
      43              : 
      44              :         // set designs dir if passed in
      45            0 :         if (!args().designsDir().empty())
      46              :         {
      47            0 :                         designs().setDirectory(args().designsDir());
      48              :                 }
      49              : 
      50              :         // set the design cache byte budget (--cache-max-mb, 0 disables eviction)
      51            0 :         designs().setCacheMaxBytes(static_cast<std::uint64_t>(args().cacheMaxMb()) * 1024ull * 1024ull);
      52              : 
      53              :         // cap concurrent background parses kicked via LoadDesignAsync
      54              :         // (--max-background-loads, 0 = unbounded)
      55            0 :         designs().setMaxBackgroundLoads(static_cast<std::size_t>(args().maxBackgroundLoads()));
      56              : 
      57              :         // load a design if specified via command line args
      58            0 :         if (!args().loadDesign().empty())
      59              :         {
      60              :             try
      61              :             {
      62              :                 auto pFileArchive = 
      63              :                     //designs().GetDesign(args().loadDesign());
      64            0 :                     designs().GetFileArchive(args().loadDesign());
      65            0 :                 if (pFileArchive == nullptr)
      66              :                 {
      67            0 :                     logerror("Failed to load design specified in arguments \"" + args().loadDesign() + "\"");
      68            0 :                     return Utils::ExitCode::FailedInitLoadDesign;
      69              :                 }
      70              :                 else
      71              :                 {
      72              :                     //std::string filename = 
      73            0 :                     pFileArchive->SaveFileModel(".", "notused");
      74              :                 }
      75            0 :             }
      76            0 :             catch (filesystem_error& fe)
      77              :             {
      78            0 :                 logexception(fe);
      79            0 :                 logerror("filesystem_error: \"" + args().loadDesign() + "\" " + fe.what());
      80            0 :             }
      81            0 :             catch (std::exception& e)
      82              :             {
      83            0 :                 logexception(e);
      84            0 :                 logerror("Failed to load design specified in arguments \"" + args().loadDesign() + "\"");
      85            0 :                 return Utils::ExitCode::FailedInitLoadDesign;
      86            0 :             }
      87              :         }
      88              :         
      89              :         // load all designs from designs-dir if specified
      90            0 :         if (args().loadAll())
      91              :         {
      92            0 :             designs().loadAllDesigns(false);
      93              :         }
      94              : 
      95            0 :         return Utils::ExitCode::Success;
      96              :     }   
      97              : }
        

Generated by: LCOV version 2.0-1