Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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");
......@@ -56,7 +66,9 @@ bool Fidelity::Common::VOTableData::buildXml(QDomElement* parent)
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();
};}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment