/*---------------------------------------------------------------------------*/ ADAPT_TEMPLATES ReadAdaptedTemplates(FILE *File) { /* ** Parameters: ** File open text file to read adapted templates from ** Globals: none ** Operation: Read a set of adapted templates from File and return ** a ptr to the templates. ** Return: Ptr to adapted templates read from File. ** Exceptions: none ** History: Mon Mar 18 15:18:10 1991, DSJ, Created. */ int i; ADAPT_TEMPLATES Templates; /* first read the high level adaptive template struct */ Templates = (ADAPT_TEMPLATES) Emalloc (sizeof (ADAPT_TEMPLATES_STRUCT)); fread ((char *) Templates, sizeof (ADAPT_TEMPLATES_STRUCT), 1, File); /* then read in the basic integer templates */ Templates->Templates = ReadIntTemplates (File, FALSE); /* then read in the adaptive info for each class */ for (i = 0; i < NumClassesIn (Templates->Templates); i++) { Templates->Class[i] = ReadAdaptedClass (File); } return (Templates); } /* ReadAdaptedTemplates */
/** * Read a set of adapted templates from file and return * a ptr to the templates. * * @param fp open text file to read adapted templates from * @return Ptr to adapted templates read from file. * * @note Globals: none */ ADAPT_TEMPLATES Classify::ReadAdaptedTemplates(TFile *fp) { ADAPT_TEMPLATES Templates; /* first read the high level adaptive template struct */ Templates = (ADAPT_TEMPLATES) Emalloc (sizeof (ADAPT_TEMPLATES_STRUCT)); fp->FRead(Templates, sizeof(ADAPT_TEMPLATES_STRUCT), 1); /* then read in the basic integer templates */ Templates->Templates = ReadIntTemplates(fp); /* then read in the adaptive info for each class */ for (int i = 0; i < (Templates->Templates)->NumClasses; i++) { Templates->Class[i] = ReadAdaptedClass(fp); } return (Templates); } /* ReadAdaptedTemplates */