18 m_nullListName(
"NullList"),
20 m_currentListName(m_nullListName)
36 typename NameToListMap::const_iterator iter = m_nameToListMap.find(listName);
38 if (m_nameToListMap.end() == iter)
39 return STATUS_CODE_NOT_INITIALIZED;
41 pObjectList = iter->second;
42 return STATUS_CODE_SUCCESS;
50 listName = m_currentListName;
51 return this->GetList(listName, pObjectList);
59 if (m_currentListName.empty())
60 return STATUS_CODE_NOT_INITIALIZED;
62 listName = m_currentListName;
63 return STATUS_CODE_SUCCESS;
71 typename AlgorithmInfoMap::const_iterator iter = m_algorithmInfoMap.find(pAlgorithm);
73 if (m_algorithmInfoMap.end() != iter)
75 listName = iter->second.m_parentListName;
79 listName = m_currentListName;
82 return this->GetList(listName, pObjectList);
90 typename AlgorithmInfoMap::const_iterator iter = m_algorithmInfoMap.find(pAlgorithm);
92 if (m_algorithmInfoMap.end() == iter)
93 return this->GetCurrentListName(listName);
95 listName = iter->second.m_parentListName;
96 return STATUS_CODE_SUCCESS;
104 return this->GetAlgorithmInputListName(pAlgorithm, m_currentListName);
112 if (m_nameToListMap.end() == m_nameToListMap.find(listName))
113 return STATUS_CODE_NOT_FOUND;
115 if (m_savedLists.end() == m_savedLists.find(listName))
116 return STATUS_CODE_NOT_ALLOWED;
118 if (m_algorithmInfoMap.end() == m_algorithmInfoMap.find(pAlgorithm))
119 return STATUS_CODE_FAILURE;
121 m_currentListName = listName;
123 for (
typename AlgorithmInfoMap::value_type &mapEntry : m_algorithmInfoMap)
125 mapEntry.second.m_parentListName = listName;
128 return STATUS_CODE_SUCCESS;
136 return this->ReplaceCurrentAndAlgorithmInputLists(pAlgorithm, m_nullListName);
144 if ((oldListName == newListName) || newListName.empty())
145 return STATUS_CODE_INVALID_PARAMETER;
147 if (m_nameToListMap.end() == m_nameToListMap.find(oldListName))
148 return STATUS_CODE_NOT_FOUND;
150 if ((oldListName == m_nullListName) || (m_savedLists.end() == m_savedLists.find(oldListName)))
151 return STATUS_CODE_NOT_ALLOWED;
153 if (m_savedLists.end() != m_savedLists.find(newListName))
154 return STATUS_CODE_ALREADY_PRESENT;
156 m_nameToListMap[newListName] = m_nameToListMap.at(oldListName);
157 m_nameToListMap.erase(oldListName);
159 m_savedLists.insert(newListName);
160 m_savedLists.erase(oldListName);
162 if (oldListName == m_currentListName)
163 m_currentListName = newListName;
165 for (
typename AlgorithmInfoMap::value_type &mapEntry : m_algorithmInfoMap)
167 if (oldListName == mapEntry.second.m_parentListName)
168 mapEntry.second.m_parentListName = newListName;
171 return STATUS_CODE_SUCCESS;
179 typename AlgorithmInfoMap::iterator iter = m_algorithmInfoMap.find(pAlgorithm);
181 if (m_algorithmInfoMap.end() == iter)
182 return STATUS_CODE_NOT_FOUND;
186 if (!iter->second.m_temporaryListNames.insert(temporaryListName).second)
187 return STATUS_CODE_ALREADY_PRESENT;
189 m_nameToListMap[temporaryListName] =
new ObjectList;
190 m_currentListName = temporaryListName;
192 return STATUS_CODE_SUCCESS;
200 if (m_algorithmInfoMap.end() != m_algorithmInfoMap.find(pAlgorithm))
201 return STATUS_CODE_ALREADY_PRESENT;
207 if (!m_algorithmInfoMap.insert(
typename AlgorithmInfoMap::value_type(pAlgorithm, algorithmInfo)).second)
208 return STATUS_CODE_ALREADY_PRESENT;
210 return STATUS_CODE_SUCCESS;
218 typename AlgorithmInfoMap::iterator algorithmIter = m_algorithmInfoMap.find(pAlgorithm);
220 if (m_algorithmInfoMap.end() == algorithmIter)
221 return STATUS_CODE_NOT_FOUND;
223 for (
const std::string &temporaryListName : algorithmIter->second.m_temporaryListNames)
225 typename NameToListMap::iterator iter = m_nameToListMap.find(temporaryListName);
227 if (m_nameToListMap.end() == iter)
228 return STATUS_CODE_FAILURE;
231 iter = m_nameToListMap.erase(iter);
235 algorithmIter->second.m_temporaryListNames.clear();
236 m_currentListName = algorithmIter->second.m_parentListName;
238 if (isAlgorithmFinished)
239 algorithmIter = m_algorithmInfoMap.erase(algorithmIter);
241 return STATUS_CODE_SUCCESS;
252 return STATUS_CODE_SUCCESS;
260 for (
const typename NameToListMap::value_type &mapEntry : m_nameToListMap)
261 delete mapEntry.second;
263 m_currentListName = m_nullListName;
264 m_nameToListMap.clear();
265 m_savedLists.clear();
266 m_algorithmInfoMap.clear();
268 return STATUS_CODE_SUCCESS;
276 if (!m_nameToListMap.empty() || !m_savedLists.empty())
277 return STATUS_CODE_NOT_ALLOWED;
279 m_nameToListMap[m_nullListName] =
new ObjectList;
280 m_savedLists.insert(m_nullListName);
282 return STATUS_CODE_SUCCESS;
291 return const_cast<T*
>(pT);
Header file for the algorithm class.
Header file for the manager class.
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Algorithm class. Algorithm addresses are held only by the algorithm manager. They have a fully define...
unsigned int m_numberOfListsCreated
The number of lists created by the algorithm.
virtual StatusCode ResetCurrentListToAlgorithmInputList(const Algorithm *const pAlgorithm)
Reset the current list to the algorithm input list.
virtual T * Modifiable(const T *const pT) const
Access a modifiable object, when provided with address to const object.
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...
MANAGED_CONTAINER< const T * > ObjectList
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 ~Manager()
Destructor.
std::string m_parentListName
The current list 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 GetCurrentList(const ObjectList *&pObjectList, std::string &listName) const
Get the current list.
virtual StatusCode GetCurrentListName(std::string &listName) const
Get the current list name.
virtual StatusCode GetAlgorithmInputListName(const Algorithm *const pAlgorithm, std::string &listName) const
Get the algorithm track list name.
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 RegisterAlgorithm(const Algorithm *const pAlgorithm)
Register an algorithm with the manager.
virtual StatusCode CreateTemporaryListAndSetCurrent(const Algorithm *const pAlgorithm, std::string &temporaryListName)
Create a temporary list associated with a particular algorithm.
virtual StatusCode ResetForNextEvent()
Reset the manager.
Manager(const Pandora *const pPandora)
Constructor.
virtual StatusCode GetList(const std::string &listName, const ObjectList *&pObjectList) const
Get a list.
virtual StatusCode GetAlgorithmInputList(const Algorithm *const pAlgorithm, const ObjectList *&pObjectList, std::string &listName) const
Get the algorithm input list.
virtual StatusCode CreateInitialLists()
Create initial lists.
const std::string & GetInstanceName() const
Get the instance name.
std::string TypeToString(const T &t)
StatusCode
The StatusCode enum.