00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MPF_OBJECT_H
00020 #define MPF_OBJECT_H
00021
00022
00023
00024
00025
00026
00027 #include "mpf_types.h"
00028
00029 APT_BEGIN_EXTERN_C
00030
00031
00032 typedef struct mpf_object_t mpf_object_t;
00033
00034
00035 struct mpf_object_t {
00036
00037 const char *name;
00038
00039 apt_bool_t (*destroy)(mpf_object_t *object);
00040
00041 apt_bool_t (*process)(mpf_object_t *object);
00042
00043 void (*trace)(mpf_object_t *object);
00044 };
00045
00046
00047 static APR_INLINE void mpf_object_init(mpf_object_t *object, const char *name)
00048 {
00049 object->name = name;
00050 object->destroy = NULL;
00051 object->process = NULL;
00052 object->trace = NULL;
00053 }
00054
00055
00056 static APR_INLINE void mpf_object_destroy(mpf_object_t *object)
00057 {
00058 if(object->destroy)
00059 object->destroy(object);
00060 }
00061
00062
00063 static APR_INLINE void mpf_object_process(mpf_object_t *object)
00064 {
00065 if(object->process)
00066 object->process(object);
00067 }
00068
00069
00070 static APR_INLINE void mpf_object_trace(mpf_object_t *object)
00071 {
00072 if(object->trace)
00073 object->trace(object);
00074 }
00075
00076
00077 APT_END_EXTERN_C
00078
00079 #endif