MCPcopy Create free account
hub / github.com/creatale/node-dv / WriteAdaptedClass

Function WriteAdaptedClass

deps/tesseract/classify/adaptive.cpp:459–490  ·  view source on GitHub ↗

---------------------------------------------------------------------------*/ * This routine writes a binary representation of Class * to File. * * @param File open file to write Class to * @param Class adapted class to write to File * @param NumConfigs number of configs in Class * * @note Globals: none * @note Exceptions: none * @note History: Tue Mar 19 13:33:51 1991, DSJ, Created

Source from the content-addressed store, hash-verified

457 * @note History: Tue Mar 19 13:33:51 1991, DSJ, Created.
458 */
459void WriteAdaptedClass(FILE *File, ADAPT_CLASS Class, int NumConfigs) {
460 int NumTempProtos;
461 LIST TempProtos;
462 int i;
463
464 /* first write high level adapted class structure */
465 fwrite ((char *) Class, sizeof (ADAPT_CLASS_STRUCT), 1, File);
466
467 /* then write out the definitions of the permanent protos and configs */
468 fwrite ((char *) Class->PermProtos, sizeof (uinT32),
469 WordsInVectorOfSize (MAX_NUM_PROTOS), File);
470 fwrite ((char *) Class->PermConfigs, sizeof (uinT32),
471 WordsInVectorOfSize (MAX_NUM_CONFIGS), File);
472
473 /* then write out the list of temporary protos */
474 NumTempProtos = count (Class->TempProtos);
475 fwrite ((char *) &NumTempProtos, sizeof (int), 1, File);
476 TempProtos = Class->TempProtos;
477 iterate (TempProtos) {
478 void* proto = first_node(TempProtos);
479 fwrite ((char *) proto, sizeof (TEMP_PROTO_STRUCT), 1, File);
480 }
481
482 /* then write out the adapted configs */
483 fwrite ((char *) &NumConfigs, sizeof (int), 1, File);
484 for (i = 0; i < NumConfigs; i++)
485 if (test_bit (Class->PermConfigs, i))
486 WritePermConfig (File, Class->Config[i].Perm);
487 else
488 WriteTempConfig (File, Class->Config[i].Temp);
489
490} /* WriteAdaptedClass */
491
492
493/*---------------------------------------------------------------------------*/

Callers 1

WriteAdaptedTemplatesMethod · 0.85

Calls 3

countFunction · 0.85
WritePermConfigFunction · 0.85
WriteTempConfigFunction · 0.85

Tested by

no test coverage detected