?? sessionobject.h
字號:
/****************************************************************
Copyright ?, 1989-2002, Hisunsray Tech. Co., Ltd.
File name: SessionObject.h
Author: lizhigang
Version: V3.0.0.0#20030320-1
Date: 2003-03-20
Description:
History:
*****************************************************************/
#ifndef __TSESSIONOBJECT_H_
#define __TSESSIONOBJECT_H_
#include "RTCStype.h"
#include "RTCS_CMap.h"
#include "RunObject.h"
#include "PublicDefine.h"
#include "ISMA.h"
#define INVALID_SESSION_ID 0
#define MAX_FIELD_COUNT 32
#define MAX_FIELD_LEN 128
class TSMGModule;
class TSessionObject : public TRealtimeObject
{
//屬性
public:
//普通屬性
RTCS_CTuint m_SessionID; //會話標識號
time_t m_CreateTime; //會話對象創建時間
TSMGModule* m_pOwner; //流程解釋器模塊指針
char m_Field[MAX_FIELD_COUNT][MAX_FIELD_LEN+1];
//消息包相關的屬性
RTCS_CTuint m_PacketSender; //消息包的發送者
RTCS_CTuint m_PacketSenderObj; //消息包的發送者對象
RTCS_CTuint m_PacketReceiverObj;//消息包的接收者對象
RTCS_CTuint m_CurrResult; //結果值
RTCS_CTuint m_CommandID; //命令ID
RTCS_CTpdu m_pdu; //SGIP發送的包
//和定時相關的屬性
RTCS_CTuint m_TimerID; //定時器索引號
RTCS_CTuint m_DBTimeOutValue; //數據庫模塊超時時限
char m_TempSysStrVar[MAX_FIELD_LEN];
RTCS_CTuint m_Socket; //socket指針(地址)
//方法
public:
TSessionObject(TSMGModule* Owner, RTCS_CTuint SessionID=0);
~TSessionObject();
TSessionObject& operator=(TSessionObject& obj);
void Snapshot(FILE *fp);
//取系統變量
virtual void * GetSysVarAddr(RTCS_CTuint index,RTCS_CTbyte &vtype);
//一般函數
void ClearTimer(RTCS_CTuint TimerID);
RTCS_CTuint SetTimer(RTCS_CTuint owner, RTCS_CTuint interval, RTCS_CTuint attr=0);
RTCS_CTuint PostMessage(RTCS_CTpdu pdu);
RTCS_CTuint PostMessageToSelf(RTCS_CTuint messageID, RTCS_CTuint status);
//原子函數
RTCS_CTuint SetDBTimeOut(TArg* arg);
RTCS_CTuint DataAccess(TArg* arg);
//數據操作函數組
RTCS_CTuint ParseParam(TArg *argv);
RTCS_CTuint SubStr(TArg *argv);
RTCS_CTuint StrUpper(TArg *argv);
RTCS_CTuint StrLower(TArg *argv);
RTCS_CTuint StrDigital(TArg *argv);
RTCS_CTuint StrLen(TArg *argv);
//SMA函數組
RTCS_CTuint SMACmdBind(TArg *argv);
RTCS_CTuint SMAGetDeliverData(TArg *argv);
RTCS_CTuint SMACmdSubmit(TArg *argv);
RTCS_CTuint SMAGetMsgContentLength(TArg *argv);
RTCS_CTuint SMACmdUnbind(TArg *argv);
private:
//SMG所用到的變量、函數
RTCS_CTbyte SMA_Srcterminalid[CMPP_SIZE_Src_terminal_id + 1];
RTCS_CTuint SMA_DestUsrtl;
RTCS_CTbyte SMA_Destterminalid[CMPP_SIZE_Dest_terminal_id + 1];
RTCS_CTuint SMA_MsgLength;
RTCS_CTbyte SMA_MsgContent[CMPP_SIZE_Msg_Content + 1];
void SMAInitData();
};
class TSessionObjectTable:public RTCS_CMap<RTCS_CTuint, RTCS_CTuint, TSessionObject*, TSessionObject*>
{
public:
RTCS_Lock m_Lock;
private:
POSITION m_CurrPos;
RTCS_CTbyte m_ToTailFlag;
RTCS_CTuint m_CurrSessionID;
public:
TSessionObjectTable();
~TSessionObjectTable();
void ClearAll();
int AddSessionObject(TSessionObject* Obj);
TSessionObject* GetSessionObject(RTCS_CTuint SessionID);
void DeleteSessionObject(RTCS_CTuint SessionID);
void Lock();
void Unlock();
//遍歷用的函數
void Reset();
TSessionObject* Next(); //沒有加鎖
//產生唯一Session號的函數
RTCS_CTuint GenerateSessionID();
void Snapshot(FILE* fp);
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -