23 m_canMakeNewObjects(false)
39 m_canMakeNewObjects =
true;
47 std::string &temporaryListName,
const ObjectList &objectsToMove)
49 if (objectsToMove.empty())
50 return STATUS_CODE_NOT_INITIALIZED;
52 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->CreateTemporaryListAndSetCurrent(pAlgorithm, temporaryListName));
53 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->MoveObjectsBetweenLists(temporaryListName, originalListName, &objectsToMove));
55 return STATUS_CODE_SUCCESS;
71 return this->MoveObjectsBetweenLists(targetListName, sourceListName);
79 if (objectsToSave.empty())
80 return STATUS_CODE_NOT_INITIALIZED;
90 return this->MoveObjectsBetweenLists(targetListName, sourceListName, &objectsToSave);
100 return STATUS_CODE_NOT_ALLOWED;
105 return STATUS_CODE_NOT_FOUND;
107 if (sourceListIter->second->empty())
108 return STATUS_CODE_NOT_INITIALIZED;
113 return STATUS_CODE_FAILURE;
117 for (
const T *
const pT : *sourceListIter->second)
119 if (targetListIter->second->end() != std::find(targetListIter->second->begin(), targetListIter->second->end(), pT))
120 return STATUS_CODE_ALREADY_PRESENT;
122 targetListIter->second->push_back(pT);
125 sourceListIter->second->clear();
129 if ((sourceListIter->second == pObjectSubset) || (targetListIter->second == pObjectSubset))
130 return STATUS_CODE_INVALID_PARAMETER;
132 for (
const T *
const pT : *pObjectSubset)
134 typename ObjectList::iterator objectIter = std::find(sourceListIter->second->begin(), sourceListIter->second->end(), pT);
136 if (sourceListIter->second->end() == objectIter)
137 return STATUS_CODE_NOT_FOUND;
139 if (targetListIter->second->end() != std::find(targetListIter->second->begin(), targetListIter->second->end(), pT))
140 return STATUS_CODE_ALREADY_PRESENT;
142 targetListIter->second->push_back(pT);
143 objectIter = sourceListIter->second->erase(objectIter);
147 m_canMakeNewObjects =
false;
148 return STATUS_CODE_SUCCESS;
157 return STATUS_CODE_NOT_FOUND;
159 m_canMakeNewObjects =
false;
161 return STATUS_CODE_SUCCESS;
172 return STATUS_CODE_NOT_FOUND;
174 typename ObjectList::iterator deletionIter = std::find(listIter->second->begin(), listIter->second->end(), pT);
176 if (listIter->second->end() == deletionIter)
177 return STATUS_CODE_NOT_FOUND;
179 deletionIter = listIter->second->erase(deletionIter);
182 return STATUS_CODE_SUCCESS;
193 return STATUS_CODE_NOT_FOUND;
195 if (listIter->second == &objectList)
196 return STATUS_CODE_INVALID_PARAMETER;
198 for (
const T *
const pT : objectList)
200 typename ObjectList::iterator deletionIter = std::find(listIter->second->begin(), listIter->second->end(), pT);
202 if (listIter->second->end() == deletionIter)
203 return STATUS_CODE_NOT_FOUND;
205 deletionIter = listIter->second->erase(deletionIter);
209 return STATUS_CODE_SUCCESS;
218 return STATUS_CODE_NOT_ALLOWED;
223 return STATUS_CODE_NOT_FOUND;
225 if (algorithmIter->second.m_temporaryListNames.end() == algorithmIter->second.m_temporaryListNames.find(temporaryListName))
226 return STATUS_CODE_NOT_ALLOWED;
231 return STATUS_CODE_FAILURE;
233 for (
const T *
const pT : *listIter->second)
236 listIter->second->clear();
237 return STATUS_CODE_SUCCESS;
248 return STATUS_CODE_NOT_FOUND;
250 for (
const std::string &temporaryListName : algorithmIter->second.m_temporaryListNames)
255 return STATUS_CODE_FAILURE;
257 objectList.insert(objectList.end(), listIter->second->begin(), listIter->second->end());
260 return STATUS_CODE_SUCCESS;
268 m_canMakeNewObjects =
false;
277 m_canMakeNewObjects =
false;
286 m_canMakeNewObjects =
false;
295 if (m_canMakeNewObjects)
296 return STATUS_CODE_NOT_ALLOWED;
309 for (
const T *
const pT : objectList)
312 m_canMakeNewObjects =
false;
323 for (
const T *
const pT : *mapEntry.second)
327 m_canMakeNewObjects =
false;
Header file for the algorithm object manager class.
Header file for the cluster class.
Header file for the particle flow object class.
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Header file for the vertex class.
Algorithm class. Algorithm addresses are held only by the algorithm manager. They have a fully define...
AlgorithmObjectManager class.
virtual StatusCode ResetCurrentListToAlgorithmInputList(const Algorithm *const pAlgorithm)
Reset the current list to the algorithm input list.
virtual ~AlgorithmObjectManager()
Destructor.
AlgorithmObjectManager(const Pandora *const pPandora)
Constructor.
virtual StatusCode GetResetDeletionObjects(const Algorithm *const pAlgorithm, ObjectList &objectList) const
Get the list of objects that will be deleted when the algorithm info is reset.
virtual StatusCode EraseAllContent()
Erase all manager content.
virtual StatusCode CreateTemporaryListAndSetCurrent(const Algorithm *const pAlgorithm, std::string &temporaryListName)
Make a temporary list and set it to be the current list.
virtual StatusCode SaveObjects(const std::string &targetListName, const std::string &sourceListName)
Save a list of objects.
virtual StatusCode DropCurrentList(const Algorithm *const pAlgorithm)
Drop the current list, returning the current list to its default empty/null state.
virtual StatusCode RenameList(const std::string &oldListName, const std::string &newListName)
Rename a saved list, altering its saved name from a specified old list name to a specified new list n...
virtual StatusCode DeleteObjects(const ObjectList &objectList, const std::string &listName)
Delete a list of objects from a specified list.
virtual StatusCode DeleteObject(const T *const pT, const std::string &listName)
Delete an object from a specified list.
virtual StatusCode TemporarilyReplaceCurrentList(const std::string &listName)
Temporarily replace the current list with another list, which may only be a temporary list....
virtual StatusCode ResetAlgorithmInfo(const Algorithm *const pAlgorithm, bool isAlgorithmFinished)
Remove temporary lists and reset the current cluster list to that when algorithm was initialized.
Manager< T >::ObjectList ObjectList
virtual StatusCode MoveObjectsToTemporaryListAndSetCurrent(const Algorithm *const pAlgorithm, const std::string &originalListName, std::string &temporaryListName, const ObjectList &objectsToMove)
Move objects to a new temporary object list and set it to be the current object list.
virtual StatusCode DeleteTemporaryObjects(const Algorithm *const pAlgorithm, const std::string &temporaryListName)
Delete the contents of a temporary list.
virtual StatusCode MoveObjectsBetweenLists(const std::string &targetListName, const std::string &sourceListName, const ObjectList *pObjectSubset=nullptr)
Move (a subset of) objects between two lists.
virtual StatusCode ReplaceCurrentAndAlgorithmInputLists(const Algorithm *const pAlgorithm, const std::string &listName)
Replace the current and algorithm input lists with a pre-existing list.
virtual StatusCode ResetCurrentListToAlgorithmInputList(const Algorithm *const pAlgorithm)
Reset the current list to the algorithm input list.
virtual StatusCode RenameList(const std::string &oldListName, const std::string &newListName)
Rename a saved list, altering its saved name from a specified old list name to a specified new list n...
virtual StatusCode EraseAllContent()
Erase all manager content.
virtual StatusCode ResetAlgorithmInfo(const Algorithm *const pAlgorithm, bool isAlgorithmFinished)
Remove temporary lists and reset the current list to that when algorithm was initialized.
virtual StatusCode DropCurrentList(const Algorithm *const pAlgorithm)
Drop the current list, returning the current list to its default empty/null state.
virtual StatusCode ReplaceCurrentAndAlgorithmInputLists(const Algorithm *const pAlgorithm, const std::string &listName)
Replace the current and algorithm input lists with a pre-existing list.
virtual StatusCode CreateTemporaryListAndSetCurrent(const Algorithm *const pAlgorithm, std::string &temporaryListName)
Create a temporary list associated with a particular algorithm.
StatusCode
The StatusCode enum.