source: proto/parabix2/src/ErrorTracker.h @ 1496

Last change on this file since 1496 was 1478, checked in by ksherdy, 8 years ago

Deleted .cpp files.

File size: 1.1 KB
Line 
1/*
2 * ErrorTracker.h
3 *
4 *  Created on: 2011-09-14
5 *      Author: ksherdy
6 */
7
8#ifndef ERRORTRACKER_H_
9#define ERRORTRACKER_H_
10
11#ifndef USE_IDISA
12#include "../lib/lib_simd.h"
13#else
14#include "../../../trunk/libgen/idisa_lib/idisa.hpp"
15#endif
16
17#include "ErrorUtil.h"
18
19class ErrorTracker {
20public:
21
22        ErrorTracker() {
23                noted_pos_in_block = -1;
24        }
25
26        void NoteError(const char * error_msg, BitBlock err_strm) {
27                int pos_in_block = count_forward_zeroes(err_strm);
28                if ((noted_pos_in_block == -1) || (noted_pos_in_block > pos_in_block)) {
29                        noted_pos_in_block = pos_in_block;
30                        noted_error = error_msg;
31                }
32        }
33
34        int If_Error_Report_First(int error_line, int error_column) {
35                if (noted_pos_in_block > -1) {
36                        int error_line, error_column;
37                ReportError(noted_error, error_line, error_column);
38                return -1; // FAIL
39            }
40                return 0; // SUCCESS
41        }
42
43        inline bool Has_Noted_Error() {return (noted_pos_in_block > -1);}
44        inline int Noted_Pos_In_Block() const {return noted_pos_in_block;}
45        inline const char * Noted_Error_Msg() const {return noted_error;}
46
47private:
48  const char * noted_error;
49  int noted_pos_in_block;
50};
51
52#endif /* ERRORTRACKER_H_ */
Note: See TracBrowser for help on using the repository browser.