Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 206 of file rejctmap.h.

Constructor & Destructor Documentation

REJMAP::REJMAP ( )
inline

Definition at line 212 of file rejctmap.h.

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

Definition at line 281 of file rejctmap.cpp.

282  {
283  REJ *to;
284  REJ *from = source.ptr;
285  int i;
286 
287  len = source.length ();
288 
289  if (len > 0) {
290  ptr = (REJ *) alloc_struct (len * sizeof (REJ), "REJ");
291  to = ptr;
292  for (i = 0; i < len; i++) {
293  *to = *from;
294  to++;
295  from++;
296  }
297  }
298  else
299  ptr = NULL;
300 }
Definition: rejctmap.h:101
#define NULL
Definition: host.h:144
void * alloc_struct(inT32 count, const char *)
Definition: memry.cpp:40
REJMAP::~REJMAP ( )
inline

Definition at line 223 of file rejctmap.h.

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

Member Function Documentation

inT16 REJMAP::accept_count ( )

Definition at line 337 of file rejctmap.cpp.

337  { //How many accepted?
338  int i;
339  inT16 count = 0;
340 
341  for (i = 0; i < len; i++) {
342  if (ptr[i].accepted ())
343  count++;
344  }
345  return count;
346 }
short inT16
Definition: host.h:100
int count(LIST var_list)
Definition: oldlist.cpp:108
void REJMAP::full_print ( FILE *  fp)

Definition at line 412 of file rejctmap.cpp.

412  {
413  int i;
414 
415  for (i = 0; i < len; i++) {
416  ptr[i].full_print (fp);
417  fprintf (fp, "\n");
418  }
419 }
void full_print(FILE *fp)
Definition: rejctmap.cpp:237
void REJMAP::initialise ( inT16  length)

Definition at line 324 of file rejctmap.cpp.

325  {
326  if (ptr != NULL)
327  free_struct (ptr, len * sizeof (REJ), "REJ");
328  len = length;
329  if (len > 0)
330  ptr = (REJ *) memset (alloc_struct (len * sizeof (REJ), "REJ"),
331  0, len * sizeof (REJ));
332  else
333  ptr = NULL;
334 }
Definition: rejctmap.h:101
void free_struct(void *deadstruct, inT32, const char *)
Definition: memry.cpp:44
#define NULL
Definition: host.h:144
void * alloc_struct(inT32 count, const char *)
Definition: memry.cpp:40
inT32 length() const
Definition: rejctmap.h:238
inT32 REJMAP::length ( ) const
inline

Definition at line 238 of file rejctmap.h.

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

Definition at line 303 of file rejctmap.cpp.

305  {
306  REJ *
307  to;
308  REJ *
309  from = source.ptr;
310  int
311  i;
312 
313  initialise (source.len);
314  to = ptr;
315  for (i = 0; i < len; i++) {
316  *to = *from;
317  to++;
318  from++;
319  }
320  return *this;
321 }
Definition: rejctmap.h:101
void initialise(inT16 length)
Definition: rejctmap.cpp:324
REJ& REJMAP::operator[] ( inT16  index) const
inline

Definition at line 231 of file rejctmap.h.

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

Definition at line 400 of file rejctmap.cpp.

400  {
401  int i;
402  char buff[512];
403 
404  for (i = 0; i < len; i++) {
405  buff[i] = ptr[i].display_char ();
406  }
407  buff[i] = '\0';
408  fprintf (fp, "\"%s\"", buff);
409 }
char display_char()
Definition: rejctmap.h:144
BOOL8 REJMAP::quality_recoverable_rejects ( )

Definition at line 360 of file rejctmap.cpp.

360  { //Any potential rejs?
361  int i;
362 
363  for (i = 0; i < len; i++) {
364  if (ptr[i].accept_if_good_quality ())
365  return TRUE;
366  }
367  return FALSE;
368 }
#define FALSE
Definition: capi.h:28
#define TRUE
Definition: capi.h:27
BOOL8 REJMAP::recoverable_rejects ( )

Definition at line 349 of file rejctmap.cpp.

349  { //Any non perm rejs?
350  int i;
351 
352  for (i = 0; i < len; i++) {
353  if (ptr[i].recoverable ())
354  return TRUE;
355  }
356  return FALSE;
357 }
#define FALSE
Definition: capi.h:28
#define TRUE
Definition: capi.h:27
void REJMAP::rej_word_bad_permuter ( )

Definition at line 458 of file rejctmap.cpp.

