Changeset 326
- Timestamp:
- 01/31/05 02:27:49 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDContainer.cc
r308 r326 409 409 rfunit = restFreqUnit_; 410 410 } 411 412 413 uInt 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 441 void 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 38 38 #include <casa/Arrays/Array.h> 39 39 #include <casa/Arrays/Vector.h> 40 #include <casa/Containers/Block.h> 41 #include <measures/Measures/MDirection.h> 40 42 41 43 template<class T> class casa::Matrix; … … 187 189 }; 188 190 191 192 193 class SDDataDesc { 194 195 public: 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 216 private: 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 189 226 } // namespace 190 227 #endif
Note:
See TracChangeset
for help on using the changeset viewer.