HW_Lib/demo/plooc/test_class.h

72 lines
2.0 KiB
C

#ifndef __TEST_CLASS_H__
#define __TEST_CLASS_H__
#include <stdint.h>
#include <stdbool.h>
/*! \NOTE: Make sure #include "plooc_class.h" is close to the class definition
*/
#if defined(__TEST_CLASS_CLASS_IMPLEMENT__)
#define __PLOOC_CLASS_IMPLEMENT__
#elif defined(__TEST_CLASS_CLASS_INHERIT__)
#define __PLOOC_CLASS_INHERIT__
#endif
#include "plooc_class.h"
//! \name class test_class_t
//! @{
declare_class(test_class_t)
def_class(test_class_t,
public_member(
//!< place your public members here
)
private_member(
//!< place your private members here
)
protected_member(
//!< place your protected members here
)
)
end_def_class(test_class_t) /* do not remove this for forward compatibility */
//! @}
typedef struct test_class_cfg_t {
//! put your configuration members here
} test_class_cfg_t;
//! \name interface i_test_class_t
//! @{
def_interface(i_test_class_t)
test_class_t *(*Init)(test_class_t *ptObj, test_class_cfg_t *ptCFG);
void (*Depose)(test_class_t *ptObj);
/* other methods */
end_def_interface(i_test_class_t) /*do not remove this for forward compatibility */
//! @}
extern const i_test_class_t TEST_CLASS;
/*! \brief the constructor of the class: test_class */
extern test_class_t *test_class_init(test_class_t *ptObj, test_class_cfg_t *ptCFG);
/*! \brief the destructor of the class: test_class */
extern void test_class_depose(test_class_t *ptObj);
protected_method(
/*! \brief a method only visible for current class and derived class */
extern void test_class_protected_method_example1(test_class_t *ptObj);
/*! \brief a method only visible for current class and derived class */
extern void test_class_protected_method_example2(test_class_t *ptObj);
)
/*! \note it is very important to undef those macros */
#undef __TEST_CLASS_CLASS_INHERIT__
#undef __TEST_CLASS_CLASS_IMPLEMENT__
#endif