AtxDestroyable.h File Reference

Header file for the ATX_Destroyable interface. More...

#include "AtxInterfaces.h"
#include "AtxDefs.h"
#include "AtxTypes.h"
#include "AtxDebug.h"

Go to the source code of this file.

Defines

#define ATX_DESTROY_OBJECT(object)
 Macro to destroy an object through the ATX_Destroyable interface.
#define ATX_IMPLEMENT_DESTROYABLE_INTERFACE(_class)

Functions

ATX_END_INTERFACE_DEFINITION
ATX_Result 
ATX_Destroyable_Destroy (ATX_Destroyable *self)

Variables

ATX_Result(* Destroy )(ATX_Destroyable *self)
 Interface implemented by objects that can be destroyed.


Detailed Description

Header file for the ATX_Destroyable interface.


Define Documentation

#define ATX_DESTROY_OBJECT ( object   ) 

Value:

do {                                                                      \
    if (object) {                                                         \
        ATX_Destroyable* destroyable = ATX_CAST(object, ATX_Destroyable); \
        ATX_ASSERT(destroyable != NULL);                                  \
        ATX_Destroyable_Destroy(destroyable);                             \
        object = NULL;                                                    \
    }                                                                     \
} while(0)
Macro to destroy an object through the ATX_Destroyable interface.

This macro will first try to get an ATX_Destroyable intrerface for an object. If the object does not implement the ATX_Destroyable interface, an exception is thrown. If the object implements the ATX_Destroyble interface, the macro calls the Destroy() method. As a side effect, this macro clears its object reference argument, making it a NULL object reference.

#define ATX_IMPLEMENT_DESTROYABLE_INTERFACE ( _class   ) 

Value:

ATX_IMPLEMENT_GET_INTERFACE_ADAPTER(_class, ATX_Destroyable)   \
static const ATX_DestroyableInterface                          \
_class##_ATX_DestroyableInterface = {                          \
    ATX_GET_INTERFACE_ADAPTER(_class, ATX_Destroyable),        \
    _class##_Destroy                                           \
};


Variable Documentation

ATX_Result(* Destroy)(ATX_Destroyable *self)

Interface implemented by objects that can be destroyed.

Destroys the object instance. After destroying an instance, that instance can no longer be used (clients can no longer call any of the methods on that instance)

Parameters:
self Pointer the the object on which this method is called