LCOV - code coverage report
Current view: top level - alma/ASDM - Interval.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 45 0.0 %
Date: 2024-10-28 15:53:10 Functions: 0 10 0.0 %

          Line data    Source code
       1             : /*
       2             :  * ALMA - Atacama Large Millimeter Array
       3             :  * (c) European Southern Observatory, 2002
       4             :  * (c) Associated Universities Inc., 2002
       5             :  * Copyright by ESO (in the framework of the ALMA collaboration),
       6             :  * Copyright by AUI (in the framework of the ALMA collaboration),
       7             :  * All rights reserved.
       8             :  * 
       9             :  * This library is free software; you can redistribute it and/or
      10             :  * modify it under the terms of the GNU Lesser General Public
      11             :  * License as published by the Free software Foundation; either
      12             :  * version 2.1 of the License, or (at your option) any later version.
      13             :  * 
      14             :  * This library is distributed in the hope that it will be useful,
      15             :  * but WITHOUT ANY WARRANTY, without even the implied warranty of
      16             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      17             :  * Lesser General Public License for more details.
      18             :  * 
      19             :  * You should have received a copy of the GNU Lesser General Public
      20             :  * License along with this library; if not, write to the Free Software
      21             :  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      22             :  * MA 02111-1307  USA
      23             :  *
      24             :  * File Interval.cpp
      25             :  */
      26             : 
      27             : #include <alma/ASDM/Interval.h>
      28             : #include <alma/ASDM/LongWrapper.h>
      29             : #include <alma/ASDM/NumberFormatException.h>
      30             : 
      31             : using namespace std;
      32             : 
      33             : namespace asdm {
      34             : 
      35           0 : Interval Interval::getInterval(StringTokenizer &t) {
      36           0 :         int64_t value = Long::parseLong(t.nextToken());
      37           0 :         return Interval (value);
      38             : }
      39             : 
      40           0 : bool Interval::isZero() const {
      41           0 :         return value == 0L;
      42             : }
      43             : 
      44           0 : int64_t Interval::fromString(const string& s) {
      45           0 :         return Long::parseLong(s);
      46             : }
      47             : 
      48           0 : string Interval::toString(int64_t x) {
      49           0 :         return Long::toString(x);
      50             : }
      51             : 
      52           0 : void  Interval::toBin(EndianOSStream& eoss) {
      53           0 :         eoss.writeLongLong(value);      
      54           0 : }
      55             : 
      56           0 : void Interval::toBin(vector<Interval> interval, EndianOSStream& eoss) {
      57           0 :         eoss.writeInt((int) interval.size());
      58           0 :         for (unsigned int i = 0; i < interval.size(); i++) 
      59           0 :                 eoss.writeLongLong(interval.at(i).value);
      60           0 : }
      61             : 
      62           0 : void Interval::toBin(vector<vector<Interval> >interval, EndianOSStream& eoss) {
      63           0 :         eoss.writeInt((int) interval.size());
      64           0 :         eoss.writeInt((int) interval.at(0).size());
      65           0 :         for (unsigned int i = 0; i < interval.size(); i++)
      66           0 :                 for (unsigned int j = 0; j < interval.at(0).size(); j++)              
      67           0 :                         eoss.writeLongLong(interval.at(i).at(j).value);
      68           0 : }
      69             : 
      70           0 :  Interval Interval::fromBin(EndianIStream& eis) {
      71           0 :         return (Interval(eis.readLongLong()));
      72             :  }
      73             :  
      74           0 :  vector<Interval> Interval::from1DBin(EndianIStream& eis) {
      75           0 :         vector<Interval> result;
      76           0 :         int dim = eis.readInt();
      77           0 :         for (int i = 0; i < dim; i++)
      78           0 :                 result.push_back(eis.readLongLong());
      79           0 :         return result;  
      80           0 :  }
      81             : 
      82           0 : vector< vector<Interval> >Interval::from2DBin(EndianIStream& eis) {
      83           0 :         vector<vector<Interval> >result;
      84           0 :         int dim1 = eis.readInt(); 
      85           0 :         int dim2 = eis.readInt(); 
      86           0 :         vector<Interval> aux;     
      87           0 :         for (int i = 0; i < dim1; i++) {
      88           0 :                 aux.clear();
      89           0 :                 for (int j = 0; j < dim2; j++)
      90           0 :                         aux.push_back(eis.readLongLong());
      91           0 :                 result.push_back(aux);          
      92             :         }
      93           0 :         return result;  
      94           0 : }
      95             : } // End namespace asdm

Generated by: LCOV version 1.16