求c高手帮忙,帮我分析一下下面的程序段,最好是每一行的含义都解释一下,先给20分,回答得好再加!
#ifndef_DFS_BILLSVR_WORKER_H_#define_DFS_BILLSVR_WORKER_H_#include<dfs.h>#include<dfs...
#ifndef _DFS_BILLSVR_WORKER_H_
#define _DFS_BILLSVR_WORKER_H_
#include <dfs.h>
#include <dfsRSet/dfsRecordSet.h>
#include <ipdr/ipdr.h>
#include <ipdr/ipdrFileTransport.h>
#include <ipdr/ipdrDocumentHandler.h>
#include <ipdr/ipdrDocumentObserver.h>
#include <ipdr/ipdrBinInputStream.h>
#include <ipdr/ipdrGenerator.h>
// 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 展开
#define _DFS_BILLSVR_WORKER_H_
#include <dfs.h>
#include <dfsRSet/dfsRecordSet.h>
#include <ipdr/ipdr.h>
#include <ipdr/ipdrFileTransport.h>
#include <ipdr/ipdrDocumentHandler.h>
#include <ipdr/ipdrDocumentObserver.h>
#include <ipdr/ipdrBinInputStream.h>
#include <ipdr/ipdrGenerator.h>
// 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 展开
1个回答
展开全部
从一开始到最后就是一个条件编译命令(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结束命令。。。。
#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结束命令。。。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询