bool mean(REAL value, REAL penalty_factor) { writelog(LOG_MESSAGE,"creating gridding rule mean(%g,%g)",value,get_mult(penalty_factor)); f_mean * f = new f_mean(value, get_mult(penalty_factor)); functionals_push_back(f); return true; };
void operator()(d_surf * surf) { if ( StringMatch( surf_pos, surf->getName() ) ) { writelog(LOG_MESSAGE,"creating gridding rule mask_wmean(%g,\"%s\",\"%s\",%g)", mean, mask->getName(), surf->getName(), get_mult(penalty_factor)); f_mask_wmean * f = new f_mask_wmean(mean, surf, mask, get_mult(penalty_factor)); functionals_push_back(f); if (res == NULL) res = create_boolvec(); res->push_back(true); } };
void operator()(d_mask * mask) { if ( StringMatch( mask_pos, mask->getName() ) ) { writelog(LOG_MESSAGE,"creating gridding rule mask_geq(%g,\"%s\",%g)", value, mask->getName(), get_mult(penalty_factor)); f_mask_ineq * f = new f_mask_ineq(value, mask, false, get_mult(penalty_factor)); functionals_push_back(f); if (res == NULL) res = create_boolvec(); res->push_back(true); } };
void operator()(d_surf * surf) { if ( StringMatch( pos, surf->getName() ) ) { writelog(LOG_MESSAGE,"creating gridding rule surface_geq(\"%s\",%g)", surf->getName(), get_mult(penalty_factor)); f_surf_ineq * f = new f_surf_ineq(surf, false, get_mult(penalty_factor)); functionals_push_back(f); if (res == NULL) res = create_boolvec(); res->push_back(true); } }
void operator()(d_hist * hist) { if ( StringMatch( pos, hist->getName() ) ) { writelog(LOG_MESSAGE, "creating gridding rule hist(\"%s\",%g)", hist->getName(), get_mult(penalty_factor)); f_hist * f = new f_hist(hist, get_mult(penalty_factor), treshold); functionals_push_back(f); if (res == NULL) res = create_boolvec(); res->push_back(true); } }
/* get best matching lenght of of name or aliaslist of mult 'n' in 'str' */ unsigned int get_matching_length(char *str, unsigned int n) { unsigned len = 0; if (strstr(str, get_mult(n)) != NULL) { len = strlen(get_mult(n)); } for (int i = 0; i < g_slist_length(get_aliases(n)); i++) { char *tmp =g_slist_nth_data(get_aliases(n), i); if (strstr(str, tmp) != NULL) { if (strlen(tmp) >= len) len = strlen(tmp); } } return len; }
int addmult2(void) { int found = 0; int i; int matching_len = 0, idx = -1; char ssexchange[21]; char stripped_comment[21]; char multi_call[20]; shownewmult = -1; // --------------------------- arrlss ------------------------------------ if (arrlss == 1) { g_strlcpy(ssexchange, lan_logline + 54, 21); /* check all possible mults for match and remember the longest one */ for (i = 0; i < mults_possible->len; i++) { int len = get_matching_length(ssexchange, i); if (len > matching_len) { matching_len = len; idx = i; } } if (idx >= 0) { remember_multi(get_mult(idx), bandinx, ALL_BAND); } } // --------------------wysiwyg---------------- if (wysiwyg_once == 1) { g_strlcpy(stripped_comment, lan_logline + 54, 15); g_strchomp(stripped_comment); shownewmult = remember_multi(stripped_comment, bandinx, ALL_BAND); } if (wysiwyg_multi == 1) { g_strlcpy(stripped_comment, lan_logline + 54, 15); g_strchomp(stripped_comment); shownewmult = remember_multi(stripped_comment, bandinx, PER_BAND); } /* -------------- unique call multi -------------- */ g_strlcpy(multi_call, lan_logline + 68, 10); g_strchomp(multi_call); if (unique_call_multi == UNIQUECALL_ALL) { shownewmult = remember_multi(multi_call, bandinx, ALL_BAND); } if (unique_call_multi == UNIQUECALL_BAND) { shownewmult = remember_multi(multi_call, bandinx, PER_BAND); } return (found); }
void operator()(d_points * pnts) { if ( StringMatch( pos, pnts->getName() ) ) { writelog(LOG_MESSAGE,"creating gridding rule points_leq(\"%s\",%g)", pnts->getName(), get_mult(penalty_factor)); if (res == NULL) res = create_boolvec(); f_points_ineq * inpnts = new f_points_ineq(pnts, true, get_mult(penalty_factor)); functionals_push_back(inpnts); res->push_back(true); } }
/* parse a mult line and add data to databse * * multline consists of either * multiplier * or * multplier:followed,by,comma,separated,list,of,aliases * * There may be more than one alias line for a multi, so add all aliases to * that multi */ void add_mult_line(char *line) { possible_mult_t *multi; gchar ** list; char *mult = NULL; int index = -1; list = g_strsplit(line,":",2); mult = g_strstrip(list[0]); /* find mult in already defined ones */ for (int i = 0; i < get_mult_count(); i++) { if (strcmp(get_mult(i), mult) == 0) { index = i; break; } } if (index == -1) { /* not found -> prepare new one */ multi = g_new0(possible_mult_t, 1); multi->name = g_strdup(mult); multi->aliases = NULL; g_ptr_array_add(mults_possible, multi); } else /* else use existing one */ multi = get_mult_base(index); if (list[1] != NULL) { /* parse aliases if present */ gchar ** aliaslist; aliaslist = g_strsplit(list[1], ",", 0); for (int i = 0; aliaslist[i] != NULL; i++) { multi->aliases = g_slist_append(multi->aliases, g_strdup(g_strstrip(aliaslist[i]))); } g_strfreev(aliaslist); } g_strfreev(list); }
int addmult(void) { int found = 0; int i; int matching_len = 0, idx = -1; char *stripped_comment; shownewmult = -1; stripped_comment = strdup(comment); g_strchomp(stripped_comment); // --------------------------- arrlss ------------------------------------ if (arrlss == 1) { /* check all possible mults for match and remember the longest one */ for (i = 0; i < mults_possible->len; i++) { int len = get_matching_length(ssexchange, i); if (len > matching_len) { matching_len = len; idx = i; } } if (idx >= 0) { remember_multi(get_mult(idx), bandinx, ALL_BAND); } } // ---------------------------serial + section --------------------------- if ((serial_section_mult == 1) || (sectn_mult == 1)) { /* is it a possible mult? */ for (i = 0; i < mults_possible->len; i++) { if (get_matching_length(ssexchange, i) == strlen(ssexchange)) { idx = i; break; } } if (idx >= 0) { shownewmult = remember_multi(get_mult(idx), bandinx, PER_BAND); } } // ------------------------------- section ---------------------------- if ((dx_arrlsections == 1) && ((countrynr == w_cty) || (countrynr == ve_cty))) { /* check all possible mults for match and remember the longest one */ for (i = 0; i < mults_possible->len; i++) { int len = get_matching_length(ssexchange, i); if (len > matching_len) { matching_len = len; idx = i; } } if (idx >= 0) { shownewmult = remember_multi(get_mult(idx), bandinx, PER_BAND); } } // --------------------wysiwyg---------------- if (wysiwyg_once == 1) { shownewmult = remember_multi(stripped_comment, bandinx, ALL_BAND); } if (wysiwyg_multi == 1) { shownewmult = remember_multi(stripped_comment, bandinx, PER_BAND); } if (serial_grid4_mult == 1) { section[4] = '\0'; shownewmult = remember_multi(section, bandinx, PER_BAND); } /* -------------- unique call multi -------------- */ if (unique_call_multi == UNIQUECALL_ALL) { shownewmult = remember_multi(hiscall, bandinx, ALL_BAND); } if (unique_call_multi == UNIQUECALL_BAND) { shownewmult = remember_multi(hiscall, bandinx, PER_BAND); } free(stripped_comment); return (found); }