LCOV - code coverage report
Current view: top level - alma/ASDMBinaries - SwitchCyclesList.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 17 81 21.0 %
Date: 2024-12-11 20:54:31 Functions: 3 12 25.0 %

          Line data    Source code
       1             : #include <vector>
       2             : #include <stdio.h>
       3             : #include <iostream>
       4             : 
       5             : #include <alma/ASDMBinaries/SwitchCyclesList.h>
       6             : 
       7             : using namespace asdm;
       8             : using namespace std;
       9             : 
      10             : using namespace BasebandNameMod;
      11             : 
      12             : namespace sdmbin {
      13             : 
      14           0 : SwitchCyclesList::SwitchCyclesList(){}
      15             : 
      16         106 : SwitchCyclesList::SwitchCyclesList(ASDM* const datasetPtr, vector<Tag> v_switchCycleId):
      17         106 :   datasetPtr_(datasetPtr),
      18         106 :   v_switchCycleId_(v_switchCycleId)
      19             : {
      20         106 :   SwitchCycleTable& rscSet = datasetPtr->getSwitchCycle();
      21         545 :   for(unsigned int nbb=0; nbb<v_switchCycleId.size(); nbb++)
      22         439 :     v_numBin_.push_back(rscSet.getRowByKey(v_switchCycleId[nbb])->getNumStep());  
      23         106 : }
      24             : 
      25           0 : SwitchCyclesList::SwitchCyclesList(ASDM* const datasetPtr, vector<vector<Tag> > vv_switchCycleId):
      26           0 :   datasetPtr_(datasetPtr),
      27           0 :   vv_switchCycleId_(vv_switchCycleId)
      28             : {
      29           0 :   SwitchCycleTable& rscSet = datasetPtr->getSwitchCycle();
      30             :   // sub-class DataDescriptionsSet will check that v_switchCycleId.size() = numBaseband
      31             :   int  numConstStep;
      32           0 :   bool perBaseband=true;
      33           0 :   vv_numBin_.resize(vv_switchCycleId.size());
      34           0 :   for(unsigned int nbb=0; nbb<vv_switchCycleId.size(); nbb++){
      35           0 :     for(unsigned int nspw=0; nspw<vv_switchCycleId[nbb].size(); nspw++){
      36           0 :       int numStep=rscSet.getRowByKey(vv_switchCycleId[nbb][nspw])->getNumStep();
      37           0 :       if(nspw){
      38           0 :         if(numStep!=numConstStep)perBaseband=false;
      39             :       }else{
      40           0 :         numConstStep = numStep;
      41             :       }
      42           0 :       vv_numBin_[nbb].push_back(numStep);
      43             :     }
      44           0 :     if(perBaseband)v_numBin_.push_back(numConstStep);
      45             :   }
      46           0 :   if(!perBaseband)v_numBin_.resize(0);
      47           0 : }
      48             : 
      49           0 : SwitchCyclesList::SwitchCyclesList(ASDM* const datasetPtr, vector<vector<int> > vv_switchCycleId):
      50           0 :   datasetPtr_(datasetPtr)
      51             : {
      52           0 :   SwitchCycleTable& rscSet = datasetPtr->getSwitchCycle();
      53             :   // sub-class DataDescriptionsSet will check that v_switchCycleId.size() = numBaseband
      54           0 :   vv_switchCycleId_.resize(vv_switchCycleId.size());
      55           0 :   vv_numBin_.resize(vv_switchCycleId.size());
      56           0 :   for(unsigned int nbb=0; nbb<vv_switchCycleId.size(); nbb++)
      57           0 :     for(unsigned int nspw=0; nspw<vv_switchCycleId[nbb].size(); nspw++){
      58           0 :       vv_switchCycleId_[nbb].push_back(Tag((unsigned int)vv_switchCycleId[nbb][nspw]));
      59           0 :       vv_numBin_[nbb].push_back(rscSet.getRowByKey(vv_switchCycleId[nbb][nspw])->getNumStep());  
      60             :     }
      61           0 : }
      62             : 
      63         106 : SwitchCyclesList::SwitchCyclesList(const SwitchCyclesList & a){
      64         106 :   m_bn_v_scId_      = a.m_bn_v_scId_;
      65         106 :   m_bn_v_numBin_    = a.m_bn_v_numBin_;
      66         106 :   vv_numBin_        = a.vv_numBin_;
      67         106 :   v_numBin_         = a.v_numBin_;
      68         106 :   datasetPtr_       = a.datasetPtr_;
      69         106 :   vv_switchCycleId_ = a.vv_switchCycleId_;
      70         106 :   v_switchCycleId_  = a.v_switchCycleId_;
      71         106 : }
      72             : 
      73         212 : SwitchCyclesList::~SwitchCyclesList(){}
      74             : 
      75           0 : void SwitchCyclesList::mapScToBaseband(){}
      76             : 
      77           0 : vector<Tag> SwitchCyclesList::getSwitchCyclesList(BasebandName basebandName){
      78             :   map<BasebandName,vector<Tag> >::iterator 
      79           0 :     itf=m_bn_v_scId_.find(basebandName),
      80           0 :     ite=m_bn_v_scId_.end();
      81           0 :   vector<Tag> v;
      82           0 :   if(itf==ite)return v;
      83           0 :   return itf->second;
      84           0 : } 
      85             : 
      86           0 : vector<Tag> SwitchCyclesList::getSwitchCyclesList(){
      87             :   map<BasebandName,vector<Tag> >::iterator 
      88           0 :     it,
      89           0 :     itb=m_bn_v_scId_.begin(),
      90           0 :     ite=m_bn_v_scId_.end();
      91           0 :   vector<Tag> v;
      92           0 :   for(it=itb; it!=ite; ++it)
      93           0 :     for(unsigned int n=0; n<it->second.size(); n++)
      94           0 :       v.push_back(it->second[n]);
      95           0 :   return v;
      96           0 : } 
      97             : 
      98           0 : vector<int> SwitchCyclesList::getNumBin(){
      99             :   map<BasebandName,vector<int> >::iterator 
     100           0 :     it,
     101           0 :     itb=m_bn_v_numBin_.begin(), 
     102           0 :     ite=m_bn_v_numBin_.end();
     103           0 :   vector<int> v;
     104           0 :   if(itb==ite)return v;
     105           0 :   for(it=itb; it!=ite; ++it)
     106           0 :     for(unsigned int n=0; n<it->second.size(); n++)
     107           0 :       v.push_back(it->second[n]);
     108           0 :   return v;
     109           0 : }
     110             : 
     111           0 : vector<int> SwitchCyclesList::getNumBin(BasebandName basebandName){
     112             :   map<BasebandName,vector<int> >::iterator 
     113           0 :     itf=m_bn_v_numBin_.find(basebandName), 
     114           0 :     ite=m_bn_v_numBin_.end();
     115           0 :   vector<int> v;
     116           0 :   if(itf==ite)
     117           0 :     return v;
     118             :   else 
     119           0 :     return itf->second;
     120           0 : }
     121             : 
     122             : }

Generated by: LCOV version 1.16