All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
REJMAP Class Reference

#include <rejctmap.h>

Public Member Functions

 REJMAP ()
 
 REJMAP (const REJMAP &rejmap)
 
REJMAPoperator= (const REJMAP &source)
 
 ~REJMAP ()
 
void initialise (inT16 length)
 
REJoperator[] (inT16 index) const
 
inT32 length () const
 
inT16 accept_count ()
 
inT16 reject_count ()
 
void remove_pos (inT16 pos)
 
void print (FILE *fp)
 
void full_print (FILE *fp)
 
BOOL8 recoverable_rejects ()
 
BOOL8 quality_recoverable_rejects ()
 
void rej_word_small_xht ()
 
void rej_word_tess_failure ()
 
void rej_word_not_tess_accepted ()
 
void rej_word_contains_blanks ()
 
void rej_word_bad_permuter ()
 
void rej_word_xht_fixup ()
 
void rej_word_no_alphanums ()
 
void rej_word_mostly_rej ()
 
void rej_word_bad_quality ()
 
void rej_word_doc_rej ()
 
void rej_word_block_rej ()
 
void rej_word_row_rej ()
 

Detailed Description

Definition at line 205 of file rejctmap.h.

Constructor & Destructor Documentation

REJMAP::REJMAP ( )
inline

Definition at line 211 of file rejctmap.h.

211  { //constructor
212  ptr = NULL;
213  len = 0;
214  }
#define NULL
Definition: host.h:144
REJMAP::REJMAP ( const REJMAP rejmap)

Definition at line 275 of file rejctmap.cpp.

276  {
277  REJ *to;
278  REJ *from = source.ptr;
279  int i;
280 
281  len = source.length ();
282 
283  if (len > 0) {
284  ptr = (REJ *) alloc_struct (len * sizeof (REJ), "REJ");
285  to = ptr;
286  for (i = 0; i < len; i++) {
287  *to = *from;
288  to++;
289  from++;
290  }
291  }
292  else
293  ptr = NULL;
294 }
Definition: rejctmap.h:100
void * alloc_struct(inT32 count, const char *)
Definition: memry.cpp:39
#define NULL
Definition: host.h:144
REJMAP::~REJMAP ( )
inline

Definition at line 222 of file rejctmap.h.

222  { //destructor
223  if (ptr != NULL)
224  free_struct (ptr, len * sizeof (REJ), "REJ");
225  }
Definition: rejctmap.h:100
#define NULL
Definition: host.h:144
void free_struct(void *deadstruct, inT32, const char *)
Definition: memry.cpp:43

Member Function Documentation

inT16 REJMAP::accept_count ( )

Definition at line 331 of file rejctmap.cpp.

331  { //How many accepted?
332  int i;
333  inT16 count = 0;
334 
335  for (i = 0; i < len; i++) {
336  if (ptr[i].accepted ())
337  count++;
338  }
339  return count;
340 }
int count(LIST var_list)
Definition: oldlist.cpp:108
short inT16
Definition: host.h:100
void REJMAP::full_print ( FILE *  fp)

Definition at line 406 of file rejctmap.cpp.

406  {
407  int i;
408 
409  for (i = 0; i < len; i++) {
410  ptr[i].full_print (fp);
411  fprintf (fp, "\n");
412  }
413 }
void full_print(FILE *fp)
Definition: rejctmap.cpp:234
void REJMAP::initialise ( inT16  length)

Definition at line 318 of file rejctmap.cpp.

319  {
320  if (ptr != NULL)
321  free_struct (ptr, len * sizeof (REJ), "REJ");
322  len = length;
323  if (len > 0)
324  ptr = (REJ *) memset (alloc_struct (len * sizeof (REJ), "REJ"),
325  0, len * sizeof (REJ));
326  else
327  ptr = NULL;
328 }
Definition: rejctmap.h:100
inT32 length() const
Definition: rejctmap.h:237
void * alloc_struct(inT32 count, const char *)
Definition: memry.cpp:39
#define NULL
Definition: host.h:144
void free_struct(void *deadstruct, inT32, const char *)
Definition: memry.cpp:43
inT32 REJMAP::length ( ) const
inline

