Commit a71b719e authored by Oliver Bock's avatar Oliver Bock
Browse files

- Improved memory management (QPointer, delete list entries on destruction)

- Use namespaces properly

git-svn-id: https://svn.origo.ethz.ch/fidelity@18 53d1999f-d1a8-4366-aa61-588fded17473
parent a29d9aac
......@@ -20,23 +20,33 @@
#include "VOTableData.h"
Fidelity::Common::VOTableData::VOTableData()
namespace Fidelity {
namespace Common {
VOTableData::VOTableData()
{
initAttributes();
}
Fidelity::Common::VOTableData::~VOTableData()
VOTableData::~VOTableData()
{
// iterate over vector and delete all referenced entries
while (!m_TRList->isEmpty()) {
QPointer<VOTR>* entry = m_TRList->begin();
if(*entry) {delete *entry;}
m_TRList->erase(entry);
}
delete m_TRList;
}
void Fidelity::Common::VOTableData::initAttributes()
void VOTableData::initAttributes()
{
m_TRList = new QVector<VOTR*>;
m_TRList = new QVector<QPointer<VOTR> >;
}
bool Fidelity::Common::VOTableData::buildXml(QDomElement* parent)
bool VOTableData::buildXml(QDomElement* parent)
{
parent->setTagName("TABLEDATA");
......@@ -52,11 +62,13 @@ bool Fidelity::Common::VOTableData::buildXml(QDomElement* parent)
parent->appendChild(tag);
}
}
return(true);
}
QVector<VOTR*>* Fidelity::Common::VOTableData::TRList()
QVector<QPointer<VOTR> >* VOTableData::TRList()
{
return m_TRList;
}
}}
......@@ -67,10 +67,10 @@ public:
* Get the value of m_TRList
* @return the value of m_TRList
*/
QVector<VOTR*>* TRList();
QVector<QPointer<VOTR> >* TRList();
private:
QVector<VOTR*>* m_TRList;
QVector<QPointer<VOTR> >* m_TRList;
void initAttributes();
};}}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment