📄 servicedataqueue.h
字号:
// ServiceDataQueue.h: interface for the CServiceDataQueue class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SERVICEDATAQUEUE_H__27122573_0CF3_11D4_9AA1_000000000000__INCLUDED_)
#define AFX_SERVICEDATAQUEUE_H__27122573_0CF3_11D4_9AA1_000000000000__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Setup.h"
#include "PointerList.h"
#include "CriticalResource.h"
#pragma pack( push, enter_download )
#pragma pack(1)
struct Param
{
int iSize; //pParam指向的数据大小(如果是字符串还要包括0)
int iType; //参数的类型(1:整形,2:字符串,3:voicelist, 4:浮点, 5:结果集)
//参见宏定义
char aszParamName[20]; //参数名(不超过20)
void *pParam; //真正的参数值就放在这里
};
struct ParamList
{
int nCount; //参数的个数
int iServiceType; //服务类型
int iServiceNo; //服务号(功能号)
int iChannelNo; //本结构对应的通道号
int ISN; //表示当前正在执行的指令序号,从0开始,每执行一条指令,递增1,并且把它作为请求的一部分;服务方应答时把它作为应答的一部分.解释器依靠它来判断服务方的应答是否和请求对应,不一样的话,就说明所问非所答(比如服务方可能回答两次),不予理会
BOOL bIsIVR; //设置本请求是人工座席还是IVR送过来的
BOOL bIsReply; //向请求分发线程表明iChannelNo通道正在发送还是接收请求(wtring或wtrequest)
struct Param *pParam; //指向参数链表
char aszPacketID[LEN_STRUCT_HEADER_ROUTE_PACKETID]; //SERVICEBROKER将TSD发来的应答包(就是传真请求)ID存放在这里,传到CURRENTSTATE中去,下次在ANSWERREQUEST中用
int iTimeOut; //超时时间(秒)
};
#pragma pack( pop, enter_download )
struct RequestInfo
{
struct ParamList ParamList;
char aszPacketID[LEN_STRUCT_HEADER_ROUTE_PACKETID];
UINT uiTimerID;
};
struct SaveQueueInfo
{
char aszQueueName[20];
CPtrList *pPtrlistQueue;
};
struct ElementInfo
{
char *szUID;
int iUIDLen;
void *pInfo;
};
class CServiceDataQueue : public CPointerList
{
//attributes
public:
CCriticalResource m_Lock;
HANDLE m_hEvent_Add; //添加一个请求所发生的事件, 每次添加请求都产生此事件
UINT m_WM_DATAQUEUE_ADD;//添加一个请求所向处理线程发送的消息, 每次添加请求都向对应的处理线程发送
DWORD m_dwProcessThreadID; //处理线程的ID
int m_iNotifyType; //添加一项数据时怎样通知处理线程(1:通过EVENT, 2:通过消息)
struct ParamList *m_ppreviousParamList; //保存上一次GetReply()的指针, 下一次GetReply()时释放它, 这样可以免去调用者作这个工作
//保存PACKETID和服务请求的对照表
CPtrList m_ptrListRequestInfo;
//保存路由信息头和SWITCHID的对照表
CPtrList m_ptrListRequestInfo2;
//保存包ID和FAXJOB的对照表
CPtrList m_ptrListRequestInfo4;
//动态的类指针,动态产生CPtrList *
struct SaveQueueInfo *m_psaveInfo;
int m_iSaveInfoQueueCount;
//operations
public:
int CreateSaveInfo(char *szName);
int SaveInfo(char *szName, char *szUID, int iUIDLen, void *pInfo);
int FindSaveInfo(char *szName, char *szUID, int iUIDLen, void **ppInfo);
int FindRequestInfo4(char *szPacketID, void **ppfaxJob);
int SaveRequestInfo4(char *szPacketID, void *pfaxJob);
int FindRequestInfo3(char *szSwitchID, int iSwithIDLen, char *szHeader_Route, HANDLE &hXYWSocket, void **ppOtherInfo);
int SaveRequestInfo3(char *szHeader_Route, char *szSwitchID, int iSwitchIDLen, HANDLE hXYWSocket, void *pOtherInfo);
int FindRequestInfo2(char *szSwitchID, int iSwithIDLen, char *szHeader_Route);
int SaveRequestInfo2(char *szHeader_Route, char *szSwitchID, int iSwitchIDLen);
int FindRequestInfo(char *szPacketID, struct ParamList ¶mList, UINT &uiTimerID);
int FindRequestInfo_ByTimerID(UINT uiTimerID, struct ParamList ¶mList);
int FindRequestInfo_ByChannelNo(int iChannelNo, struct ParamList ¶mList);
int SaveRequestInfo(struct ParamList *pParamList, char *szPacketID, UINT uiTimerID);
static int BirthFromBuffer(char *pBuffer, int iLength, struct ParamList **ppParamList);
static int DumpToBuffer(struct ParamList *pParamList, char **ppBuffer, int *piLength);
static int AddParamListMember_Bin(struct ParamList *pParamList, char *pData, int iLen, char *szParamName = NULL);
static int AddParamListMember_ResultSet(struct ParamList *pParamList, struct ResultSet *presultSet, char *szParamName = NULL);
static int AddParamListMember_VoiceList(struct ParamList *pParamList, struct VoiceList *pvoiceList, char *szParamName = NULL);
static int AddParamListMember_Float(struct ParamList *pParamList, float fValue, char *szParamName = NULL);
static int AddParamListMember_String(struct ParamList *pParamList, char *szValue, char *szParamName = NULL);
static int AddParamListMember_String2(struct ParamList *pParamList, char *pValue, int iLen, char *szParamName = NULL);
static int AddParamListMember_Integer(struct ParamList *pParamList, int iValue, char *szParamName = NULL);
static int CreateParamList(struct ParamList **ppParamList, int iServiceType, int iServiceNo, int iChannelNo, int iISN);
static int FreeParamList(struct ParamList *pParamList);
int GetCount();
int Create(char *szQueueName, DWORD dwProcessThreadID, UINT WM_DATAQUEUE_ADD);
int Create(char *szQueueName);
int GetParamList(struct ParamList **ppParamList);
int AddParamList(struct ParamList *pParamList);
BOOL IsEmpty();
public:
CServiceDataQueue();
virtual ~CServiceDataQueue();
};
#endif // !defined(AFX_SERVICEDATAQUEUE_H__27122573_0CF3_11D4_9AA1_000000000000__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -