Many VLFeat algorithms are available in the form of *objects*. The C language, used by VLFeat, does not support objects explicitly. Here an object is intended a C structure along with a number of functions (the object member functions or methods) operating on it. Ideally, the object data structure is kept opaque to the user, for example by defining it in the .c implementation files which are not accessible to the library user.
Object names are capitalized and start with the Vl
prefix (for example VlExampleObject
). Object methods are lowercase and start with the vl_<object_name>_
suffix (e.g. vl_example_object_new
).
Conceptually, an object undergoes four phases during its lifecycle: allocation, initialization, finalization, and deallocation:
sizeof(VlExampleObject)
. Alternatively, the object can simply by allocated on the stack by declaring a local variable of type VlExampleObject.init
keyword, e.g. vl_example_object_init
. Several such methods may be provided.vl_example_object_finalize
method.In practice, most VlFeat object are supposed to be created on the heap. To this end, allocation/initialization and finalization/deallocation are combined into two operations:
new
keyword, e.g. vl_example_object_new
.new
method, combining finalization and deallocation, for example vl_example_object_delete
.Most objects contain a number of methods to get (getters) and set (setters) properties. These should contain the get
and set
keywords in their name, for example
double x = vl_example_object_get_property () ;
vl_example_object_set_property(x) ;