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