Changeset 396


Ignore:
Timestamp:
02/09/05 13:00:12 (20 years ago)
Author:
kil064
Message:

add a secondary index argument to the SDDataDesc container

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDContainer.cc

    r388 r396  
    485485// SDDataDesc
    486486
    487 uInt SDDataDesc::addEntry (const String& source, uInt freqID, const MDirection& dir)
     487uInt SDDataDesc::addEntry (const String& source, uInt ID,
     488                           const MDirection& dir, uInt secID)
    488489{
    489490
     
    492493  if (n_ > 0) {
    493494    for (uInt i=0; i<n_; i++) {
    494       if (source==source_[i] && freqID==freqID_[i]) {
     495      if (source==source_[i] && ID==ID_[i]) {
    495496         return i;
    496497      }
     
    502503  n_ += 1;
    503504  source_.resize(n_,True);
    504   freqID_.resize(n_,True);
    505   dir_.resize(n_,True,True);
     505  ID_.resize(n_,True);
     506  secID_.resize(n_,True);
     507  secDir_.resize(n_,True,True);
    506508//
    507509  source_[n_-1] = source;
    508   freqID_[n_-1] = freqID;
    509   dir_[n_-1] = dir;
     510  ID_[n_-1] = ID;
     511  secID_[n_-1] = secID;
     512  secDir_[n_-1] = dir;
    510513//
    511514  return n_-1;
    512515}
    513516
    514 
    515517void SDDataDesc::summary() const
    516518{
    517    cerr << "Source    FreqID" << endl;
    518    for (uInt i=0; i<n_; i++) {
    519       cerr << setw(11) << source_(i) << freqID_(i) << endl;
     519   if (n_>0) {
     520      cerr << "Source    ID" << endl;   
     521      for (uInt i=0; i<n_; i++) {
     522         cerr << setw(11) << source_(i) << ID_(i) << endl;
     523      }
    520524   }
    521525}
    522 
    523 
  • trunk/src/SDContainer.h

    r392 r396  
    210210  ~SDDataDesc() {;}
    211211
    212 // Add an entry if source name (not direction at this point) and freqID are unique
    213   casa::uInt addEntry (const casa::String& source, casa::uInt freqID,
    214                        const casa::MDirection& dir);
     212// Add an entry if source name and Integer ID (can be anything you like, such
     213// as FreqID) are unique.  You can add secondary entries direction
     214// and another integer index which are just stored along with the
     215// the primary entries
     216  casa::uInt addEntry (const casa::String& source, casa::uInt ID,
     217                       const casa::MDirection& secDir, casa::uInt secID);
    215218
    216219// Number of entries
     
    219222// Get attributes
    220223  casa::String source (casa::uInt which) const {return source_[which];}
    221   casa::uInt freqID(casa::uInt which) const {return freqID_[which];}
    222   casa::MDirection direction (casa::uInt which) const {return dir_[which];}
     224  casa::uInt ID(casa::uInt which) const {return ID_[which];}
     225  casa::uInt secID(casa::uInt which) const {return secID_[which];}
     226  casa::MDirection secDir (casa::uInt which) const {return secDir_[which];}
    223227
    224228// Summary
     
    228232  casa::uInt n_;
    229233  casa::Vector<casa::String> source_;
    230   casa::Vector<casa::uInt> freqID_;
    231   casa::Block<casa::MDirection> dir_;
     234  casa::Vector<casa::uInt> ID_, secID_;
     235  casa::Block<casa::MDirection> secDir_;
    232236//
    233237  SDDataDesc(const SDDataDesc& other);
Note: See TracChangeset for help on using the changeset viewer.