librcsb-core-wrapper  1.000
DICParserBase.h
Go to the documentation of this file.
1 //$$FILE$$
2 //$$VERSION$$
3 //$$DATE$$
4 //$$LICENSE$$
5 
6 
14 /*
15  PURPOSE: A DDL 2.1 compliant CIF file parser.
16 */
17 
18 
19 #ifndef DIC_PARSER_BASE_H
20 #define DIC_PARSER_BASE_H
21 
22 
23 #include <iostream>
24 #include <set>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <rcsb/DICScannerBase.h>
29 #include <rcsb/DICParserInt.h>
30 #include <rcsb/CifFileReadDef.h>
31 #include <rcsb/ISTable.h>
32 #include <rcsb/DicFile.h>
33 
43 class DICParser : public DICScanner
44 {
45  public:
67  DICParser(DicFile* dicFileP, CifFile* ddlFileP, bool verbose = false);
68 
86  void Parse(const string& fileName, string& diagnostics);
87 
101  virtual ~DICParser();
102 
107  void Error(const char*);
108 
113  void Clear();
114 
119  void Reset();
120 
125  void ProcessAssignments(void);
126 
131  void ProcessOneAssignment(void);
132 
137  void ProcessItemNameListLoop(void);
138 
143  void ProcessItemNameListName(void);
144 
149  void ProcessValueListItem(void);
150 
155  void ProcessItemName(void);
156 
161  void ProcessLoop(void);
162 
167  void ProcessItemValue(void);
168 
173  void ProcessLsItemValue(void);
174 
179  void ProcessUnknownValue(void);
180 
185  void ProcessMissingValue(void);
186 
191  void ProcessSaveBegin(void);
192 
197  void ProcessSaveEnd(void);
198 
203  void ProcessDataBlockName(void);
204 
205  private:
206  DicFile *_fobj;
207  ISTable *_tbl;
208  int _afterLoop;
209  CifFile *_saveobj;
210  ISTable *_savetbl;
211  ISTable *_prevtbl;
212  ISTable * format;
213  ISTable * cattbl;
214  ISTable * itemtbl;
215  CifFile *ddl;
216  int itemColIndex;
217  int catColIndex;
218  int colIndex2;
219  vector<string> listcat, listitem;
220  vector<string> listitem2;
221  int _nTablesInBlock;
222  int _curItemNo, _curValueNo, _numDataBlocks, _fieldListAlloc, _curRow;
223  vector<string> _fieldList;
224  string _pBufValue;
225  string _tBufKeyword;
226  string _curCategoryName;
227  string _curDataBlockName;
228  string _prevDataBlockName;
229  int _nTablesInBlockSave;
230  int _curItemNoSave, _curValueNoSave;
231  int _numDataBlocksSave, _fieldListAllocSave;
232  int _curRowSave;
233  vector<string> _fieldListSave;
234  string _curCategoryNameSave;
235  string _curDataBlockNameSave;
236  string _prevDataBlockNameSave;
237  string _tmpDataBlockNameSave;
238  string errorLog;
239  std::set<string> _saveFrames;
240  void ProcessLoopDeclaration(void);
241  void ProcessItemNameList(void);
242  void ProcessValueList(void);
243  void ProcessItemValuePair(void);
244  void ProcessLoopDeclarationSave(void);
245  void ProcessItemNameListSave(void);
246  void ProcessValueListSave(void);
247  void ProcessItemValuePairSave(void);
248  void CheckDDL(void);
249 
250  void AfterParseProcessing();
251 
252  void InsertImplicitOrdinalItems();
253 };
254 
255 #endif /* DIC_PARSER_BASE_H */