00001
00002
00003
00004
00005
00006 #ifndef __CCP4base__Class__
00007 #define __CCP4base__Class__
00008 #include <vector>
00009 #include <set>
00010 #include <cctype>
00011 #include <cstdlib>
00012 #include <iostream>
00013 #include <fstream>
00014 #include <sstream>
00015 #include <string>
00016 #include <map>
00017 #include <math.h>
00018 #include <stdarg.h>
00019 #include <stdlib.h>
00020 #include "Errors.hh"
00021 #include "Preprocessor.hh"
00022 #include "InputBase.hh"
00023
00024
00025 #include <clipper/clipper.h>
00026 typedef clipper::Vec3<float> FVect3;
00027 typedef clipper::Vec3<double> DVect3;
00028 typedef clipper::Mat33<double> DMat33;
00029
00030 typedef double floatType;
00031
00032 namespace phaser_io {
00033
00034 class CCP4base
00035 {
00036 protected:
00037 std::string keywords;
00038 floatType number_value;
00039 std::string string_value;
00040 Token_value curr_tok;
00041 std::vector<std::string> possible_keys;
00042 std::vector<inputPtr> possible_fns;
00043
00044 private:
00045 bool annotate_keywords;
00046
00047 public:
00048 CCP4base()
00049 {
00050 string_value = "";
00051 number_value = 0;
00052 curr_tok = END ;
00053
00054
00055
00056
00057
00058 keywords = "";
00059 annotate_keywords = true;
00060 }
00061 virtual ~CCP4base() { }
00062
00063
00064
00065
00066
00067
00068 void Add_Key(std::string card);
00069
00070 Token_value skip_line(std::istringstream& input_stream);
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 Token_value get_token(std::istringstream& input_stream);
00081
00082 Token_value get_key(std::istringstream& input_stream);
00083
00084 bool getBoolean(std::istringstream& input_stream);
00085
00086 std::string getLine(std::istringstream& input_stream);
00087
00088 std::string getFileName(std::istringstream& input_stream);
00089
00090 void getAssign(std::istringstream& input_stream);
00091
00092 std::string getString(std::istringstream& input_stream);
00093
00094 floatType get1num(std::istringstream& input_stream);
00095
00096 DVect3 get3nums(std::istringstream& input_stream);
00097
00098 DMat33 get9nums(std::istringstream& input_stream);
00099
00100 bool keyIs(std::string key);
00101
00102 bool tokenIs(std::istringstream& input_stream,int va_len, ...);
00103 bool tokenIs(int va_len, ...);
00104
00105
00106 bool compulsoryKey(int va_len, ...);
00107 bool compulsoryKey(std::istringstream& input_stream,int va_len, ...);
00108 bool optionalKey(std::istringstream& input_stream,int va_len, ...);
00109 bool optionalKey(int va_len, ...);
00110
00111 void parseCCP4(Preprocessor capture);
00112 floatType isperc(floatType percent);
00113 std::string Keywords();
00114 };
00115
00116 }
00117
00118 #endif