1 #ifndef HAWKTRACER_FEATURE_H 2 #define HAWKTRACER_FEATURE_H 71 #define HT_FEATURE_DEFINE(TYPE_NAME, DESTROY_FNC) \ 72 static HT_FeatureKlass* TYPE_NAME ## _get_class(void) { \ 73 static HT_FeatureKlass feature_klass = { DESTROY_FNC, HT_INVALID_FEATURE_ID }; \ 74 return &feature_klass; \ 76 static TYPE_NAME* TYPE_NAME ## _alloc(void) { \ 77 TYPE_NAME* feature = HT_CREATE_TYPE(TYPE_NAME); \ 79 ((HT_Feature*)feature)->klass = TYPE_NAME ## _get_class(); \ 83 static HT_INLINE TYPE_NAME* TYPE_NAME ## _from_timeline(HT_Timeline* timeline) { \ 84 return ((TYPE_NAME*)ht_timeline_get_feature(timeline, TYPE_NAME ## _get_class())); \ 86 HT_ErrorCode TYPE_NAME ## _register(void) { \ 87 return ht_registry_register_feature(TYPE_NAME ## _get_class()); \ typedefHT_DECLS_BEGIN struct _HT_Feature HT_Feature
Definition: feature.h:13
#define HT_DECLS_END
Defines an end of C linkage block.
Definition: macros.h:17
The struct is a base class for all the user-defined features.
Definition: feature.h:53
uint32_t id
Stores identifier of the feature class.
Definition: feature.h:44
HT_FeatureDestroy destroy
Destroy calback.
Definition: feature.h:35
void(* HT_FeatureDestroy)(HT_Feature *feature)
A type of the destroy feature callback.
Definition: feature.h:20
HT_FeatureKlass * klass
A pointer to a class of the feature.
Definition: feature.h:56
#define HT_DECLS_BEGIN
Defines a beginning of C linkage block.
Definition: macros.h:16
The struct represents a feature class.
Definition: feature.h:28