00001
00002
00003
00004
00005
00006
00007
00008 #ifndef COLUMNLABELS_HEADER
00009 #define COLUMNLABELS_HEADER
00010
00011 #include <string>
00012 #include <map>
00013
00014
00015 #include <clipper/clipper.h>
00016
00017 #include "controls.hh"
00018 #include "hkl_unmerge.hh"
00019
00020
00021 enum col_opt_flag {COMPULSORY, OPTIONAL};
00022
00023 using namespace scala;
00024
00025 namespace MtzIO {
00026 typedef std::pair<int,int> IntPair;
00027
00028 class ColumnData {
00029
00030
00031 public:
00032 ColumnData(){}
00033 ColumnData(const std::string& Xname, const std::string& Dname,
00034 const std::string& Label, const std::string& Type)
00035 : xname(Xname), dname(Dname), label(Label), type(Type) {}
00036
00037
00038 bool SameXDname(const ColumnData& other) const;
00039
00040 std::string xname;
00041 std::string dname;
00042 std::string label;
00043 std::string type;
00044 };
00045
00046 class ClipperLabelPair {
00047
00048
00049 public:
00050 ClipperLabelPair(){}
00051 ClipperLabelPair(const std::string& Xname,
00052 const std::string& Dname,
00053 const std::string& Label1,
00054 const std::string& Label2);
00055
00056 std::string xname;
00057 std::string dname;
00058 clipper::String path;
00059 clipper::String label1;
00060 clipper::String label2;
00061 };
00062
00063 class ColumnNumberLabel {
00064 public:
00065 ColumnNumberLabel(){}
00066 ColumnNumberLabel(const int& Nc,
00067 const std::string& loglab, const std::string& lab,
00068 const std::string& typ="")
00069 :number(Nc), loglabel(loglab) , label(lab), type(typ) {}
00070
00071 int number;
00072 std::string loglabel;
00073 std::string label;
00074 std::string type;
00075 };
00076
00077 class column_labels {
00078
00079
00080 public:
00081 column_labels() {setup = false;}
00082
00083 void add (const std::string& loglabel, const col_opt_flag& cflag);
00084
00085
00086
00087 void addLabin(const std::string& FIlabel, const std::string& sigFIlabel);
00088
00089
00090 int size() const {return columns.size();}
00091
00092
00093 int lookup_col(const std::string& loglabel) const;
00094
00095 std::string Label(const std::string& loglabel) const;
00096
00097
00098 void start() {pcl = columns.begin(); at_start = true;}
00099
00100 bool next(ColumnNumberLabel& CNL);
00101
00102 void Store(ColumnNumberLabel& CNL);
00103
00104
00105 std::string format();
00106
00107 private:
00108 bool setup;
00109
00110
00111 std::map<std::string, ColumnNumberLabel> columns;
00112
00113 std::map<std::string, ColumnNumberLabel>::iterator pcl;
00114 bool at_start;
00115 };
00116
00117 class column_select
00118
00119 {
00120 public:
00121 column_select(){}
00122 column_select(const MtzIO::column_labels& column_list,
00123 col_controls& column_selection);
00124
00125
00126 data_flags DataFlags() const;
00127
00128 int col_h, col_k, col_l, col_misym, col_batch,
00129 col_I, col_sigI, col_Ipr, col_sigIpr, col_fractioncalc,
00130 col_Xdet, col_Ydet, col_Rot, col_Width, col_LP, col_Mpart,
00131 col_ObsFlag, col_BgPkRatio, col_scale, col_sigscale, col_time;
00132 };
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 ClipperLabelPair ProcessLabels(const std::vector<clipper::String>& ColLab,
00148 const column_labels& ColumnLabels,
00149 bool& IorF);
00150
00151
00152 }
00153 #endif