hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
makro.h
Go to the documentation of this file.
1 // imageCrawler Data
2 #define TWO_LEVEL_20 1024 * 1024
3 #define DELL_RES_SIZE 1024 * 1024 * 64
4 
5 #ifndef TIME_START
6 #define TIME_START gettimeofday(& tv , NULL);\
7  timer = (tv.tv_usec + tv.tv_sec * 1000000);
8 #endif
9 
10 #ifndef TIME_END
11 #define TIME_END(str,count) gettimeofday(& tv , NULL);\
12  timer = (tv.tv_usec + tv.tv_sec * 1000000) - timer ;\
13  if(timer > count)\
14  std::cout << str << timer << std::endl;
15 #endif
16 
17 #ifndef DELL_PTR
18 #define DELL_PTR(ptr) if (ptr)\
19  {\
20  delete ptr;\
21  ptr = NULL;\
22  }
23 #endif
24 
25 #ifndef DELL_BUFF
26 #define DELL_BUFF(buff) if (buff)\
27  {\
28  delete [] buff;\
29  buff = NULL;\
30  }
31 #endif
32 
33 #define BREAK_SPACE(i)\
34  while(source [i] == ' ')\
35  {\
36  i++;\
37  }
38 
39 #define BREAK_SPACE_IF_SIZE(i, size)\
40  while((source[i] == ' ' || source[i] == '\r' || source[i] == '\n') && i < size)\
41  {\
42  i++;\
43  }
44 
45 #define RETURN_IF_SIZE(y,buff)\
46  if (y >= size)\
47  {\
48  if (buff)\
49  {\
50  delete [] buff;\
51  }\
52  return;\
53  }
54 
55 #define PREPARE_DOMEN(url)\
56  i = 0;\
57  if (beganRstr(url, "http://www."))\
58  {\
59  url += 11;\
60  }\
61  else if (beganRstr(url, "http://"))\
62  {\
63  url += 7;\
64  }\
65  if (beganRstr(url, "https://www."))\
66  {\
67  url += 12;\
68  }\
69  else if (beganRstr(url, "https://"))\
70  {\
71  url += 8;\
72  }\
73  else if (beganRstr(url, "www."))\
74  {\
75  url += 4;\
76  }\
77  while (url[i] != 0 && url[i] != '/')\
78  {\
79  i++;\
80  }
81 
82 #define CUT_PROTOCOL_NAME_LONGLIST(str)\
83  if (strstr(str, "http://www.") == str)\
84  {\
85  str += 11;\
86  }\
87  else if (strstr(str, "http://") == str)\
88  {\
89  str += 7;\
90  }\
91  else if (strstr(str, "https://www.") == str)\
92  {\
93  str += 12;\
94  }\
95  else if (strstr(str, "https://") == str)\
96  {\
97  str += 8;\
98  }\
99  else if (strstr(str, "cds://") == str)\
100  {\
101  str += 6;\
102  }
103 
104 #define CUT_PROTOCOL_NAME_SHORTLIST(str)\
105  if (strstr(str, "http://") == str)\
106  {\
107  str += 7;\
108  }\
109  else if (strstr(str, "https://") == str)\
110  {\
111  str += 8;\
112  }\
113  else if (strstr(str, "cds://") == str)\
114  {\
115  str += 6;\
116  }
117 
118 #define HTML_DOC_TYPE 1
119 #define IMAGE_DOC_TYPE 2
120 #define SUN_DOC_TYPE 4
121 #define UNKNOWN_DOC_TYPE 10
122 #define WORD_DOC_TYPE 5
123 #define EXEL_DOC_TYPE 6
124 #define PPOINT_DOC_TYPE 7
125 #define RSS_DOC_TYPE 8
126 #define PDF_DOC_TYPE 9
127 #define XML_DOC_TYPE 11
128 #define SQL_DOC_TYPE 12
129 
130 
131 #define SM_TTIME TIME_END("", 0xFFFFFFFF)\
132  if (statistic)\
133  {\
134  statistic->SMTime += timer;\
135  statistic->SMCount++;\
136  }
137 
138 #define FREE_CDR_DATA incr = 0;\
139  offsetIncr = 0;\
140  free(hCrcInsert);\
141  hCrcInsert = NULL;\
142  free(offsetInsert);\
143  offsetInsert = NULL;\
144  free(simClassInsert);\
145  simClassInsert = NULL;\
146  free(wordsSentencesInsert);\
147  wordsSentencesInsert = NULL;\
148  free(wordsLingIntegrityInsert);\
149  wordsLingIntegrityInsert = NULL;\
150  memset(typesOffset, 0, 16 * sizeof(unsigned int));\
151  typesPresenceMask = 0;\
152  typeOffset = 0;
153 
154 #define DIC_ATTEMPT_COUNT 4
155 #define CRW_LOG_SEPARATOR '\t'
156 
157 #define SDP_CONN 0
158 #define RW_CONN 1
159 
160 #define CODING_AUTO_SIZE 32
161 
162 #define IMAGE_CODE 7