CARMA C++
CorrDataRemapper.h
Go to the documentation of this file.
1 // $Id: CorrDataRemapper.h,v 1.6 2013/06/25 18:54:18 mpound Exp $
2 
3 #ifndef CARMA_CORRELATOR_CORRDATAREMAPPER_H
4 #define CARMA_CORRELATOR_CORRDATAREMAPPER_H
5 
16 
18 #include "carma/correlator/lib/CorrelatorPolarization.h"
19 
21 #include "carma/signalpath/SignalPathMapperControl.h"
22 
23 #include "carma/szautil/Mutex.h"
25 
26 namespace carma {
27  namespace correlator {
28 
29  namespace lib {
30  class CorrelatorData;
31  }
32 
33  class CorrDataRemapperControlImpl;
34 
35  //-----------------------------------------------------------------------
36  // Define a class for remapping correlator data from input-order
37  // to antenna-order.
38  //-----------------------------------------------------------------------
39 
40  class CorrDataRemapper :
41  public sza::util::RunnableTask,
43  public:
44 
45  // A struct for handling the mapping between astrobands and antenna IFs
46 
47  struct AstroBandInputMap {
48  unsigned astroBandNo_;
49  std::map<unsigned, carma::signalpath::SignalPathMapperControl::AntennaIF> antennaIfMap_;
50  };
51 
52  struct AstroBandMap {
53  sza::util::Mutex guard_;
54  bool hasChanged_;
55  std::map<unsigned, AstroBandInputMap*> astroBands_;
56 
57  AstroBandMap();
58  ~AstroBandMap();
59 
60  void operator=(AstroBandMap& astroBandMap);
61  void operator=(const AstroBandMap& astroBandMap);
62  };
63 
67  CorrDataRemapper(CorrDataRemapperControlImpl* parent,
68  std::string notificationChannelName,
69  std::string imrSrc);
70 
74  virtual ~CorrDataRemapper();
75 
76  // Re-populate the mapping for an astroband
77 
78  void repopulateAstroBandInputMap(CorrDataRemapper::AstroBandInputMap& astroBandInputMap);
79 
80  private:
81 
82  std::string imrSrc_;
83 
84  // The name of the correlator control DO name. The notification
85  // channel name is obtained via a call on this DO down in the
86  // CorbaCorrConsumer class
87 
88  std::string notificationChannelName_;
89 
90  // The parent that instantiated this object
91 
92  CorrDataRemapperControlImpl* parent_;
93 
94  // The mapping between astroband inputs and antenna IFs
95 
96  CorrDataRemapper::AstroBandMap astroBandMap_;
97  CorrDataRemapper::AstroBandMap stagedAstroBandMap_;
98 
99  // Update the astroband input mapping if it has changed
100 
101  void updateAstroBandMap();
102 
103  // Process data received for a correlator band
104  // This method is called at regular intervals by
105  // the obsRecord2::CorbaCorrConsumer instantiated in the run() method.
106  void processData(carma::correlator::lib::CorrelatorData * cd);
107 
108  // Remap correlator data
109 
110  void remapCorrData(carma::correlator::lib::CorrelatorData * cd, unsigned& astroBandNo);
111 
112  // Retrieve antenna numbers
113 
114  void getAntennaNos(carma::correlator::lib::CorrelatorBaseline& baseline, unsigned astroBandNo,
115  unsigned& antennaNo1, unsigned& antennaNo2,
116  bool& requiresConjugation);
117 
118  void getAntPols(carma::correlator::lib::CorrelatorBaseline& baseline, unsigned astroBandNo,
119  unsigned& antennaNo1, unsigned& antennaNo2,
120  carma::correlator::lib::Polarization& pol1,
121  carma::correlator::lib::Polarization& pol2,
122  bool& requiresConjugation);
123 
124  // Conjugate all data for this baseline
125 
126  void conjugate(carma::correlator::lib::CorrelatorBaseline& baseline);
127 
128  // Republish remapped data on the appropriate channel
129 
130  void republishCorrData(carma::correlator::lib::CorrelatorData * cd, unsigned astroBandNo);
131 
132  // Run this thread
133 
134  void run();
135 
136  public:
137 
138  void spawn();
139  unsigned getThreadId();
140 
141  }; // End class CorrDataRemapper
142 
143  } // End namespace correlator
144 } // End namespace carma
145 
146 #endif // End #ifndef CARMA_CORRELATOR_CORRDATAREMAPPER_H
Tagged: Wed Nov 24 09:41:29 PST 2010.
Class used to represents bands of Correlator Data.
Class to hold Correlator Baseline data.
Tagged: Sat Mar 27 16:28:13 PST 2004.
Abstract base class for listener called back by CorbaCorrConsumer.
Tagged: Fri Jan 26 17:59:28 NZDT 2007.