Definition at line 237 of file rejctmap.h.

237  { //map length
238  return len;
239  }
REJMAP & REJMAP::operator= ( const REJMAP source)

Definition at line 297 of file rejctmap.cpp.

299  {
300  REJ *
301  to;
302  REJ *
303  from = source.ptr;
304  int
305  i;
306 
307  initialise (source.len);
308  to = ptr;
309  for (i = 0; i < len; i++) {
310  *to = *from;
311  to++;
312  from++;
313  }
314  return *this;
315 }
Definition: rejctmap.h:100
void initialise(inT16 length)
Definition: rejctmap.cpp:318
REJ& REJMAP::operator[] ( inT16  index) const
inline

Definition at line 230 of file rejctmap.h.

232  {
233  ASSERT_HOST (index < len);
234  return ptr[index]; //no bounds checks
235  }
#define ASSERT_HOST(x)
Definition: errcode.h:84
void REJMAP::print ( FILE *  fp)

Definition at line 394 of file rejctmap.cpp.

394  {
395  int i;
396  char buff[512];
397 
398  for (i = 0; i < len; i++) {
399  buff[i] = ptr[i].display_char ();
400  }
401  buff[i] = '\0';
402  fprintf (fp, "\"%s\"", buff);
403 }
char display_char()
Definition: rejctmap.h:143
BOOL8 REJMAP::quality_recoverable_rejects ( )

Definition at line 354 of file rejctmap.cpp.

354  { //Any potential rejs?
355  int i;
356 
357  for (i = 0; i < len; i++) {
358  if (ptr[i].accept_if_good_quality ())
359  return TRUE;
360  }
361  return FALSE;
362 }
#define FALSE
Definition: capi.h:29
#define TRUE
Definition: capi.h:28
BOOL8 REJMAP::recoverable_rejects ( )

Definition at line 343 of file rejctmap.cpp.

343  { //Any non perm rejs?
344  int i;
345 
346  for (i = 0; i < len; i++) {
347  if (ptr[i].recoverable ())
348  return TRUE;
349  }
350  return FALSE;
351 }
#define FALSE
Definition: capi.h:29
#define TRUE
Definition: capi.h:28
void REJMAP::rej_word_bad_permuter ( )

Definition at line 452 of file rejctmap.cpp.

452  { //Reject whole word
453  int i;
454 
455  for (i = 0; i < len; i++) {
456  if (ptr[i].accepted()) ptr[i].setrej_bad_permuter ();
457  }
458 }
void setrej_bad_permuter()
Definition: rejctmap.cpp:153
void REJMAP::rej_word_bad_quality ( )

Definition at line 488 of file rejctmap.cpp.

488  { //Reject whole word
489  int i;
490 
491  for (i = 0; i < len; i++) {
492  if (ptr[i].accepted()) ptr[i].setrej_bad_quality();
493  }
494 }
void setrej_bad_quality()
Definition: rejctmap.cpp:183
void REJMAP::rej_word_block_rej ( )

Definition at line 506 of file rejctmap.cpp.

506  { //Reject whole word
507  int i;
508 
509  for (i = 0; i < len; i++) {
510  if (ptr[i].accepted()) ptr[i].setrej_block_rej();
511  }
512 }
void setrej_block_rej()
Definition: rejctmap.cpp:193
void REJMAP::rej_word_contains_blanks ( )

Definition at line 443 of file rejctmap.cpp.

443  { //Reject whole word
444  int i;
445 
446  for (i = 0; i < len; i++) {
447  if (ptr[i].accepted()) ptr[i].setrej_contains_blanks();
448  }
449 }
void setrej_contains_blanks()
Definition: rejctmap.cpp:147
void REJMAP::rej_word_doc_rej ( )

Definition at line 497 of file rejctmap.cpp.

497  { //Reject whole word
498  int i;
499 
500  for (i = 0; i < len; i++) {
501  if (ptr[i].accepted()) ptr[i].setrej_doc_rej();
502  }
503 }
void setrej_doc_rej()
Definition: rejctmap.cpp:188
void REJMAP::rej_word_mostly_rej ( )

