inline void vInt(const char *kw, int *out_value) { if (param == NULL) return; const char *ptr = pointAfterKw(param, kw); if (ptr == NULL) return; *out_value = atol(ptr); if (doCheck) sp_used_kw.put(kw); }
inline void vStr(const char *kw, AzBytArr *s) { if (param == NULL) return; const char *bp = pointAfterKw(param, kw); if (bp == NULL) return; const char *ep = pointAt(bp, dlm); s->reset(); s->concat(bp, Az64::ptr_diff(ep-bp, "AzParam::vStr")); if (doCheck) sp_used_kw.put(kw); }
inline void vLoss(const char *kw, AzLossType *out_loss) { if (param == NULL) return; AzBytArr s; vStr(kw, &s); if (s.length() > 0) { *out_loss = AzLoss::lossType(s.c_str()); } if (doCheck) sp_used_kw.put(kw); }
inline void swOff(bool *swch, const char *kw, bool doCheckKw=true) { if (param == NULL) return; if (doCheckKw) { if (strstr(kw, "Dont") != kw && (strstr(kw, "No") != kw && strstr(kw, "Normalize") == NULL)) { throw new AzException("AzParam::swOff", "Off-kw should start with \"dont\" or \"No\"", kw); } } const char *ptr = pointAfterKw(param, kw); if (ptr != NULL && (*ptr == '\0' || *ptr == dlm) ) { *swch = false; } if (doCheck) sp_used_kw.put(kw); }
AzpData_img() : data_num(0), channels(-1), sz1(0), sz2(0), dummy_ydim(-1), current_batch(0), total_data_num(-1), data_scale(-1), min_tar(1e+10), max_tar(-1e+10) { sp_x_ext.put(AzpData_Ext_xpmat, AzpData_Ext_x); sp_y_ext.put(AzpData_Ext_ysmat, AzpData_Ext_y); }