HawkTracer  0.10.0
feature.h File Reference

Go to the source code of this file.

Classes

struct  HT_FeatureKlass
 The struct represents a feature class. More...
 
struct  _HT_Feature
 The struct is a base class for all the user-defined features. More...
 

Macros

#define HT_FEATURE_DEFINE(TYPE_NAME, DESTROY_FNC)
 Defines a set of methods that help defining timeline feature. More...
 

Typedefs

typedef typedefHT_DECLS_BEGIN struct _HT_Feature HT_Feature
 
typedef void(* HT_FeatureDestroy) (HT_Feature *feature)
 A type of the destroy feature callback. More...
 

Macro Definition Documentation

◆ HT_FEATURE_DEFINE

#define HT_FEATURE_DEFINE (   TYPE_NAME,
  DESTROY_FNC 
)
Value:
static HT_FeatureKlass* TYPE_NAME ## _get_class(void) { \
static HT_FeatureKlass feature_klass = { DESTROY_FNC, HT_INVALID_FEATURE_ID }; \
return &feature_klass; \
} \
static TYPE_NAME* TYPE_NAME ## _alloc(void) { \
TYPE_NAME* feature = HT_CREATE_TYPE(TYPE_NAME); \
if (feature) { \
((HT_Feature*)feature)->klass = TYPE_NAME ## _get_class(); \
} \
return feature; \
} \
static HT_INLINE TYPE_NAME* TYPE_NAME ## _from_timeline(HT_Timeline* timeline) { \
return ((TYPE_NAME*)ht_timeline_get_feature(timeline, TYPE_NAME ## _get_class())); \
} \
HT_ErrorCode TYPE_NAME ## _register(void) { \
return ht_registry_register_feature(TYPE_NAME ## _get_class()); \
}
typedefHT_DECLS_BEGIN struct _HT_Feature HT_Feature
Definition: feature.h:13
HT_DECLS_BEGIN HT_API HT_ErrorCode ht_registry_register_feature(HT_FeatureKlass *klass)
Registers new a new feature in the system.
#define HT_CREATE_TYPE(Type)
Allocates memory for a specific Type.
Definition: alloc.h:74
#define HT_INVALID_FEATURE_ID
Defines an invalid feature identifier.
Definition: base_types.h:45
typedefHT_DECLS_BEGIN struct _HT_Timeline HT_Timeline
Definition: timeline.h:23
HT_API HT_Feature * ht_timeline_get_feature(HT_Timeline *timeline, HT_FeatureKlass *feature_klass)
Gets the feature object of a specific class from the pipeline.
#define HT_INLINE
Defines an inline directive for inlining functions.
Definition: macros.h:59
The struct represents a feature class.
Definition: feature.h:28

Defines a set of methods that help defining timeline feature.

Parameters
TYPE_NAMEa name of the struct that represents the new feature.
DESTROY_FNCa functor for destroying the feature object (of type HT_FeatureDestroy).

The struct defines following functions

  • TYPE_NAME_get_class() - returns class of the feature
  • TYPE_NAME_alloc() - allocates memory (using ht_alloc()) and initializes the feature object
  • TYPE_NAME_from_timeline() - gets the feature object from the timeline. Returns NULL if the feature is not enabled for the timeline.
  • TYPE_NAME_register() - registers a feature in HawkTracer.

Typedef Documentation

◆ HT_Feature

typedef typedefHT_DECLS_BEGIN struct _HT_Feature HT_Feature
See also
_HT_Feature

◆ HT_FeatureDestroy

typedef void(* HT_FeatureDestroy) (HT_Feature *feature)

A type of the destroy feature callback.

Parameters
featurea feature to destory.