00001
00002
00003
00004
00005
00006
00007
00008
00013 #ifndef _ATX_DESTROYABLE_H_
00014 #define _ATX_DESTROYABLE_H_
00015
00016
00017
00018
00019 #include "AtxInterfaces.h"
00020 #include "AtxDefs.h"
00021 #include "AtxTypes.h"
00022 #include "AtxDebug.h"
00023
00024
00025
00026
00027 ATX_DECLARE_INTERFACE(ATX_Destroyable)
00031 ATX_BEGIN_INTERFACE_DEFINITION(ATX_Destroyable)
00040 ATX_Result (*Destroy)(ATX_Destroyable* self);
00041 ATX_END_INTERFACE_DEFINITION
00042
00043
00044
00045
00046 #if defined(__cplusplus)
00047 extern "C" {
00048 #endif
00049
00050 ATX_Result ATX_Destroyable_Destroy(ATX_Destroyable* self);
00051
00052 #if defined(__cplusplus)
00053 }
00054 #endif
00055
00056
00057
00058
00069 #define ATX_DESTROY_OBJECT(object) \
00070 do { \
00071 if (object) { \
00072 ATX_Destroyable* destroyable = ATX_CAST(object, ATX_Destroyable); \
00073 ATX_ASSERT(destroyable != NULL); \
00074 ATX_Destroyable_Destroy(destroyable); \
00075 object = NULL; \
00076 } \
00077 } while(0)
00078
00079 #define ATX_IMPLEMENT_DESTROYABLE_INTERFACE(_class) \
00080 ATX_IMPLEMENT_GET_INTERFACE_ADAPTER(_class, ATX_Destroyable) \
00081 static const ATX_DestroyableInterface \
00082 _class##_ATX_DestroyableInterface = { \
00083 ATX_GET_INTERFACE_ADAPTER(_class, ATX_Destroyable), \
00084 _class##_Destroy \
00085 };
00086
00087 #endif
00088
00089
00090
00091
00092