458  { //Reject whole word
459  int i;
460 
461  for (i = 0; i < len; i++) {
462  if (ptr[i].accepted()) ptr[i].setrej_bad_permuter ();
463  }
464 }
void setrej_bad_permuter()
Definition: rejctmap.cpp:156
void REJMAP::rej_word_bad_quality ( )

Definition at line 494 of file rejctmap.cpp.

494  { //Reject whole word
495  int i;
496 
497  for (i = 0; i < len; i++) {
498  if (ptr[i].accepted()) ptr[i].setrej_bad_quality();
499  }
500 }
void setrej_bad_quality()
Definition: rejctmap.cpp:186
void REJMAP::rej_word_block_rej ( )

Definition at line 512 of file rejctmap.cpp.

512  { //Reject whole word
513  int i;
514 
515  for (i = 0; i < len; i++) {
516  if (ptr[i].accepted()) ptr[i].setrej_block_rej();
517  }
518 }
void setrej_block_rej()
Definition: rejctmap.cpp:196
void REJMAP::rej_word_contains_blanks ( )

Definition at line 449 of file rejctmap.cpp.

449  { //Reject whole word
450  int i;
451 
452  for (i = 0; i < len; i++) {
453  if (ptr[i].accepted()) ptr[i].setrej_contains_blanks();
454  }
455 }
void setrej_contains_blanks()
Definition: rejctmap.cpp:150
void REJMAP::rej_word_doc_rej ( )

Definition at line 503 of file rejctmap.cpp.

503  { //Reject whole word
504  int i;
505 
506  for (i = 0; i < len; i++) {
507  if (ptr[i].accepted()) ptr[i].setrej_doc_rej();
508  }
509 }
void setrej_doc_rej()
Definition: rejctmap.cpp:191
void REJMAP::rej_word_mostly_rej ( )

Definition at line 485 of file rejctmap.cpp.

485  { //Reject whole word
486  int i;
487 
488  for (i = 0; i < len; i++) {
489  if (ptr[i].accepted()) ptr[i].setrej_mostly_rej();
490  }
491 }
void setrej_mostly_rej()
Definition: rejctmap.cpp:176
void REJMAP::rej_word_no_alphanums ( )

Definition at line 476 of file rejctmap.cpp.

476  { //Reject whole word
477  int i;
478 
479  for (i = 0; i < len; i++) {
480  if (ptr[i].accepted()) ptr[i].setrej_no_alphanums();
481  }
482 }
void setrej_no_alphanums()
Definition: rejctmap.cpp:171
void REJMAP::rej_word_not_tess_accepted ( )

Definition at line 440 of file rejctmap.cpp.

440  { //Reject whole word
441  int i;
442 
443  for (i = 0; i < len; i++) {
444  if (ptr[i].accepted()) ptr[i].setrej_not_tess_accepted();
445  }
446 }
void setrej_not_tess_accepted()
Definition: rejctmap.cpp:144
void REJMAP::rej_word_row_rej ( )

Definition at line 521 of file rejctmap.cpp.

521  { //Reject whole word
522  int i;
523 
524  for (i = 0; i < len; i++) {
525  if (ptr[i].accepted()) ptr[i].setrej_row_rej();
526  }
527 }
void setrej_row_rej()
Definition: rejctmap.cpp:201
void REJMAP::rej_word_small_xht ( )

Definition at line 422 of file rejctmap.cpp.

422  { //Reject whole word
423  int i;
424 
425  for (i = 0; i < len; i++) {
426  ptr[i].setrej_small_xht ();
427  }
428 }
void setrej_small_xht()
Definition: rejctmap.cpp:104
void REJMAP::rej_word_tess_failure ( )

Definition at line 431 of file rejctmap.cpp.

431  { //Reject whole word
432  int i;
433 
434  for (i = 0; i < len; i++) {
435  ptr[i].setrej_tess_failure ();
436  }
437 }
void setrej_tess_failure()
Definition: rejctmap.cpp:99
void REJMAP::rej_word_xht_fixup ( )

Definition at line 467 of file rejctmap.cpp.

467  { //Reject whole word
468  int i;
469 
470  for (i = 0; i < len; i++) {
471  if (ptr[i].accepted()) ptr[i].setrej_xht_fixup();
472  }
473 }
void setrej_xht_fixup()
Definition: rejctmap.cpp:181
inT16 REJMAP::reject_count ( )
inline

Definition at line 244 of file rejctmap.h.

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

Definition at line 371 of file rejctmap.cpp.

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

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