xxxxxx
来源:互联网 发布:rete算法 编辑:程序博客网 时间:2024/05/17 23:59
typedef struct
{
int refs; // reference count
int count_1fen;
int count_2fen;
int count_5fen;
} bank_data_s_type
bank_data_s_type* PiggyBank_New( )
{
bank_data_s_type *pNew = MALLOC(sizeof(bank_data_s_type));
if (pNew != NULL)
MEMSET(pNew,0x00, sizeof(bank_data_s_type));
PiggyBank_AddRefs(pNew);
return pNew;
}
static void PiggyBank_Free(bank_data_s_type **ppData)
{
if (NULL == ppData)
return;
FREE(*ppData);
*ppData = NULL;
}
int PiggyBank_AddRefs(bank_data_s_type *pData)
{
return pData->refs++;
}
int PiggyBank_Release(bank_data_s_type *pData)
{
if (--pData->refs > 0)
return pData->refs;
PiggyBank_Free(&pData);
return 0;
}
void PiggyBank_Input(bank_data_s_type *pData, int type)
{
… …
}
void PiggyBank_Output(bank_data_s_type *pData, int type)
{
… …
}
int PiggyBank_GetTotal(bank_data_s_type *pData, int type)
{
… …
}
///////////////////////////////////////////////////////////
enum { COIN_TYPE_NONE, COIN_TYPE_1FEN, COIN_TYPE_2FEN, COIN_TYPE_5FEN }; typedef struct PiggyBank PiggyBank; PiggyBank* PiggyBank_New( ); int PiggyBank_AddRefs(PiggyBank *pPiggyBank); int PiggyBank_Release(PiggyBank *pPiggyBank); void PiggyBank_Input(PiggyBank *pPiggyBank, int type); void PiggyBank_Output(PiggyBank *pPiggyBank, int type); int PiggyBank_GetTotal(PiggyBank *pPiggyBank, int type); 储蓄罐封装形式四:PiggyBank.c struct PiggyBank { int refs; // reference count int count_1fen; int count_2fen; int count_5fen; }; PiggyBank* PiggyBank_New( ) { PiggyBank *pNew = MALLOC(sizeof(PiggyBank)); if (pNew != NULL) MEMSET(pNew, 0x00, sizeof(PiggyBank)); PiggyBank_AddRefs(pNew); return pNew; } static void PiggyBank_Free(PiggyBank **ppPiggyBank) { … … } int PiggyBank_AddRefs(PiggyBank *pPiggyBank) { … … } int PiggyBank_Release(PiggyBank *pPiggyBank) { … … } void PiggyBank_Input(PiggyBank *pPiggyBank, int type) { … … } void PiggyBank_Output(PiggyBank *pPiggyBank, int type) { … … } int PiggyBank_GetTotal(PiggyBank *pPiggyBank, int type) { … … }
- xxxxxx
- xxxxxx
- xxxxxx
- xxxxxx
- xxxxxx
- XXXXXX
- xxxxxx
- xxxxxx
- xxxxxx
- About _T("xxxxxx")
- SyntaxErrorException系列日记一:FUNCTION xxxxxx.xxxxxx does not exist
- Invalid path /xxxxxx was requested
- [Frame(extraClass="XXXXXX")] 标签
- 常见问题:ntfs volume name xxxxxx
- ORA-00904: "XXXXXX": 标识符无效
- unity中的[xxxxxx]特性(Attributes)
- duplicate symbol _base64_encode in :xxxxxx
- ORA-01950: no privileges on tablespace 'xxxxxx'
- mtk将图片转成数组buffer
- raised an exception.Cause:Undefined instruction
- Java程序员认证考试 ---SUN认证
- 闲聊linux中的input设备之前言
- 配置安装PHP环境信息
- xxxxxx
- Oracle11g、PL/SQL、ArcSDE笔记
- 闲聊linux中的input设备(1)Linux中的设备大家族
- mysql 5.5.7 innodb优化
- sicily 1004
- html导入js页面遇到的编码问题
- 华为面试题算什么,这个背会了外企随便进
- 交友QQ群
- 对ruby on rails学习的一点建议