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 <stdint.h>
00015 #include <algorithm>
00016
00017
00018
00019
00020 extern bool debug;
00021 extern vector<char> logIndent;
00022 #define LOGENTER(name) if (debug) { std::for_each(logIndent.begin(), logIndent.end(), [](char v) { cout << v; }); logIndent.push_back('\t'); cout << #name ": entering" << endl; }
00023 #define LOGEXIT(name) if (debug) { logIndent.pop_back(); std::for_each(logIndent.begin(), logIndent.end(), [](char v) { cout << v; } ); cout << #name ": exiting" << endl; }
00024 #define LOG(msg) if (debug) { std::for_each(logIndent.begin(), logIndent.end(), [](char v) { cout << v; } ); cout << msg << endl; }
00025
00026 class BDF2AsdmStManIndex {
00027 public:
00028 BDF2AsdmStManIndex();
00029 BDF2AsdmStManIndex(const std::vector<std::string>& bdfNames, bool isBigEndian, const string& fname);
00030 virtual ~BDF2AsdmStManIndex();
00031 void init (const std::vector<std::string>& bdfNames, bool isBigEndian, const string& fname);
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 uint32_t spwOffset);
00048
00049 void appendWVRIndex(unsigned int iDD,
00050 const string& bdfName,
00051 unsigned int nBl,
00052 unsigned int nSpw,
00053 unsigned int nChan,
00054 unsigned int nPol,
00055 unsigned int stepBl,
00056 unsigned int stepSpw,
00057 const vector<double>& scaleFactors,
00058 uint64_t fileOffset,
00059 uint32_t spwOffset);
00060
00061 void appendCrossIndex(unsigned int iDD,
00062 const string& bdfName,
00063 unsigned int nBl,
00064 unsigned int nSpw,
00065 unsigned int nChan,
00066 unsigned int nPol,
00067 unsigned int stepBl,
00068 unsigned int stepSpw,
00069 const vector<double>& scaleFactors,
00070 uint64_t fileOffset,
00071 uint32_t spwOffset,
00072 PrimitiveDataTypeMod::PrimitiveDataType dataType);
00073
00074 void dumpAutoCross();
00075 void dumpCrossAuto();
00076
00077 static int version();
00078
00079 private:
00080 uint32_t numberOfDataDescriptions;
00081 casa::Block<casa::String> bdfNames;
00082 casa::String fname;
00083 std::map<std::string, int> s2i_m;
00084 bool asBigEndian;
00085 std::vector<std::vector<casa::AsdmIndex> > autoIndexes_vv;
00086 std::vector<std::vector<casa::AsdmIndex> > crossIndexes_vv;
00087 std::vector<casa::AsdmIndex> allIndexes_v;
00088 bool fileAttached;
00089 casa::AipsIO aio;
00090 uint64_t MSMainRowNumber;
00091 };
00092 #endif