9 #include "Pandora/Pandora.h" 10 #include "Pandora/StatusCodes.h" 24 instanceList.push_back(pPrimaryPandora);
26 for (
const pandora::Pandora *
const pPandora : instanceList)
33 catch (
const pandora::StatusCodeException &) {}
36 throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
46 throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
58 throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
70 throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
80 throw pandora::StatusCodeException(pandora::STATUS_CODE_ALREADY_PRESENT);
83 throw pandora::StatusCodeException(pandora::STATUS_CODE_FAILURE);
99 for (
const auto &mapElement : pandoraInstanceMap)
108 throw pandora::StatusCodeException(pandora::STATUS_CODE_ALREADY_PRESENT);
118 throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
120 iter->second.push_back(pDaughterPandora);
122 if (!
m_daughterToPrimaryMap.insert(PandoraRelationMap::value_type(pDaughterPandora, pPrimaryPandora)).second)
123 throw pandora::StatusCodeException(pandora::STATUS_CODE_FAILURE);
136 catch (
const pandora::StatusCodeException &)
138 std::cout <<
"MultiPandoraApiImpl::DeletePandoraInstances - unable to find daughter instances associated with primary " << pPrimaryPandora << std::endl;
141 pandoraInstanceList.push_back(pPrimaryPandora);
144 for (
const pandora::Pandora *
const pPandora : pandoraInstanceList)
PandoraToVolumeIdMap m_pandoraToVolumeIdMap
The map from pandora instance to volume id.
~MultiPandoraApiImpl()
Destructor;.
void AddDaughterPandoraInstance(const pandora::Pandora *const pPrimaryPandora, const pandora::Pandora *const pDaughterPandora)
Add a pandora daughter instance, associated to a primary pandora instance.
void DeletePandoraInstances(const pandora::Pandora *const pPrimaryPandora)
Delete all pandora instances associated with (and including) a specified primary pandora instance...
void AddPrimaryPandoraInstance(const pandora::Pandora *const pPrimaryPandora)
Declare a new primary pandora instance.
const pandora::Pandora * GetPrimaryPandoraInstance(const pandora::Pandora *const pDaughterPandora) const
Get the address of the primary pandora instance associated with a given daughter pandora instance...
std::vector< const pandora::Pandora * > PandoraInstanceList
Header file for the MultiPandoraApiImpl class.
std::unordered_map< const pandora::Pandora *, PandoraInstanceList > PandoraInstanceMap
void SetVolumeId(const pandora::Pandora *const pPandora, const unsigned int volumeId)
Set the volume id associated with a given pandora instance.
PandoraRelationMap m_daughterToPrimaryMap
The map from daughter pandora instance to primary pandora instance.
const PandoraInstanceMap & GetPandoraInstanceMap() const
Get the pandora instance map.
MultiPandoraApiImpl()
Default constructor;.
const PandoraInstanceList & GetDaughterPandoraInstanceList(const pandora::Pandora *const pPrimaryPandora) const
Get the list of daughter pandora instances associated with a given primary pandora instance...
PandoraInstanceMap m_primaryToDaughtersMap
The map from primary pandora instance to list of daughter pandora instances.
unsigned int GetVolumeId(const pandora::Pandora *const pPandora) const
Get the volume id associated with a given pandora instance.
const pandora::Pandora * GetPandoraInstance(const pandora::Pandora *const pPrimaryPandora, const unsigned int volumeId) const
Get the address of the pandora instance associated with a given primary pandora instance and volume i...