Test whether an object is already deleted.
The operator test_obj_def checks whether the object still exists in the HALCON operator data base (i.e. whether the surrogate is still valid). This check especially makes sense before deleting an object if it is not sure that the object has already been deleted by a prior deleting operator (clear_obj).
The operator test_obj_def can return TRUE even if the object was already deleted because the surrogates of deleted objects are re-used for new objects. In this context see the example.
|
Object (input_object) |
object -> object |
| Object to be checked. | |
Herror err;
circle(&Circle,100.0,100.0,100.0);
err = test_obj_def(Circle);
printf("Result for test_obj_def (H_MSG_TRUE): %d\n",err);
clear_obj(Circle);
err = test_obj_def(Circle);
printf("Result for test_obj_def (H_MSG_FALSE): %d\n",err);
gen_rectangle1(&Rectangle,200.0,200.0,300.0,300.0);
err = test_obj_def(Circle);
printf("Result for test_obj_def (H_MSG_TRUE!!!): %d\n",err);
The runtime complexity is O(1).
The operator test_obj_def returns the value 2 (H_MSG_TRUE) if an object with this surrogate is present in the HALCON operator data base, otherwise the value 3 (H_MSG_FALSE) is returned. The behavior in case of empty input (no input objects available) is set via the operator set_system(::'no_object_result',<Result>:).
test_obj_def is reentrant and processed without parallelization.
clear_obj, gen_circle, gen_rectangle1
set_check, clear_obj, reset_obj_db
bool
Foundation