diff --git a/src/ccmain/paragraphs_internal.h b/src/ccmain/paragraphs_internal.h index a7c08d5110..558245af34 100644 --- a/src/ccmain/paragraphs_internal.h +++ b/src/ccmain/paragraphs_internal.h @@ -79,6 +79,13 @@ struct LineHypothesis { LineHypothesis(const LineHypothesis &other) : ty(other.ty), model(other.model) {} + // Copy assignment operator. + LineHypothesis& operator=(const LineHypothesis& other) { + ty = other.ty; + model = other.model; + return *this; + } + bool operator==(const LineHypothesis &other) const { return ty == other.ty && model == other.model; } diff --git a/src/ccstruct/blamer.h b/src/ccstruct/blamer.h index 865ad5f107..b1b325b415 100644 --- a/src/ccstruct/blamer.h +++ b/src/ccstruct/blamer.h @@ -289,6 +289,8 @@ struct BlamerBundle { void SetMisAdaptionDebug(const WERD_CHOICE *best_choice, bool debug); private: + // Copy assignment operator (currently unused, therefore private). + BlamerBundle& operator=(const BlamerBundle& other); void SetBlame(IncorrectResultReason irr, const STRING &msg, const WERD_CHOICE *choice, bool debug) { incorrect_result_reason_ = irr; diff --git a/src/ccstruct/ocrrow.h b/src/ccstruct/ocrrow.h index 878f3a0e35..3ab22c3644 100644 --- a/src/ccstruct/ocrrow.h +++ b/src/ccstruct/ocrrow.h @@ -144,6 +144,9 @@ class ROW:public ELIST_LINK ROW& operator= (const ROW & source); private: + // Copy constructor (currently unused, therefore private). + ROW(const ROW& source); + int32_t kerning; //inter char gap int32_t spacing; //inter word gap TBOX bound_box; //bounding box diff --git a/src/ccstruct/params_training_featdef.h b/src/ccstruct/params_training_featdef.h index 1cd5076e34..16a20e4e5d 100644 --- a/src/ccstruct/params_training_featdef.h +++ b/src/ccstruct/params_training_featdef.h @@ -105,14 +105,19 @@ int ParamsTrainingFeatureByName(const char *name); // Entry with features extracted from a single OCR hypothesis for a word. struct ParamsTrainingHypothesis { ParamsTrainingHypothesis() : cost(0.0) { - memset(features, 0, sizeof(float) * PTRAIN_NUM_FEATURE_TYPES); + memset(features, 0, sizeof(features)); } ParamsTrainingHypothesis(const ParamsTrainingHypothesis &other) { - memcpy(features, other.features, - sizeof(float) * PTRAIN_NUM_FEATURE_TYPES); + memcpy(features, other.features, sizeof(features)); str = other.str; cost = other.cost; } + ParamsTrainingHypothesis& operator=(const ParamsTrainingHypothesis& other) { + memcpy(features, other.features, sizeof(features)); + str = other.str; + cost = other.cost; + return *this; + } float features[PTRAIN_NUM_FEATURE_TYPES]; STRING str; // string corresponding to word hypothesis (for debugging) float cost; // path cost computed by segsearch diff --git a/src/ccstruct/ratngs.cpp b/src/ccstruct/ratngs.cpp index b61cf55294..aa3788a3af 100644 --- a/src/ccstruct/ratngs.cpp +++ b/src/ccstruct/ratngs.cpp @@ -129,6 +129,24 @@ BLOB_CHOICE::BLOB_CHOICE(const BLOB_CHOICE &other) : ELIST_LINK(other) { fonts_ = other.fonts_; } +// Copy assignment operator. +BLOB_CHOICE& BLOB_CHOICE::operator=(const BLOB_CHOICE& other) { + ELIST_LINK::operator=(other); + unichar_id_ = other.unichar_id(); + rating_ = other.rating(); + certainty_ = other.certainty(); + fontinfo_id_ = other.fontinfo_id(); + fontinfo_id2_ = other.fontinfo_id2(); + script_id_ = other.script_id(); + matrix_cell_ = other.matrix_cell_; + min_xheight_ = other.min_xheight_; + max_xheight_ = other.max_xheight_; + yshift_ = other.yshift(); + classifier_ = other.classifier_; + fonts_ = other.fonts_; + return *this; +} + // Returns true if *this and other agree on the baseline and x-height // to within some tolerance based on a given estimate of the x-height. bool BLOB_CHOICE::PosAndSizeAgree(const BLOB_CHOICE& other, float x_height, diff --git a/src/ccstruct/ratngs.h b/src/ccstruct/ratngs.h index 18b2ac8ce7..4e3c6772d7 100644 --- a/src/ccstruct/ratngs.h +++ b/src/ccstruct/ratngs.h @@ -197,6 +197,9 @@ class BLOB_CHOICE: public ELIST_LINK } private: + // Copy assignment operator. + BLOB_CHOICE& operator=(const BLOB_CHOICE& other); + UNICHAR_ID unichar_id_; // unichar id // Fonts and scores. Allowed to be empty. GenericVector fonts_; diff --git a/src/textord/fpchop.h b/src/textord/fpchop.h index 0bcfb2cf33..4cda239d5a 100644 --- a/src/textord/fpchop.h +++ b/src/textord/fpchop.h @@ -52,6 +52,8 @@ class C_OUTLINE_FRAG:public ELIST_LINK int16_t ycoord; //coord of cut pt private: + // Copy constructor (currently unused, therefore private). + C_OUTLINE_FRAG(const C_OUTLINE_FRAG& other); }; ELISTIZEH(C_OUTLINE_FRAG)