Changeset 326


Ignore:
Timestamp:
01/31/05 02:27:49 (20 years ago)
Author:
kil064
Message:

add class SDDataDesc

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDContainer.cc

    r308 r326  
    409409  rfunit = restFreqUnit_;
    410410}
     411
     412
     413uInt SDDataDesc::addEntry (const String& source, uInt freqID, const MDirection& dir)
     414{
     415
     416// See if already exists
     417
     418  if (n_ > 0) {
     419    for (uInt i=0; i<n_; i++) {
     420      if (source==source_[i] && freqID==freqID_[i]) {
     421         return i;
     422      }
     423    }
     424  }
     425
     426// Not found - add it
     427
     428  n_ += 1;
     429  source_.resize(n_,True);
     430  freqID_.resize(n_,True);
     431  dir_.resize(n_,True,True);
     432//
     433  source_[n_-1] = source;
     434  freqID_[n_-1] = freqID;
     435  dir_[n_-1] = dir;
     436//
     437  return n_-1;
     438}
     439
     440
     441void SDDataDesc::summary() const
     442{
     443   cerr << "Source    FreqID" << endl;
     444   for (uInt i=0; i<n_; i++) {
     445      cerr << source_(i) << freqID_(i) << endl;
     446   }
     447}
     448
  • trunk/src/SDContainer.h

    r320 r326  
    3838#include <casa/Arrays/Array.h>
    3939#include <casa/Arrays/Vector.h>
     40#include <casa/Containers/Block.h>
     41#include <measures/Measures/MDirection.h>
    4042
    4143template<class T> class casa::Matrix;
     
    187189};
    188190
     191
     192
     193class SDDataDesc {
     194
     195public:
     196
     197// COnstructor
     198  SDDataDesc() : n_(0) {;}
     199  ~SDDataDesc() {;}
     200
     201// Add an entry if source name (not direction at this point) and freqID are unique
     202  casa::uInt addEntry (const casa::String& source, casa::uInt freqID,
     203                       const casa::MDirection& dir);
     204
     205// Number of entries
     206  casa::Int length() const { return n_;}
     207
     208// Get attributes
     209  casa::String source (casa::uInt which) const {return source_[which];}
     210  casa::uInt freqID(casa::uInt which) const {return freqID_[which];}
     211  casa::MDirection direction (casa::uInt which) const {return dir_[which];}
     212
     213// Summary
     214  void summary() const;
     215
     216private:
     217  casa::uInt n_;
     218  casa::Vector<casa::String> source_;
     219  casa::Vector<casa::uInt> freqID_;
     220  casa::Block<casa::MDirection> dir_;
     221//
     222  SDDataDesc(const SDDataDesc& other);
     223};
     224
     225
    189226} // namespace
    190227#endif
Note: See TracChangeset for help on using the changeset viewer.