| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 397 人关注过本帖
标题:[讨论]请问如何分析此段源代码
取消只看楼主 加入收藏
思迷思
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-5-6
收藏
 问题点数:0 回复次数:0 
[讨论]请问如何分析此段源代码


// TSCache.h: interface for the CTSCache class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_TSCACHE_H__61CC5EB5_4560_4F34_A6DA_AA35B09D79EC__INCLUDED_)
#define AFX_TSCACHE_H__61CC5EB5_4560_4F34_A6DA_AA35B09D79EC__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Stockdrv.h"
#include "SPTime.h"

typedef struct _ts_packet_t {
UINT m_nMsgType;
PRCV_DATA m_pRCV_DATA;
} TS_PACKET, PTS_PACKET;
typedef CArray< TS_PACKET, TS_PACKET &> CTSPacketArray;

class CTSCache
{
public:
CTSCache();
virtual ~CTSCache();

void SetLocalLatest(CSPTime t);
CSPTime GetLocalLatest();

static CTSCache & GetInstance();

void ClearReceiveBuffer() { m_nBufLen = 0; }

// decode net received data
int OnReceive( BYTE * buf, size_t len );
int DecodePacket( );
int FindFirstPacketLength( );
size_t AlignBuffer( int nStart, BOOL bRemovePrev );
int TryGetPacket( int nPacketLen );
int DiscardPacket( int nPacketLen );

// packets operation
BOOL PushPacket( UINT nMsgType, PRCV_DATA pRCV_DATA );
BOOL PopPacket( UINT & nMsgType, PRCV_DATA & pRCV_DATA );
void FreePacket( PRCV_DATA pRCV_DATA );

// set report
BOOL StoreReports( );
BOOL LoadReports( );
BOOL ReserveReportsSize( int size );
BOOL PushReport( int nNo, RCV_REPORT_STRUCTEx * pBuf );
BOOL PushReport( char * pszStockCode, RCV_REPORT_STRUCTEx * pBuf );
int PushReport( RCV_REPORT_STRUCTEx * pBuf, int size );

// get report
int GetTotalNumber();
BOOL GetStockByNoEx( int nNo, RCV_REPORT_STRUCTEx * pBuf );
BOOL GetStockByCodeEx(char * pszStockCode,int nMarket,RCV_REPORT_STRUCTEx * pBuf);

protected:
CSPTime m_tmLocalLatest;

BYTE m_buffer[0x80000]; // 512k bytes buffer
size_t m_nBufLen;
CCriticalSection m_mutexBuffer;

CTSPacketArray m_aPackets;
CCriticalSection m_mutexPackets;

CMapStringToPtr m_mapReports;
CArray<RCV_REPORT_STRUCTEx, RCV_REPORT_STRUCTEx &> m_aReports;
CCriticalSection m_mutexReports;
};

#endif // !defined(AFX_TSCACHE_H__61CC5EB5_4560_4F34_A6DA_AA35B09D79EC__INCLUDED_)

搜索更多相关主题的帖子: 源代码 
2007-05-16 16:04
快速回复:[讨论]请问如何分析此段源代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021337 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved