Commit d7915c40 authored by Peter Van Gemmeren's avatar Peter Van Gemmeren Committed by Graeme Stewart
Browse files

Attempt to fix memory leak when reading DataHeader Tokens (PersistentDataModelTPCnv-00-02-03)

parent 316d328e
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERSISTENTDATAMODELTPCNV_DATAHEADERCNV_P3_H
#define PERSISTENTDATAMODELTPCNV_DATAHEADERCNV_P3_H
/**
* @file DataHeaderCnv_p3.h
* @brief This file contains the class definition for the DataHeaderCnv_p3 and DataHeaderElementCnv_p3 classes.
* @author Peter van Gemmeren <gemmeren@anl.gov>
* $Id: DataHeaderCnv_p3.h,v 1.3 2009-04-21 21:48:34 gemmeren Exp $
**/
#include "PersistentDataModel/DataHeader.h"
#include "PersistentDataModelTPCnv/DataHeader_p3.h"
/** @class DataHeaderElementCnv_p3
* @brief This class provides the converter to customize the saving of DataHeaderElement_p3.
**/
class DataHeaderElementCnv_p3 {
public:
DataHeaderElementCnv_p3();
virtual ~DataHeaderElementCnv_p3();
void persToTrans(const DataHeaderElement_p3* pers, DataHeaderElement* trans, const std::vector<std::string>& map);
void transToPers(const DataHeaderElement* trans, DataHeaderElement_p3* pers, std::vector<std::string>& map);
friend class DataHeaderCnv_p3;
};
/** @class DataHeaderCnv_p3
* @brief This class provides the converter to customize the saving of DataHeader_p3.
**/
class DataHeaderCnv_p3 {
public:
DataHeaderCnv_p3();
virtual ~DataHeaderCnv_p3();
DataHeader* createTransient(const DataHeader_p3* persObj);
void persToTrans(const DataHeader_p3* pers, DataHeader* trans);
DataHeader_p3* createPersistent(const DataHeader* transObj);
void transToPers(const DataHeader* trans, DataHeader_p3* pers);
void insertDHRef(DataHeader_p3* pers, const std::string& key, const std::string& token);
private:
DataHeaderElementCnv_p3 m_elemCnv;
};
inline DataHeader* DataHeaderCnv_p3::createTransient(const DataHeader_p3* persObj) {
DataHeader* trans = new DataHeader();
persToTrans(persObj, trans);
return(trans);
}
inline DataHeader_p3* DataHeaderCnv_p3::createPersistent(const DataHeader* transObj){
DataHeader_p3* pers = new DataHeader_p3();
transToPers(transObj, pers);
return(pers);
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERSISTENTDATAMODELTPCNV_DATAHEADERCNV_P4_H
#define PERSISTENTDATAMODELTPCNV_DATAHEADERCNV_P4_H
/**
* @file DataHeaderCnv_p4.h
* @brief This file contains the class definition for the DataHeaderCnv_p4 and DataHeaderElementCnv_p4 classes.
* @author Peter van Gemmeren <gemmeren@anl.gov>
* $Id: DataHeaderCnv_p4.h,v 1.1 2009-04-21 21:48:34 gemmeren Exp $
**/
#include "PersistentDataModel/DataHeader.h"
#include "PersistentDataModelTPCnv/DataHeader_p4.h"
/** @class DataHeaderElementCnv_p4
* @brief This class provides the converter to customize the saving of DataHeaderElement_p4.
**/
class DataHeaderElementCnv_p4 {
public:
DataHeaderElementCnv_p4();
virtual ~DataHeaderElementCnv_p4();
void persToTrans(const DataHeaderElement_p4* pers, DataHeaderElement* trans, const std::vector<std::string>& map);
void transToPers(const DataHeaderElement* trans, DataHeaderElement_p4* pers, std::vector<std::string>& map);
friend class DataHeaderCnv_p4;
};
/** @class DataHeaderCnv_p4
* @brief This class provides the converter to customize the saving of DataHeader_p4.
**/
class DataHeaderCnv_p4 {
public:
DataHeaderCnv_p4();
virtual ~DataHeaderCnv_p4();
DataHeader* createTransient(const DataHeader_p4* persObj);
void persToTrans(const DataHeader_p4* pers, DataHeader* trans);
DataHeader_p4* createPersistent(const DataHeader* transObj);
void transToPers(const DataHeader* trans, DataHeader_p4* pers);
void insertDHRef(DataHeader_p4* pers, const std::string& key, const std::string& token);
private:
DataHeaderElementCnv_p4 m_elemCnv;
};
inline DataHeader* DataHeaderCnv_p4::createTransient(const DataHeader_p4* persObj) {
DataHeader* trans = new DataHeader();
persToTrans(persObj, trans);
return(trans);
}
inline DataHeader_p4* DataHeaderCnv_p4::createPersistent(const DataHeader* transObj){
DataHeader_p4* pers = new DataHeader_p4();
transToPers(transObj, pers);
return(pers);
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERSISTENTDATAMODELTPCNV_DATAHEADERCNV_P5_H
#define PERSISTENTDATAMODELTPCNV_DATAHEADERCNV_P5_H
/**
* @file DataHeaderCnv_p5.h
* @brief This file contains the class definition for the DataHeaderCnv_p5 and DataHeaderElementCnv_p5 classes.
* @author Peter van Gemmeren <gemmeren@anl.gov>
* $Id: DataHeaderCnv_p5.h,v 1.1 2009-04-21 21:48:34 gemmeren Exp $
**/
#include "PersistentDataModel/DataHeader.h"
#include "PersistentDataModelTPCnv/DataHeader_p5.h"
#include <map>
/** @class DataHeaderElementCnv_p5
* @brief This class provides the converter to customize the saving of DataHeaderElement_p5.
**/
class DataHeaderElementCnv_p5 {
public:
DataHeaderElementCnv_p5();
virtual ~DataHeaderElementCnv_p5();
void persToTrans(const DataHeaderElement_p5* pers, DataHeaderElement* trans, const DataHeaderForm_p5& form);
void transToPers(const DataHeaderElement* trans, DataHeaderElement_p5* pers, DataHeaderForm_p5& form);
friend class DataHeaderCnv_p5;
};
/** @class DataHeaderCnv_p5
* @brief This class provides the converter to customize the saving of DataHeader_p5.
**/
class DataHeaderCnv_p5 {
public:
DataHeaderCnv_p5();
virtual ~DataHeaderCnv_p5();
DataHeader* createTransient(const DataHeader_p5* persObj);
void persToTrans(const DataHeader_p5* pers, DataHeader* trans);
DataHeader_p5* createPersistent(const DataHeader* transObj);
void transToPers(const DataHeader* trans, DataHeader_p5* pers);
void insertDHRef(DataHeader_p5* pers, const std::string& key, const std::string& strToken);
private:
DataHeaderElementCnv_p5 m_elemCnv;
};
inline DataHeader* DataHeaderCnv_p5::createTransient(const DataHeader_p5* persObj) {
DataHeader* trans = new DataHeader();
persToTrans(persObj, trans);
return(trans);
}
inline DataHeader_p5* DataHeaderCnv_p5::createPersistent(const DataHeader* transObj){
DataHeader_p5* pers = new DataHeader_p5();
transToPers(transObj, pers);
return(pers);
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERSISTENTDATAMODELTPCNV_DATAHEADERCNV_P6_H
#define PERSISTENTDATAMODELTPCNV_DATAHEADERCNV_P6_H
/**
* @file DataHeaderCnv_p6.h
* @brief This file contains the class definition for the DataHeaderCnv_p6 and DataHeaderElementCnv_p6 classes.
* @author Peter van Gemmeren <gemmeren@anl.gov>
* $Id: DataHeaderCnv_p6.h,v 1.1 2009-04-21 21:48:34 gemmeren Exp $
**/
#include "PersistentDataModel/DataHeader.h"
#include "PersistentDataModelTPCnv/DataHeader_p6.h"
#include <map>
/** @class DataHeaderElementCnv_p6
* @brief This class provides the converter to customize the saving of DataHeaderElement_p6.
**/
class DataHeaderElementCnv_p6 {
public:
DataHeaderElementCnv_p6();
virtual ~DataHeaderElementCnv_p6();
void persToTrans(const DataHeaderElement_p6* pers, DataHeaderElement* trans, const DataHeaderForm_p6& form);
void transToPers(const DataHeaderElement* trans, DataHeaderElement_p6* pers, DataHeaderForm_p6& form);
friend class DataHeaderCnv_p6;
};
/** @class DataHeaderCnv_p6
* @brief This class provides the converter to customize the saving of DataHeader_p6.
**/
class DataHeaderCnv_p6 {
public:
DataHeaderCnv_p6();
virtual ~DataHeaderCnv_p6();
DataHeader* createTransient(const DataHeader_p6* persObj);
void persToTrans(const DataHeader_p6* pers, DataHeader* trans);
DataHeader_p6* createPersistent(const DataHeader* transObj);
void transToPers(const DataHeader* trans, DataHeader_p6* pers);
void insertDHRef(DataHeader_p6* pers, const std::string& key, const std::string& strToken);
private:
DataHeaderElementCnv_p6 m_elemCnv;
};
inline DataHeader* DataHeaderCnv_p6::createTransient(const DataHeader_p6* persObj) {
DataHeader* trans = new DataHeader();
persToTrans(persObj, trans);
return(trans);
}
inline DataHeader_p6* DataHeaderCnv_p6::createPersistent(const DataHeader* transObj){
DataHeader_p6* pers = new DataHeader_p6();
transToPers(transObj, pers);
return(pers);
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERSISTENTDATAMODELTPCNV_DATAHEADER_P3_H
#define PERSISTENTDATAMODELTPCNV_DATAHEADER_P3_H
/** @file DataHeader_p3.h
* @brief This file contains the class definition for the DataHeader_p3 and DataHeaderElement_p3 classes.
* @author Peter van Gemmeren <gemmeren@anl.gov>
* $Id: DataHeader_p3.h,v 1.4 2009-04-08 19:13:19 gemmeren Exp $
**/
#include <vector>
#include <string>
#include <stdint.h>
/** @class DataHeaderElement_p3
* @brief This class provides a persistent representation for the DataHeaderElement class.
**/
class DataHeaderElement_p3 {
public: // Constructor and Destructor
DataHeaderElement_p3();
DataHeaderElement_p3(const DataHeaderElement_p3& rhs);
virtual ~DataHeaderElement_p3();
DataHeaderElement_p3& operator=(const DataHeaderElement_p3& rhs);
friend class DataHeaderCnv_p3;
friend class DataHeaderElementCnv_p3;
const std::string& key() const;
unsigned int pClid() const;
const std::vector<unsigned int>& clids() const;
const std::string& token() const;
const std::vector<std::string> alias() const;
unsigned int oid1() const;
unsigned int oid2() const;
void overwriteOid2(unsigned int oid2);
private:
std::vector<unsigned int> m_clids;
std::string m_token;
std::vector<std::string> m_alias;
unsigned int m_technology, m_oid1, m_oid2;
unsigned short m_dbGuidIdx, m_classIdIdx, m_prefixIdx;
unsigned short m_keyPos;
std::vector<uint64_t> m_hashes;
};
/** @class DataHeader_p3
* @brief This class provides a persistent representation for the DataHeader class.
**/
class DataHeader_p3 {
public: // Constructor and Destructor
DataHeader_p3();
DataHeader_p3(const DataHeader_p3& rhs);
virtual ~DataHeader_p3();
DataHeader_p3& operator=(const DataHeader_p3& rhs);
friend class DataHeaderCnv_p3;
const std::vector<DataHeaderElement_p3>& elements() const;
const std::vector<DataHeaderElement_p3>& inputElements() const;
const std::vector<std::string>& GuidMap() const;
private:
std::vector<DataHeaderElement_p3> m_DataHeader;
std::vector<DataHeaderElement_p3> m_InputDataHeader;
std::vector<std::string> m_GuidMap;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERSISTENTDATAMODELTPCNV_DATAHEADER_P4_H
#define PERSISTENTDATAMODELTPCNV_DATAHEADER_P4_H
/** @file DataHeader_p4.h
* @brief This file contains the class definition for the DataHeader_p4 and DataHeaderElement_p4 classes.
* @author Peter van Gemmeren <gemmeren@anl.gov>
* $Id: DataHeader_p4.h,v 1.1 2009-04-21 21:48:34 gemmeren Exp $
**/
#include <vector>
#include <string>
#include <stdint.h>
/** @class DataHeaderElement_p4
* @brief This class provides a persistent representation for the DataHeaderElement class.
**/
class DataHeaderElement_p4 {
public: // Constructor and Destructor
DataHeaderElement_p4();
DataHeaderElement_p4(const DataHeaderElement_p4& rhs);
virtual ~DataHeaderElement_p4();
DataHeaderElement_p4& operator=(const DataHeaderElement_p4& rhs);
friend class DataHeaderCnv_p4;
friend class DataHeaderElementCnv_p4;
unsigned int pClid() const;
const std::vector<unsigned int>& clids() const;
const std::string& key() const;
const std::vector<std::string>& alias() const;
const std::string& token() const;
unsigned int oid1() const;
unsigned int oid2() const;
void overwriteOid2(unsigned int oid2);
private:
std::vector<unsigned int> m_clids;
std::string m_token;
std::vector<std::string> m_alias;
unsigned int m_technology, m_oid1, m_oid2;
unsigned short m_dbGuidIdx, m_classIdIdx, m_prefixIdx;
unsigned short m_keyPos;
std::vector<uint64_t> m_hashes;
};
/** @class DataHeader_p4
* @brief This class provides a persistent representation for the DataHeader class.
**/
class DataHeader_p4 {
public: // Constructor and Destructor
DataHeader_p4();
DataHeader_p4(const DataHeader_p4& rhs);
virtual ~DataHeader_p4();
DataHeader_p4& operator=(const DataHeader_p4& rhs);
friend class DataHeaderCnv_p4;
const std::vector<DataHeaderElement_p4>& elements() const;
unsigned int provenanceSize() const;
const std::vector<std::string>& guidMap() const;
private:
std::vector<DataHeaderElement_p4> m_dataHeader;
unsigned int m_provSize;
std::vector<std::string> m_guidMap;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERSISTENTDATAMODELTPCNV_DATAHEADER_P5_H
#define PERSISTENTDATAMODELTPCNV_DATAHEADER_P5_H
/** @file DataHeader_p5.h
* @brief This file contains the class definition for the DataHeader_p5,
* DataHeaderForm_p5 and DataHeaderElement_p5 classes.
* @author Peter van Gemmeren <gemmeren@anl.gov>
* $Id: DataHeader_p5.h,v 1.1 2009-04-21 21:48:34 gemmeren Exp $
**/
#include <vector>
#include <string>
/** @class DataHeaderElement_p5
* @brief This class provides a persistent representation for the DataHeaderElement class.
**/
class DataHeaderElement_p5 {
public: // Constructor and Destructor
DataHeaderElement_p5();
DataHeaderElement_p5(const DataHeaderElement_p5& rhs);
virtual ~DataHeaderElement_p5();
DataHeaderElement_p5& operator=(const DataHeaderElement_p5& rhs);
friend class DataHeaderCnv_p5;
friend class DataHeaderElementCnv_p5;
const std::string& token() const;
unsigned int oid2() const;
void overwriteOid2(unsigned int oid2);
private:
std::string m_token;
unsigned int m_oid2;
};
/** @class DataHeaderForm_p5
* @brief This class provides storage for the constant fields of the persistent DataHeader class.
**/
class DataHeaderForm_p5 {
public: // Constructor and Destructor
DataHeaderForm_p5();
DataHeaderForm_p5(const DataHeaderForm_p5& rhs);
virtual ~DataHeaderForm_p5();
DataHeaderForm_p5& operator=(const DataHeaderForm_p5& rhs);
friend class DataHeaderCnv_p5;
const std::vector<std::string>& map() const;
void insertMap(const std::string& element);
const std::vector<unsigned int>& params() const;
void insertParam(unsigned int param);
unsigned int entry() const;
void start() const;
void next() const;
unsigned int size();
void resize(unsigned int size);
private:
std::vector<std::string> m_map;
std::vector<std::vector<unsigned int> > m_uints;
mutable unsigned int m_entry;
};
/** @class DataHeader_p5
* @brief This class provides a persistent representation for the DataHeader class.
**/
class DataHeader_p5 {
public: // Constructor and Destructor
DataHeader_p5();
DataHeader_p5(const DataHeader_p5& rhs);
virtual ~DataHeader_p5();
DataHeader_p5& operator=(const DataHeader_p5& rhs);
friend class DataHeaderCnv_p5;
const std::vector<DataHeaderElement_p5>& elements() const;
const DataHeaderForm_p5& dhForm() const;
void setDhForm(const DataHeaderForm_p5& form);
const std::string& dhFormToken() const;
void setDhFormToken(const std::string& formToken);
const std::string& dhFormMdx() const;
private:
std::vector<DataHeaderElement_p5> m_dataHeader;
DataHeaderForm_p5 m_dhForm;
std::string m_dhFormToken;
std::string m_dhFormMdx;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERSISTENTDATAMODELTPCNV_DATAHEADER_P6_H
#define PERSISTENTDATAMODELTPCNV_DATAHEADER_P6_H
/** @file DataHeader_p6.h
* @brief This file contains the class definition for the DataHeader_p6,
* DataHeaderForm_p6 and DataHeaderElement_p6 classes.
* @author Peter van Gemmeren <gemmeren@anl.gov>
* $Id: DataHeader_p6.h,v 1.1 2009-04-21 21:48:34 gemmeren Exp $
**/
#include "PersistentDataModel/Guid.h"
#include <vector>
#include <set>
#include <string>
/** @class DataHeaderElement_p6
* @brief This class provides a persistent representation for the DataHeaderElement class.
**/
class DataHeaderElement_p6 {
public: // Constructor and Destructor
DataHeaderElement_p6();
DataHeaderElement_p6(const DataHeaderElement_p6& rhs);
virtual ~DataHeaderElement_p6();
DataHeaderElement_p6& operator=(const DataHeaderElement_p6& rhs);
friend class DataHeaderCnv_p6;
friend class DataHeaderElementCnv_p6;
const std::string& token() const;
unsigned long long oid1() const;
unsigned long long oid2() const;
void overwriteOid2(unsigned long long oid2);
private:
std::string m_token;
unsigned long long m_oid1;
unsigned long long m_oid2;
unsigned int m_dbIdx; // entry with GUID & technology
unsigned int m_objIdx; // Will get entry with ClassId and transient CLID/key, direct clid for now...
};
/** @class DataHeaderForm_p6
* @brief This class provides storage for the constant fields of the persistent DataHeader class.
**/
class DataHeaderForm_p6 {
public:
typedef std::pair<Guid, unsigned int> DbRecord;
typedef std::pair<std::string, unsigned int> SgRecord;
typedef std::pair<Guid, SgRecord> ObjRecord;
public: // Constructor and Destructor
DataHeaderForm_p6();
DataHeaderForm_p6(const DataHeaderForm_p6& rhs);
virtual ~DataHeaderForm_p6();
DataHeaderForm_p6& operator=(const DataHeaderForm_p6& rhs);
friend class DataHeaderCnv_p6;
unsigned int insertDb(const DbRecord& rec);
std::size_t sizeDb() const;
Guid getDbGuid(unsigned int index) const;
unsigned int getDbTech(unsigned int index) const;
unsigned int insertObj(const ObjRecord& rec,
const std::set<std::string>& alias = std::set<std::string>(),
const std::set<unsigned int>& symLinks = std::set<unsigned int>(),