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

Function AddConfigToClass

deps/tesseract/classify/protos.cpp:63–88  ·  view source on GitHub ↗

---------------------------------------------------------------------- F u n c t i o n s ----------------------------------------------------------------------*/ * @name AddConfigToClass * * Add a new config to this class. Malloc new space and copy the * old configs if necessary. Return the config id for the new config. * * @param Class The class to add to */

Source from the content-addressed store, hash-verified

61 * @param Class The class to add to
62 */
63int AddConfigToClass(CLASS_TYPE Class) {
64 int NewNumConfigs;
65 int NewConfig;
66 int MaxNumProtos;
67 BIT_VECTOR Config;
68
69 MaxNumProtos = Class->MaxNumProtos;
70
71 if (Class->NumConfigs >= Class->MaxNumConfigs) {
72 /* add configs in CONFIG_INCREMENT chunks at a time */
73 NewNumConfigs = (((Class->MaxNumConfigs + CONFIG_INCREMENT) /
74 CONFIG_INCREMENT) * CONFIG_INCREMENT);
75
76 Class->Configurations =
77 (CONFIGS) Erealloc (Class->Configurations,
78 sizeof (BIT_VECTOR) * NewNumConfigs);
79
80 Class->MaxNumConfigs = NewNumConfigs;
81 }
82 NewConfig = Class->NumConfigs++;
83 Config = NewBitVector (MaxNumProtos);
84 Class->Configurations[NewConfig] = Config;
85 zero_all_bits (Config, WordsInVectorOfSize (MaxNumProtos));
86
87 return (NewConfig);
88}
89
90
91/**

Callers

nothing calls this directly

Calls 2

EreallocFunction · 0.85
NewBitVectorFunction · 0.85

Tested by

no test coverage detected