Files
cimforreduceloss/testHasttable/nodetoterminal.h
facat@lab.com 69cd117f35 1.修复了一些类的isTerminal没有被初始化的bug
2.修复了一些地方判断下一个Terminal的bug
Signed-off-by: facat@lab.com <facat@lab.com>
2014-12-06 21:48:07 +08:00

31 lines
858 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef NODETOTERMINAL_H
#define NODETOTERMINAL_H
//一个通过Node检索Terminal的表做成单例形式
#include <QHash>
#include <QString>
#include <QVector>
class NodeToTerminal
{
public:
NodeToTerminal();
~NodeToTerminal();
void add(const QString& key,const QString& value);
bool contains(const QString& key);
QVector<QString> value(const QString& key);
private:
class CG // 它的唯一工作就是在析构函数中删除CSingleton的实例
{
public:
~CG()
{
if (NodeToTerminal::ht)
delete NodeToTerminal::ht;
}
};
static CG Garbo; // 定义一个静态成员,在程序结束时,系统会调用它的析构函数
static QHash<QString,QVector<QString> > *ht;
};
#endif // NODETOTERMINAL_H