作业帮 > 综合 > 作业

求c高手帮忙,帮我分析一下下面的程序段,最好是每一行的含义都解释一下,先给20分,回答得好再加!

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/04/27 21:52:38
求c高手帮忙,帮我分析一下下面的程序段,最好是每一行的含义都解释一下,先给20分,回答得好再加!
#ifndef _DFS_BILLSVR_WORKER_H_
#define _DFS_BILLSVR_WORKER_H_
#include
#include
#include
#include
#include
#include
#include
#include
// billing functions declaration
void printAttributes(struct ipdrStringArray * Schema,
struct ipdrStringArray * Attributes);
ipdrStatus handleRecord(void *CD, struct ipdrRecord * Rec);
class dfsWorker
{
public:
dfsWorker();
~dfsWorker();
int dfInit(dfsModuleInitStruct *init);
// monitor the Dispatcher processes, called from outside
int dfLoopBody();
/* 3 choices for EventHandle output:
1: no return;
2: put into internal Cache for later answer
3: put into the direct answer queue */
int dfEventHandler(dfEventStruct *event);
private:
ipdrDocumentHandler *m_DocHandler;
};
#endif
从一开始到最后就是一个条件编译命令(C语言预处理命令):
#ifndef 宏名
语句段
#endif
作用:如果再此之前没有定义这样的宏名,则编译语句段;
即第一行:#ifndef _DFS_BILLSVR_WORKER_H_
,如果定义了宏名 DFS_BILLSVR_WORKER_H_
则执行下一句!
第二行:#define _DFS_BILLSVR_WORKER_H_,
定义一个宏 DFS_BILLSVR_WORKER_H_,
至于第3、4、5、6、7、8、9、10行,则都是文件包含命令 #include,
具体意义可以去百度里搜,很快的,
第11、12行:就是两个函数1、printAttributes() 2、ipdrStatus handleRecord()
(函数2应该是少了函数类型的定义)的声明了;
接下来:class dfsWorker
{
public:
dfsWorker();
dfsWorker();
int dfInit(dfsModuleInitStruct *init);
// monitor the Dispatcher processes,called from outside
int dfLoopBody();
/* 3 choices for EventHandle output:
1:no return;
2:put into internal Cache for later answer
3:put into the direct answer queue */
int dfEventHandler(dfEventStruct *event);
private:
ipdrDocumentHandler *m_DocHandler;
};
这里开始了一个类的定义了;dfsWorker是类名,这是C++语言的了,不知道你学了没,到时候再追问吧.最后以#endif结束命令.