casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
BDF2AsdmStManIndex.h
Go to the documentation of this file.
00001 #ifndef BDF2ASDMSTMANINDEX
00002 #define BDF2ASDMSTMANINDEX
00003 #include "CPrimitiveDataType.h"
00004 #include <casa/Containers/Block.h>
00005 #include <asdmstman/AsdmIndex.h>
00006 #include <casa/Arrays/Array.h>
00007 #include <casa/Arrays/ArrayIO.h>
00008 #include <casa/Arrays/ArrayUtil.h>
00009 #include <casa/Arrays/ArrayLogical.h>
00010 #include <casa/IO/AipsIO.h>
00011 #include <casa/Containers/BlockIO.h>
00012 #include <map>
00013 
00014 #include <boost/lambda/lambda.hpp>
00015 #include <boost/lambda/bind.hpp>
00016 #include <boost/lambda/casts.hpp>
00017 
00018 using namespace boost::lambda;
00019 /*
00020 ** A simplistic tracing toolbox.
00021 */
00022 extern bool debug; 
00023 extern vector<char> logIndent;
00024 #define LOGENTER(name) if (debug) {for_each(logIndent.begin(), logIndent.end(), cout << _1); logIndent.push_back('\t'); cout << #name ": entering" << endl;}
00025 #define LOGEXIT(name)  if (debug) {logIndent.pop_back(); for_each(logIndent.begin(), logIndent.end(), cout << _1); cout << #name ": exiting" << endl;}
00026 #define LOG(msg) if (debug) {for_each(logIndent.begin(), logIndent.end(), cout << _1); cout << msg << endl;}
00027 
00028 class BDF2AsdmStManIndex {
00029 public:
00030   BDF2AsdmStManIndex(const std::vector<std::string>& bdfNames, bool isBigEndian, const string& fname);
00031   virtual ~BDF2AsdmStManIndex();
00032   void setNumberOfDataDescriptions(unsigned int numberOfDataDescriptions);
00033   void                                          done();
00034   void                                          clearIndexes();
00035   void                                          clearAutoIndexes();
00036   void                                          clearCrossIndexes();
00037   void appendAutoIndex(unsigned int             iDD,
00038                        const string&            bdfName,
00039                        unsigned int             nBl,
00040                        unsigned int             nSpw,
00041                        unsigned int             nChan,
00042                        unsigned int             nPol,
00043                        unsigned int             stepBl,
00044                        unsigned int             stepSpw,
00045                        const vector<double>&    scaleFactors,
00046                        uint64_t                 fileOffset);
00047 
00048   void appendWVRIndex(unsigned int              iDD,
00049                       const string&             bdfName,
00050                       unsigned int              nBl,
00051                       unsigned int              nSpw,
00052                       unsigned int              nChan,
00053                       unsigned int              nPol,
00054                       unsigned int              stepBl,
00055                       unsigned int              stepSpw,
00056                       const vector<double>&     scaleFactors,
00057                       uint64_t                  fileOffset);
00058 
00059   void appendCrossIndex(unsigned int            iDD,
00060                         const string&           bdfName,
00061                         unsigned int            nBl,
00062                         unsigned int            nSpw,
00063                         unsigned int            nChan,
00064                         unsigned int            nPol,
00065                         unsigned int            stepBl,
00066                         unsigned int            stepSpw,
00067                         const vector<double>&   scaleFactors,
00068                         uint64_t                fileOffset,
00069                         PrimitiveDataTypeMod::PrimitiveDataType       dataType);
00070 
00071   void  dumpAutoCross();
00072   void  dumpCrossAuto();
00073 
00074   static int version();
00075 
00076 private:
00077   uint32_t                      numberOfDataDescriptions;
00078   casa::Block<casa::String>     bdfNames;
00079   casa::String                  fname;
00080   std::map<std::string, int>    s2i_m;
00081   bool                          asBigEndian;
00082   std::vector<std::vector<casa::AsdmIndex> >    autoIndexes_vv;
00083   std::vector<std::vector<casa::AsdmIndex> >    crossIndexes_vv;
00084   std::vector<casa::AsdmIndex>  allIndexes_v;
00085   casa::AipsIO                  aio;
00086   uint64_t                      MSMainRowNumber;
00087 };
00088 #endif