0
我正在研究從輸入目錄中讀取文件的應用程序,處理它們並將其加載到數據庫中。這兩個類Filelist和CurrentFile是應用程序的一部分。 這個類的定義如下。在C++中使用全局變量
class Filelist
{
//list of files
list of files;
// pointer to the current file
CurrentFile *ptr
};
class CurrentFile
{
vector<list of records>
methods to process the records
..
..
};
我得再添審計結構跟蹤成功處理記錄和 出錯了記錄。在處理完所有文件 後,此審計結構將加載到數據庫中。
struct Recaudit
{
//record to keep track of
//Various counts
int successcnt;
int errorcnt;
billedcnt;
some other counts related to the records
};
此審計記錄的數據集跨CurrentFile的多個方法。
可以將此審計記錄作爲CurrentFile(或)的成員變量嗎?是否應該將其聲明爲 靜態全局變量?
我想你想實現一個Singleton – Sindico 2013-05-09 08:48:38
如果審計是針對文件列表中的每個文件都不應該是FileList的成員? – 2013-05-09 08:49:30