00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023 #include <string.h>
00024 #include <flgrCoreData.h>
00025 #include <flgrCoreDataIO.h>
00026 #include <flgrCoreDispatch.h>
00027 #include <flgrCoreMalloc.h>
00028 #include "flgrCoreCompare.h"
00029 #include "flgrCoreCompareFast.h"
00030
00040
00041
00042
00043
00044
00045
00051
00052
00053 FLGR_Test flgr_get_test_value(char *test) {
00054
00055
00056 if(strlen(test)==0) {
00057 POST_ERROR("empty test not allowed !\n");
00058 return FLGR_TEST_UNKNOWN;
00059 }
00060
00061 if(strcmp(test,"<")==0) {
00062 return FLGR_TEST_INF;
00063
00064 }else if(strcmp(test,"<=")==0) {
00065 return FLGR_TEST_INFEQ;
00066
00067 }else if(strcmp(test,"==")==0) {
00068 return FLGR_TEST_EQ;
00069
00070 }else if(strcmp(test,">=")==0) {
00071 return FLGR_TEST_SUPEQ;
00072
00073 }else if(strcmp(test,">")==0) {
00074 return FLGR_TEST_SUP;
00075
00076 }else if(strcmp(test,"!=")==0) {
00077 return FLGR_TEST_DIFF;
00078
00079 }else {
00080 POST_ERROR("test ""%s"" unknown !\n",test);
00081 return FLGR_TEST_UNKNOWN;
00082 }
00083
00084 }
00085
00086
00087
00089
00091 #define FLGR_MACRO_COMPARE_1D(dtype) \
00092 dtype *ptrt1 = (dtype*) dat1->array; \
00093 dtype *ptrt2 = (dtype*) dat2->array; \
00094 dtype v1,v2; \
00095 int i,length = dat1->length*dat1->spp; \
00096 \
00097 \
00098 \
00099 switch(test) { \
00100 case FLGR_TEST_INF: \
00101 for(i=0 ; i<length ; i++) { \
00102 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00103 v2 = flgr1d_get_data_array_##dtype(ptrt2,i); \
00104 if( v1<v2 ) {} \
00105 else return FLGR_FALSE; \
00106 } \
00107 break; \
00108 \
00109 case FLGR_TEST_INFEQ: \
00110 for(i=0 ; i<length ; i++) { \
00111 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00112 v2 = flgr1d_get_data_array_##dtype(ptrt2,i); \
00113 if( v1<=v2 ) {} \
00114 else return FLGR_FALSE; \
00115 } \
00116 break; \
00117 \
00118 case FLGR_TEST_EQ: \
00119 for(i=0 ; i<length ; i++) { \
00120 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00121 v2 = flgr1d_get_data_array_##dtype(ptrt2,i); \
00122 if( v1==v2 ) {} \
00123 else return FLGR_FALSE; \
00124 } \
00125 break; \
00126 \
00127 case FLGR_TEST_SUPEQ: \
00128 for(i=0 ; i<length ; i++) { \
00129 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00130 v2 = flgr1d_get_data_array_##dtype(ptrt2,i); \
00131 if( v1>=v2 ) {} \
00132 else return FLGR_FALSE; \
00133 } \
00134 break; \
00135 \
00136 case FLGR_TEST_SUP: \
00137 for(i=0 ; i<length ; i++) { \
00138 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00139 v2 = flgr1d_get_data_array_##dtype(ptrt2,i); \
00140 if( v1>v2 ) {} \
00141 else return FLGR_FALSE; \
00142 } \
00143 break; \
00144 \
00145 case FLGR_TEST_DIFF: \
00146 for(i=0 ; i<length ; i++) { \
00147 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00148 v2 = flgr1d_get_data_array_##dtype(ptrt2,i); \
00149 if( v1!=v2 ) {} \
00150 else return FLGR_FALSE; \
00151 } \
00152 break; \
00153 default: \
00154 return FLGR_FALSE; \
00155 } \
00156 \
00157 return FLGR_TRUE
00158
00159 int flgr1d_compare_fgBIT(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Data1D *dat2) {
00160 FLGR_MACRO_COMPARE_1D(fgBIT);
00161 }
00162 int flgr1d_compare_fgUINT8(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Data1D *dat2) {
00163 #ifdef __SSE2__
00164 if(test == FLGR_TEST_EQ) {
00165 return flgr1d_compare_eq_fast_fgUINT8(dat1,dat2);
00166 }else {
00167 FLGR_MACRO_COMPARE_1D(fgUINT8);
00168 }
00169 #else
00170 FLGR_MACRO_COMPARE_1D(fgUINT8);
00171 #endif
00172 }
00173 int flgr1d_compare_fgUINT16(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Data1D *dat2) {
00174 #ifdef __SSE2__
00175 if(test == FLGR_TEST_EQ) {
00176 return flgr1d_compare_eq_fast_fgUINT16(dat1,dat2);
00177 }else {
00178 FLGR_MACRO_COMPARE_1D(fgUINT16);
00179 }
00180 #else
00181 FLGR_MACRO_COMPARE_1D(fgUINT16);
00182 #endif
00183 }
00184 int flgr1d_compare_fgUINT32(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Data1D *dat2) {
00185 #ifdef __SSE2__
00186 if(test == FLGR_TEST_EQ) {
00187 return flgr1d_compare_eq_fast_fgUINT32(dat1,dat2);
00188 }else {
00189 FLGR_MACRO_COMPARE_1D(fgUINT32);
00190 }
00191 #else
00192 FLGR_MACRO_COMPARE_1D(fgUINT32);
00193 #endif
00194 }
00195 int flgr1d_compare_fgINT8(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Data1D *dat2) {
00196 #ifdef __SSE2__
00197 if(test == FLGR_TEST_EQ) {
00198 return flgr1d_compare_eq_fast_fgINT8(dat1,dat2);
00199 }else {
00200 FLGR_MACRO_COMPARE_1D(fgINT8);
00201 }
00202 #else
00203 FLGR_MACRO_COMPARE_1D(fgINT8);
00204 #endif
00205 }
00206 int flgr1d_compare_fgINT16(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Data1D *dat2) {
00207 #ifdef __SSE2__
00208 if(test == FLGR_TEST_EQ) {
00209 return flgr1d_compare_eq_fast_fgINT16(dat1,dat2);
00210 }else {
00211 FLGR_MACRO_COMPARE_1D(fgINT16);
00212 }
00213 #else
00214 FLGR_MACRO_COMPARE_1D(fgINT16);
00215 #endif
00216 }
00217 int flgr1d_compare_fgINT32(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Data1D *dat2) {
00218 #ifdef __SSE2__
00219 if(test == FLGR_TEST_EQ) {
00220 return flgr1d_compare_eq_fast_fgINT32(dat1,dat2);
00221 }else {
00222 FLGR_MACRO_COMPARE_1D(fgINT32);
00223 }
00224 #else
00225 FLGR_MACRO_COMPARE_1D(fgINT32);
00226 #endif
00227 }
00228 int flgr1d_compare_fgFLOAT32(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Data1D *dat2) {
00229 FLGR_MACRO_COMPARE_1D(fgFLOAT32);
00230 }
00231 int flgr1d_compare_fgFLOAT64(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Data1D *dat2) {
00232 FLGR_MACRO_COMPARE_1D(fgFLOAT64);
00233 }
00234
00236
00247
00248 int flgr1d_compare(FLGR_Data1D *dat1, char * test, FLGR_Data1D *dat2) {
00249 FLGR_Test tst;
00250
00251
00252
00253 if((dat1==NULL) || (dat2==NULL)) {
00254 POST_ERROR("Null objects!\n");
00255 return FLGR_RET_NULL_OBJECT;
00256 }
00257
00258 if(flgr1d_is_data_same_attributes(dat1, dat2, __FUNCTION__)!=FLGR_RET_OK) {
00259 POST_ERROR("Size or Type different\n");
00260 return FLGR_FALSE;
00261 }
00262
00263 tst=flgr_get_test_value(test);
00264 if(tst==FLGR_TEST_UNKNOWN) {
00265 POST_ERROR("Illegal test %s",test);
00266 return FLGR_FALSE;
00267 }
00268
00269 switch(dat1->type) {
00270 case FLGR_BIT:
00271 return flgr1d_compare_fgBIT(dat1,tst,dat2);
00272
00273 case FLGR_UINT8:
00274 return flgr1d_compare_fgUINT8(dat1,tst,dat2);
00275
00276 case FLGR_UINT16:
00277 return flgr1d_compare_fgUINT16(dat1,tst,dat2);
00278
00279 case FLGR_UINT32:
00280 return flgr1d_compare_fgUINT32(dat1,tst,dat2);
00281
00282 case FLGR_INT8:
00283 return flgr1d_compare_fgINT8(dat1,tst,dat2);
00284
00285 case FLGR_INT16:
00286 return flgr1d_compare_fgINT16(dat1,tst,dat2);
00287
00288 case FLGR_INT32:
00289 return flgr1d_compare_fgINT32(dat1,tst,dat2);
00290
00291 case FLGR_FLOAT32:
00292 return flgr1d_compare_fgFLOAT32(dat1,tst,dat2);
00293
00294 case FLGR_FLOAT64:
00295 return flgr1d_compare_fgFLOAT64(dat1,tst,dat2);
00296
00297 default:
00298 POST_ERROR("type unknown!\n");
00299 return FLGR_FALSE;
00300 }
00301 }
00302
00303
00304
00305
00306
00307
00308
00310
00312 #define FLGR_MACRO_COMPARE_CONST_1D(dtype) \
00313 dtype *ptrt1 = (dtype*) dat1->array; \
00314 dtype *ptrt2 = (dtype*) constant->array; \
00315 dtype v1; \
00316 int spp = dat1->spp; \
00317 int i,length = dat1->length*dat1->spp; \
00318 \
00319 \
00320 \
00321 switch(test) { \
00322 case FLGR_TEST_INF: \
00323 for(i=0 ; i<length ; i++) { \
00324 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00325 if( v1<flgr_get_array_##dtype(ptrt2,i%spp) ) {} \
00326 else return FLGR_FALSE; \
00327 } \
00328 break; \
00329 \
00330 case FLGR_TEST_INFEQ: \
00331 for(i=0 ; i<length ; i++) { \
00332 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00333 if( v1<=flgr_get_array_##dtype(ptrt2,i%spp) ) {} \
00334 else return FLGR_FALSE; \
00335 } \
00336 break; \
00337 \
00338 case FLGR_TEST_EQ: \
00339 for(i=0 ; i<length ; i++) { \
00340 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00341 if( v1==flgr_get_array_##dtype(ptrt2,i%spp) ) {} \
00342 else return FLGR_FALSE; \
00343 } \
00344 break; \
00345 \
00346 case FLGR_TEST_SUPEQ: \
00347 for(i=0 ; i<length ; i++) { \
00348 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00349 if( v1>=flgr_get_array_##dtype(ptrt2,i%spp) ) {} \
00350 else return FLGR_FALSE; \
00351 } \
00352 break; \
00353 \
00354 case FLGR_TEST_SUP: \
00355 for(i=0 ; i<length ; i++) { \
00356 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00357 if( v1>flgr_get_array_##dtype(ptrt2,i%spp) ) {} \
00358 else return FLGR_FALSE; \
00359 } \
00360 break; \
00361 \
00362 case FLGR_TEST_DIFF: \
00363 for(i=0 ; i<length ; i++) { \
00364 v1 = flgr1d_get_data_array_##dtype(ptrt1,i); \
00365 if( v1!=flgr_get_array_##dtype(ptrt2,i%spp) ) {} \
00366 else return FLGR_FALSE; \
00367 } \
00368 break; \
00369 \
00370 default: \
00371 return FLGR_FALSE; \
00372 } \
00373 \
00374 return FLGR_TRUE
00375
00376 int flgr1d_compare_const_fgBIT(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00377 FLGR_MACRO_COMPARE_CONST_1D(fgBIT);
00378 }
00379 int flgr1d_compare_const_fgUINT8(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00380 FLGR_MACRO_COMPARE_CONST_1D(fgUINT8);
00381 }
00382 int flgr1d_compare_const_fgUINT16(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00383 FLGR_MACRO_COMPARE_CONST_1D(fgUINT16);
00384 }
00385 int flgr1d_compare_const_fgUINT32(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00386 FLGR_MACRO_COMPARE_CONST_1D(fgUINT32);
00387 }
00388 int flgr1d_compare_const_fgINT8(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00389 FLGR_MACRO_COMPARE_CONST_1D(fgINT8);
00390 }
00391 int flgr1d_compare_const_fgINT16(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00392 FLGR_MACRO_COMPARE_CONST_1D(fgINT16);
00393 }
00394 int flgr1d_compare_const_fgINT32(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00395 FLGR_MACRO_COMPARE_CONST_1D(fgINT32);
00396 }
00397 int flgr1d_compare_const_fgFLOAT32(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00398 FLGR_MACRO_COMPARE_CONST_1D(fgFLOAT32);
00399 }
00400 int flgr1d_compare_const_fgFLOAT64(FLGR_Data1D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00401 FLGR_MACRO_COMPARE_CONST_1D(fgFLOAT64);
00402 }
00403
00405
00416
00417 int flgr1d_compare_const_ptr(FLGR_Data1D *dat1, char * test, FLGR_Vector *constant) {
00418 FLGR_Test tst;
00419
00420
00421
00422 if(dat1==NULL) {
00423 POST_ERROR("Null objects!\n");
00424 return FLGR_RET_NULL_OBJECT;
00425 }
00426
00427 tst=flgr_get_test_value(test);
00428 if(tst==FLGR_TEST_UNKNOWN) {
00429 POST_ERROR("Illegal test %s",test);
00430 return FLGR_FALSE;
00431 }
00432
00433 if(dat1->spp != constant->spp) {
00434 POST_ERROR("Vector size don't correspond\n");
00435 return FLGR_RET_UNDEFINED_ERROR;
00436 }
00437
00438 FLGR_DISPATCH_FUNCTION(FLGR_RET_TYPE_UNKNOWN, dat1->type, flgr1d_compare_const, dat1, tst, constant);
00439 }
00440
00441
00443
00453
00454 int flgr1d_compare_const_str(FLGR_Data1D *dat1, char * test, char *constant) {
00455 int ret;
00456 FLGR_Vector *vector_constant;
00457
00458
00459
00460 if(dat1==NULL) {
00461 POST_ERROR("Null objects!\n");
00462 return FLGR_RET_NULL_OBJECT;
00463 }
00464
00465 vector_constant = flgr_vector_create(dat1->spp,dat1->type);
00466
00467 if((ret=flgr_vector_import_string(vector_constant, constant))
00468 != FLGR_RET_OK) {
00469
00470 POST_ERROR("String is not valid ""%s""\n",constant);
00471 flgr_vector_destroy(vector_constant);
00472 return ret;
00473 }
00474
00475 ret = flgr1d_compare_const_ptr(dat1, test, vector_constant);
00476
00477 flgr_vector_destroy(vector_constant);
00478
00479 return ret;
00480 }
00481
00482
00483
00489
00495
00496
00497
00498
00500
00502 #define FLGR_MACRO_COMPARE_2D(dtype) \
00503 FLGR_Data1D **p1 = dat1->row; \
00504 FLGR_Data1D **p2 = dat2->row; \
00505 int i; \
00506 int ret; \
00507 \
00508 \
00509 \
00510 for(i=0 ; i<dat1->size_y ; i++,p1++,p2++) { \
00511 ret = flgr1d_compare_##dtype(*p1,test,*p2); \
00512 if(ret==FLGR_FALSE) return FLGR_FALSE; \
00513 } \
00514 \
00515 return FLGR_TRUE
00516
00517 int flgr2d_compare_fgBIT(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Data2D *dat2) {
00518 FLGR_MACRO_COMPARE_2D(fgBIT);
00519 }
00520 int flgr2d_compare_fgUINT8(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Data2D *dat2) {
00521 FLGR_MACRO_COMPARE_2D(fgUINT8);
00522 }
00523 int flgr2d_compare_fgUINT16(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Data2D *dat2) {
00524 FLGR_MACRO_COMPARE_2D(fgUINT16);
00525 }
00526 int flgr2d_compare_fgUINT32(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Data2D *dat2) {
00527 FLGR_MACRO_COMPARE_2D(fgUINT32);
00528 }
00529 int flgr2d_compare_fgINT8(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Data2D *dat2) {
00530 FLGR_MACRO_COMPARE_2D(fgINT8);
00531 }
00532 int flgr2d_compare_fgINT16(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Data2D *dat2) {
00533 FLGR_MACRO_COMPARE_2D(fgINT16);
00534 }
00535 int flgr2d_compare_fgINT32(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Data2D *dat2) {
00536 FLGR_MACRO_COMPARE_2D(fgINT32);
00537 }
00538 int flgr2d_compare_fgFLOAT32(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Data2D *dat2) {
00539 FLGR_MACRO_COMPARE_2D(fgFLOAT32);
00540 }
00541 int flgr2d_compare_fgFLOAT64(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Data2D *dat2) {
00542 FLGR_MACRO_COMPARE_2D(fgFLOAT64);
00543 }
00544
00545
00547
00555
00556 int flgr2d_compare(FLGR_Data2D *dat1, char * test, FLGR_Data2D *dat2) {
00557 FLGR_Test tst;
00558
00559
00560
00561 if((dat1==NULL) || (dat2==NULL)) {
00562 POST_ERROR("Null objects!\n");
00563 return FLGR_RET_NULL_OBJECT;
00564 }
00565
00566 if(flgr2d_is_data_same_attributes(dat2, dat1, __FUNCTION__)!=0) {
00567 POST_ERROR("Size are different\n");
00568 return FLGR_FALSE;
00569 }
00570
00571 tst=flgr_get_test_value(test);
00572 if(tst<0) {
00573 POST_ERROR("Illegal test %s",test);
00574 return FLGR_FALSE;
00575 }
00576
00577
00578 if(dat1->type==FLGR_UINT8) {
00579 return flgr2d_compare_fgUINT8(dat1,tst,dat2);
00580
00581 }else if(dat1->type==FLGR_UINT16) {
00582 return flgr2d_compare_fgUINT16(dat1,tst,dat2);
00583
00584 }else if(dat1->type==FLGR_UINT32) {
00585 return flgr2d_compare_fgUINT32(dat1,tst,dat2);
00586
00587 }else if(dat1->type==FLGR_INT8) {
00588 return flgr2d_compare_fgINT8(dat1,tst,dat2);
00589
00590 }else if(dat1->type==FLGR_INT16) {
00591 return flgr2d_compare_fgINT16(dat1,tst,dat2);
00592
00593 }else if(dat1->type==FLGR_INT32) {
00594 return flgr2d_compare_fgINT32(dat1,tst,dat2);
00595
00596 }else if(dat1->type==FLGR_FLOAT32) {
00597 return flgr2d_compare_fgFLOAT32(dat1,tst,dat2);
00598
00599 }else if(dat1->type==FLGR_FLOAT64) {
00600 return flgr2d_compare_fgFLOAT64(dat1,tst,dat2);
00601
00602 }else if(dat1->type==FLGR_BIT) {
00603 return flgr2d_compare_fgBIT(dat1,tst,dat2);
00604
00605 }else {
00606 POST_ERROR("type unknown!\n");
00607 return FLGR_FALSE;
00608 }
00609
00610 }
00611
00612
00613
00614
00616
00618 #define FLGR_MACRO_COMPARE_CONST_2D(dtype) \
00619 FLGR_Data1D **p1 = dat1->row; \
00620 int i,ret; \
00621 \
00622 \
00623 \
00624 for(i=0 ; i<dat1->size_y ; i++,p1++) { \
00625 ret = flgr1d_compare_const_##dtype(*p1,test,constant); \
00626 if(ret==FLGR_FALSE) return FLGR_FALSE; \
00627 } \
00628 \
00629 return FLGR_TRUE
00630
00631
00632 int flgr2d_compare_const_fgBIT(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00633 FLGR_MACRO_COMPARE_CONST_2D(fgBIT);
00634 }
00635 int flgr2d_compare_const_fgUINT8(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00636 FLGR_MACRO_COMPARE_CONST_2D(fgUINT8);
00637 }
00638 int flgr2d_compare_const_fgUINT16(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00639 FLGR_MACRO_COMPARE_CONST_2D(fgUINT16);
00640 }
00641 int flgr2d_compare_const_fgUINT32(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00642 FLGR_MACRO_COMPARE_CONST_2D(fgUINT32);
00643 }
00644 int flgr2d_compare_const_fgINT8(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00645 FLGR_MACRO_COMPARE_CONST_2D(fgINT8);
00646 }
00647 int flgr2d_compare_const_fgINT16(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00648 FLGR_MACRO_COMPARE_CONST_2D(fgINT16);
00649 }
00650 int flgr2d_compare_const_fgINT32(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00651 FLGR_MACRO_COMPARE_CONST_2D(fgINT32);
00652 }
00653 int flgr2d_compare_const_fgFLOAT32(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00654 FLGR_MACRO_COMPARE_CONST_2D(fgFLOAT32);
00655 }
00656 int flgr2d_compare_const_fgFLOAT64(FLGR_Data2D *dat1, FLGR_Test test, FLGR_Vector *constant) {
00657 FLGR_MACRO_COMPARE_CONST_2D(fgFLOAT64);
00658 }
00659
00660
00662
00673
00674 int flgr2d_compare_const_ptr(FLGR_Data2D *dat1, char * test, FLGR_Vector *constant) {
00675 FLGR_Test tst;
00676
00677
00678
00679 if(dat1==NULL) {
00680 POST_ERROR("Null objects!\n");
00681 return FLGR_RET_NULL_OBJECT;
00682 }
00683
00684 tst=flgr_get_test_value(test);
00685 if(tst<0) {
00686 POST_ERROR("Illegal test %s",test);
00687 return FLGR_FALSE;
00688 }
00689
00690 FLGR_DISPATCH_FUNCTION( FLGR_RET_TYPE_UNKNOWN, dat1->type,flgr2d_compare_const,dat1,tst,constant);
00691 }
00692
00693
00694
00695
00697
00708
00709 int flgr2d_compare_const_str(FLGR_Data2D *dat1, char *test, char *constant) {
00710 int ret;
00711 FLGR_Vector *vector_constant;
00712
00713
00714
00715 if(dat1==NULL) {
00716 POST_ERROR("Null objects!\n");
00717 return FLGR_RET_NULL_OBJECT;
00718 }
00719
00720 vector_constant = flgr_vector_create(dat1->spp,dat1->type);
00721
00722 if((ret=flgr_vector_import_string(vector_constant, constant))
00723 != FLGR_RET_OK) {
00724
00725 POST_ERROR("String is not valid ""%s""\n",constant);
00726 flgr_vector_destroy(vector_constant);
00727 return ret;
00728 }
00729
00730 ret = flgr2d_compare_const_ptr(dat1, test, vector_constant);
00731
00732 flgr_vector_destroy(vector_constant);
00733
00734 return ret;
00735 }
00736
00737
00738
00739