MailStruct.h
上传用户:weimei12
上传日期:2022-08-11
资源大小:185k
文件大小:2k
- /********************************************************************
- created: 2009:1:6 17:48
- author: 李欣
- filename: e:MyProjectFileStoreFileStoreMailFile.h
- classname: CMailFile
- purpose: struct definitions
- *********************************************************************/
- #pragma once
- const UINT MAIL_CLUSTER_CAPACITY = 128;//the capacity of the cluster that can contain the heaps
- const UINT MAIL_HEAP_CAPACITY = 64;//the capacity of the heap that can contain the blocks
- const UINT MAIL_BLOCK_SIZE = 1024 * 1024;//the size of one data block
- //the identity to identify whether a heap has been used
- #define FLAG_NO_USE 0
- #define FLAG_IS_USE 1
- //the version information for further use
- #define SZ_MAILFILE_IDENTITY _T("MAILFILE")
- #define CUR_MAILFILE_VERSION 0x10000
- typedef UINT MAILFILEPOS;
- ///<summary>
- /// the file header
- ///</summary>
- struct FILE_STORE_CLASSEXT SMailFileHeader
- {
- UINT m_nHeadSize; //the size of the header
- BYTE m_byReserve[32];
- TCHAR m_szIdentity[8]; //the identity of the file, = _T("MAILFILE")
- UINT m_nVersion; //the version of the file
-
- MAILFILEPOS m_mailClusterHeadPos; //the cluster position
- MAILFILEPOS m_endFilePos; // the end of the file
- };
- ///<summary>
- /// a top level structure that contains heaps
- ///</summary>
- struct FILE_STORE_CLASSEXT SMailCluster
- {
- UINT m_nMailBlockSize; //the size of each block
- UINT m_nUseHeapCount; //the count of the heaps used
- MAILFILEPOS m_nextClusterPos; //the position of the next cluster, if there is need for further use
- MAILFILEPOS m_HeapPos[MAIL_CLUSTER_CAPACITY];//the position of each heap
- };
- ///<summary>
- /// it consists of blocks, while many heaps comprise a cluster
- ///</summary>
- struct FILE_STORE_CLASSEXT SDataHeap
- {
- MAILFILEPOS m_blockDataStartPos; //the start position of the real data block
- BYTE m_UseFlags[MAIL_HEAP_CAPACITY];//the flags to identify the blocks used
- };
- ///<summary>
- /// a class that encapsulates SMailCluster to make better use of it
- ///</summary>
- class FILE_STORE_CLASSEXT CDataCluster
- {
- public:
- CDataCluster();
- virtual ~CDataCluster();
-
- SMailCluster m_dataCluster;
- MAILFILEPOS m_selfFilePos; // the position of the m_dataCluster
- SDataHeap* m_pDataHeaps; //the heaps that m_dataCluster contains
- CDataCluster* m_pNextDataCluster;//the position of the next cluster, if there is need for further use
- };