LCOV - code coverage report
Current view: top level - spectrallines/Splatalogue - SplatResult.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 71 0.0 %
Date: 2024-10-29 13:38:20 Functions: 0 16 0.0 %

          Line data    Source code
       1             : //# Copyright (C) 2004
       2             : //# Associated Universities, Inc. Washington DC, USA.
       3             : //#
       4             : //# This library is free software; you can redistribute it and/or modify it
       5             : //# under the terms of the GNU Library General Public License as published by
       6             : //# the Free Software Foundation; either version 2 of the License, or (at your
       7             : //# option) any later version.
       8             : //#
       9             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      10             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      11             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      12             : //# License for more details.
      13             : //#
      14             : //# You should have received a copy of the GNU Library General Public License
      15             : //# along with this library; if not, write to the Free Software Foundation,
      16             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      17             : //#
      18             : //# Correspondence concerning AIPS++ should be addressed as follows:
      19             : //#        Internet email: casa-feedback@nrao.edu.
      20             : //#        Postal address: AIPS++ Project Office
      21             : //#                        National Radio Astronomy Observatory
      22             : //#                        520 Edgemont Road
      23             : //#                        Charlottesville, VA 22903-2475 USA
      24             : //#
      25             : 
      26             : #include "SplatResult.h"
      27             : #include <sstream>
      28             : #include <stdio.h>
      29             : 
      30             : namespace casa {
      31             : 
      32           0 : SplatResult::SplatResult(int speciesId, const string& species,
      33             :                 const string& chemicalName, const string& quantumNumbers,
      34             :                 const pair<double,string>& frequency,
      35             :                 const pair<double,string>& temperature,
      36             :                 double smu2, const pair<double,string>& el,
      37           0 :                 const pair<double,string>& eu, double logA, double intensity) {
      38           0 :         this->_speciesId = speciesId;
      39           0 :         this->_species = species;
      40           0 :         this->_chemicalName = chemicalName;
      41           0 :         this->_quantumNumbers = quantumNumbers;
      42           0 :         this->_frequency = frequency;
      43           0 :         this->_temperature = temperature;
      44           0 :         this->_smu2 = smu2;
      45           0 :         this->_el = el;
      46           0 :         this->_eu = eu;
      47           0 :         this->_logA = logA;
      48           0 :         this->_intensity = intensity;
      49             : 
      50           0 : }
      51             : 
      52           0 : int SplatResult::getSpeciesId() const {
      53           0 :         return _speciesId;
      54             : }
      55             : 
      56           0 : std::string SplatResult::getSpecies() const {
      57           0 :         return _species;
      58             : }
      59           0 : std::string SplatResult::getChemicalName() const {
      60           0 :         return _chemicalName;
      61             : }
      62           0 : std::string SplatResult::getQuantumNumbers() const {
      63           0 :         return _quantumNumbers;
      64             : }
      65             : 
      66           0 : pair<double,std::string> SplatResult::getFrequency() const {
      67           0 :         return _frequency;
      68             : }
      69             : 
      70           0 : pair<double,std::string> SplatResult::getTemperature() const {
      71           0 :         return _temperature;
      72             : }
      73             : 
      74           0 : double SplatResult::getSmu2() const {
      75           0 :         return _smu2;
      76             : }
      77           0 : pair<double,std::string> SplatResult::getEL() const {
      78           0 :         return _el;
      79             : }
      80           0 : pair<double,std::string> SplatResult::getEU() const {
      81           0 :         return _eu;
      82             : }
      83           0 : double SplatResult::getLogA() const {
      84           0 :         return _logA;
      85             : }
      86             : 
      87           0 : double SplatResult::getIntensity() const {
      88           0 :         return _intensity;
      89             : }
      90           0 : string SplatResult::toString() const {
      91           0 :         ostringstream os;
      92           0 :         os << "Species:      "<< _species << "\n";
      93           0 :         os << "Chemical Name:"<< _chemicalName << "\n";
      94           0 :         os << "Frequency:    "<< _frequency.first << " "<<_frequency.second<<"\n";
      95           0 :         os << "Temperature:  "<< _temperature.first << " "<<_temperature.second<<"\n";
      96           0 :         os << "Resolved QNs: "<< _quantumNumbers << "\n";
      97           0 :         os << "Intensity:    "<< _intensity << "\n";
      98           0 :         os << "Siju2:        "<< _smu2 << "\n";
      99           0 :         os << "LOGA:         "<< _logA << "\n";
     100           0 :         os << "EL:           "<< _el.first << " "<< _el.second<< "\n";
     101           0 :         os << "EU:           "<< _eu.first << " "<< _eu.second <<"\n";
     102           0 :         return os.str();
     103           0 : }
     104             : 
     105           0 : string SplatResult::toLine( string spacer ) const {
     106           0 :         ostringstream os;
     107           0 :         const int COLUMN_WIDTH = 30;
     108           0 :         const int NUM_COLUMN_WIDTH = 16;
     109             :         char speciesStr[COLUMN_WIDTH];
     110           0 :         string formatStr( "%-29.29s");
     111           0 :         string numFormatStr( "%15.6f");
     112           0 :         sprintf( speciesStr, formatStr.c_str(), _species.c_str());
     113             :         char chemStr[COLUMN_WIDTH];
     114           0 :         sprintf( chemStr, formatStr.c_str(), _chemicalName.c_str());
     115             :         char freqStr[NUM_COLUMN_WIDTH];
     116           0 :         sprintf( freqStr, numFormatStr.c_str(), _frequency.first );
     117             :         char tempStr[NUM_COLUMN_WIDTH];
     118           0 :         sprintf( tempStr, numFormatStr.c_str(), _temperature.first);
     119             :         char qnsStr[COLUMN_WIDTH];
     120           0 :         sprintf( qnsStr, formatStr.c_str(), _quantumNumbers.c_str() );
     121             :         char intStr[NUM_COLUMN_WIDTH];
     122           0 :         sprintf( intStr, numFormatStr.c_str(), _intensity );
     123             :         char smu2Str[NUM_COLUMN_WIDTH];
     124           0 :         sprintf( smu2Str, numFormatStr.c_str(), _smu2 );
     125             :         char logaStr[NUM_COLUMN_WIDTH];
     126           0 :         sprintf( logaStr, numFormatStr.c_str(), _logA );
     127             :         char elStr[NUM_COLUMN_WIDTH];
     128           0 :         sprintf( elStr, numFormatStr.c_str(), _el.first );
     129             :         char euStr[NUM_COLUMN_WIDTH];
     130           0 :         sprintf( euStr, numFormatStr.c_str(), _eu.first );
     131             :         os << speciesStr << spacer << chemStr << spacer << freqStr << spacer <<
     132             :                         tempStr << spacer <<
     133             :                         qnsStr<< spacer << intStr<< spacer << spacer << smu2Str<< spacer
     134           0 :                         << spacer << logaStr<< spacer <<elStr << spacer << euStr << endl;
     135           0 :         return os.str();
     136           0 : }
     137             : 
     138           0 : SplatResult::~SplatResult() {
     139             :         // TODO Auto-generated destructor stub
     140           0 : }
     141             : 
     142             : } /* namespace casa */

Generated by: LCOV version 1.16