Definition at line 479 of file rejctmap.cpp.

479  { //Reject whole word
480  int i;
481 
482  for (i = 0; i < len; i++) {
483  if (ptr[i].accepted()) ptr[i].setrej_mostly_rej();
484  }
485 }
void setrej_mostly_rej()
Definition: rejctmap.cpp:173
void REJMAP::rej_word_no_alphanums ( )

Definition at line 470 of file rejctmap.cpp.

470  { //Reject whole word
471  int i;
472 
473  for (i = 0; i < len; i++) {
474  if (ptr[i].accepted()) ptr[i].setrej_no_alphanums();
475  }
476 }
void setrej_no_alphanums()
Definition: rejctmap.cpp:168
void REJMAP::rej_word_not_tess_accepted ( )

Definition at line 434 of file rejctmap.cpp.

434  { //Reject whole word
435  int i;
436 
437  for (i = 0; i < len; i++) {
438  if (ptr[i].accepted()) ptr[i].setrej_not_tess_accepted();
439  }
440 }
void setrej_not_tess_accepted()
Definition: rejctmap.cpp:141
void REJMAP::rej_word_row_rej ( )

Definition at line 515 of file rejctmap.cpp.

515  { //Reject whole word
516  int i;
517 
518  for (i = 0; i < len; i++) {
519  if (ptr[i].accepted()) ptr[i].setrej_row_rej();
520  }
521 }
void setrej_row_rej()
Definition: rejctmap.cpp:198
void REJMAP::rej_word_small_xht ( )

Definition at line 416 of file rejctmap.cpp.

416  { //Reject whole word
417  int i;
418 
419  for (i = 0; i < len; i++) {
420  ptr[i].setrej_small_xht ();
421  }
422 }
void setrej_small_xht()
Definition: rejctmap.cpp:101
void REJMAP::rej_word_tess_failure ( )

Definition at line 425 of file rejctmap.cpp.

425  { //Reject whole word
426  int i;
427 
428  for (i = 0; i < len; i++) {
429  ptr[i].setrej_tess_failure ();
430  }
431 }
void setrej_tess_failure()
Definition: rejctmap.cpp:96
void REJMAP::rej_word_xht_fixup ( )

Definition at line 461 of file rejctmap.cpp.

461  { //Reject whole word
462  int i;
463 
464  for (i = 0; i < len; i++) {
465  if (ptr[i].accepted()) ptr[i].setrej_xht_fixup();
466  }
467 }
void setrej_xht_fixup()
Definition: rejctmap.cpp:178
inT16 REJMAP::reject_count ( )
inline

Definition at line 243 of file rejctmap.h.

243  { //How many rejects?
244  return len - accept_count ();
245  }
inT16 accept_count()
Definition: rejctmap.cpp:331
void REJMAP::remove_pos ( inT16  pos)

Definition at line 365 of file rejctmap.cpp.

367  {
368  REJ *new_ptr; //new, smaller map
369  int i;
370 
371  ASSERT_HOST (pos >= 0);
372  ASSERT_HOST (pos < len);
373  ASSERT_HOST (len > 0);
374 
375  len--;
376  if (len > 0)
377  new_ptr = (REJ *) memset (alloc_struct (len * sizeof (REJ), "REJ"),
378  0, len * sizeof (REJ));
379  else
380  new_ptr = NULL;
381 
382  for (i = 0; i < pos; i++)
383  new_ptr[i] = ptr[i]; //copy pre pos
384 
385  for (; pos < len; pos++)
386  new_ptr[pos] = ptr[pos + 1]; //copy post pos
387 
388  //delete old map
389  free_struct (ptr, (len + 1) * sizeof (REJ), "REJ");
390  ptr = new_ptr;
391 }
Definition: rejctmap.h:100
#define ASSERT_HOST(x)
Definition: errcode.h:84
void * alloc_struct(inT32 count, const char *)
Definition: memry.cpp:39
#define NULL
Definition: host.h:144
void free_struct(void *deadstruct, inT32, const char *)
Definition: memry.cpp:43

The documentation for this class was generated from the following files: