00001 //$$FILE$$ 00002 //$$VERSION$$ 00003 //$$DATE$$ 00004 //$$LICENSE$$ 00005 00013 /* 00014 PURPOSE: Definitions for selective parsing/reading cif file 00015 */ 00016 00017 #ifndef CIFFILEREADDEF_H 00018 #define CIFFILEREADDEF_H 00019 00020 #include <string> 00021 #include <vector> 00022 00023 00024 #include <iostream> 00025 #include <fstream> 00026 #include <stdio.h> 00027 #include <string.h> 00028 00029 enum type {A, D}; //A-list of accepted categorys/datablocks; D-denied 00030 00031 #define INVALID_NUM_CATS -1 00032 00038 class CifFileReadDef 00039 { 00040 private: 00041 int _numCatsToRead; 00042 int _numReadCats; 00043 void SetNumCatsToRead(); 00044 protected: 00045 std::vector<std::string> _datablocklist; 00046 std::vector<std::string> _categorylist; 00047 type _datablocklisttype; 00048 type _categorylisttype; 00049 00050 00051 public: 00052 CifFileReadDef(std::vector<std::string> dblist,std::vector<std::string>clist,type dbtype = A, type ctype = A); 00053 CifFileReadDef(){_numCatsToRead = INVALID_NUM_CATS; _numReadCats = 0;}; 00054 ~CifFileReadDef(){}; 00055 00056 void SetDataBlockList(std::vector<std::string> dblist,type dbtype = A); 00057 void SetCategoryList(std::vector<std::string>clist, type ctype = A); 00058 00059 void SetDataBlockListType(type dbtype = A) { _datablocklisttype=dbtype;}; 00060 void SetCategoryListType(type ctype = A){_categorylisttype=ctype;}; 00061 00062 int AreAllCatsRead(); 00063 void IncreaseNumReadCats(); 00064 00065 int Category_OK(const std::string& categoryName); 00066 int Datablock_OK(const std::string& datablockName); 00067 }; 00068 #endif