Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:15:18

0001 /**
0002  *  @file   PandoraSDK/include/Managers/AlgorithmObjectManager.h
0003  * 
0004  *  @brief  Header file for the algorithm object manager class.
0005  * 
0006  *  $Log: $
0007  */
0008 #ifndef PANDORA_ALGORITHM_OBJECT_MANAGER
0009 #define PANDORA_ALGORITHM_OBJECT_MANAGER 1
0010 
0011 #include "Managers/Manager.h"
0012 
0013 namespace pandora
0014 {
0015 
0016 /**
0017  *  @brief  AlgorithmObjectManager class
0018  */
0019 template<typename T>
0020 class AlgorithmObjectManager : public Manager<T>
0021 {
0022 public:
0023     /**
0024      *  @brief  Constructor
0025      * 
0026      *  @param  pPandora address of the associated pandora object
0027      */
0028      AlgorithmObjectManager(const Pandora *const pPandora);
0029 
0030     /**
0031      *  @brief  Destructor
0032      */
0033     virtual ~AlgorithmObjectManager();
0034 
0035 protected:
0036     typedef typename Manager<T>::ObjectList ObjectList;
0037 
0038     /**
0039      *  @brief  Make a temporary list and set it to be the current list
0040      * 
0041      *  @param  pAlgorithm address of the algorithm requesting a temporary list
0042      *  @param  temporaryListName to receive the name of the temporary list
0043      */
0044     virtual StatusCode CreateTemporaryListAndSetCurrent(const Algorithm *const pAlgorithm, std::string &temporaryListName);
0045 
0046     /**
0047      *  @brief  Move objects to a new temporary object list and set it to be the current object list
0048      * 
0049      *  @param  pAlgorithm address of the algorithm requesting a temporary list
0050      *  @param  originalListName the list in which the object currently exist
0051      *  @param  temporaryListName to receive the name of the temporary list
0052      *  @param  objectsToMove only objects in both this and the current list will be moved
0053      *          - other object in the current list will remain in original list
0054      *          - an empty object list will be rejected
0055      */
0056     virtual StatusCode MoveObjectsToTemporaryListAndSetCurrent(const Algorithm *const pAlgorithm, const std::string &originalListName,
0057         std::string &temporaryListName, const ObjectList &objectsToMove);
0058 
0059     /**
0060      *  @brief  Save a list of objects
0061      * 
0062      *  @param  targetListName the name of the target object list, which will be created if it doesn't currently exist
0063      *  @param  sourceListName the name of the (typically temporary) object list to save
0064      */
0065     virtual StatusCode SaveObjects(const std::string &targetListName, const std::string &sourceListName);
0066 
0067     /**
0068      *  @brief  Save a list of objects
0069      * 
0070      *  @param  targetListName the name of the target object list, which will be created if it doesn't currently exist
0071      *  @param  sourceListName the name of the (typically temporary) object list containing objects to save
0072      *  @param  objectToSave only objects in both this and the temporary list will be stored
0073      *          - other object will remain in the temporary list and will be deleted when the parent algorithm exits
0074      *          - an empty object list will be rejected
0075      */
0076     virtual StatusCode SaveObjects(const std::string &targetListName, const std::string &sourceListName, const ObjectList &objectsToSave);
0077 
0078     /**
0079      *  @brief  Move (a subset of) objects between two lists
0080      * 
0081      *  @param  targetListName the name of the target object list, which will be created if it doesn't currently exist
0082      *  @param  sourceListName the name of the object list containing objects to save
0083      *  @param  pObjectSubset if specified, only objects in both this and the source list will be moved
0084      */
0085     virtual StatusCode MoveObjectsBetweenLists(const std::string &targetListName, const std::string &sourceListName,
0086         const ObjectList *pObjectSubset = nullptr);
0087 
0088     /**
0089      *  @brief  Temporarily replace the current list with another list, which may only be a temporary list.
0090      *          This switch will persist only for the duration of the algorithm and its daughters; unless otherwise
0091      *          specified, the list will revert to the algorithm input list upon algorithm completion.
0092      * 
0093      *  @param  listName the name of the new current (and algorithm input) list
0094      */
0095     virtual StatusCode TemporarilyReplaceCurrentList(const std::string &listName);
0096 
0097     /**
0098      *  @brief  Delete an object from a specified list
0099      * 
0100      *  @param  pCluster address of the object to delete
0101      *  @param  listName the name of the list containing the object
0102      */
0103     virtual StatusCode DeleteObject(const T *const pT, const std::string &listName);
0104 
0105     /**
0106      *  @brief  Delete a list of objects from a specified list
0107      * 
0108      *  @param  objectList the list of objects to delete
0109      *  @param  listName the name of the list containing the objects
0110      */
0111     virtual StatusCode DeleteObjects(const ObjectList &objectList, const std::string &listName);
0112 
0113     /**
0114      *  @brief  Delete the contents of a temporary list
0115      * 
0116      *  @param  pAlgorithm address of the algorithm calling this function
0117      *  @param  temporaryListName the name of the temporary list
0118      */
0119     virtual StatusCode DeleteTemporaryObjects(const Algorithm *const pAlgorithm, const std::string &temporaryListName);
0120 
0121     /**
0122      *  @brief  Get the list of objects that will be deleted when the algorithm info is reset
0123      * 
0124      *  @param  pAlgorithm address of the algorithm
0125      *  @param  objectList to receive the list of objects that will be deleted when the algorithm info is reset
0126      */
0127     virtual StatusCode GetResetDeletionObjects(const Algorithm *const pAlgorithm, ObjectList &objectList) const;
0128 
0129     /**
0130      *  @brief  Reset the current list to the algorithm input list
0131      *
0132      *  @param  pAlgorithm address of the algorithm changing the current track list
0133      */
0134     virtual StatusCode ResetCurrentListToAlgorithmInputList(const Algorithm *const pAlgorithm);
0135 
0136     /**
0137      *  @brief  Replace the current and algorithm input lists with a pre-existing list
0138      *
0139      *  @param  pAlgorithm address of the algorithm changing the current list
0140      *  @param  listName the name of the new current (and algorithm input) list
0141      */
0142     virtual StatusCode ReplaceCurrentAndAlgorithmInputLists(const Algorithm *const pAlgorithm, const std::string &listName);
0143 
0144     /**
0145      *  @brief  Drop the current list, returning the current list to its default empty/null state
0146      * 
0147      *  @param  pAlgorithm address of the algorithm altering the lists
0148      */
0149     virtual StatusCode DropCurrentList(const Algorithm *const pAlgorithm);
0150 
0151     /**
0152      *  @brief  Rename a saved list, altering its saved name from a specified old list name to a specified new list name
0153      * 
0154      *  @param  oldListName the old list name
0155      *  @param  newListName the new list name
0156      */
0157     virtual StatusCode RenameList(const std::string &oldListName, const std::string &newListName);
0158 
0159     /**
0160      *  @brief  Remove temporary lists and reset the current cluster list to that when algorithm was initialized
0161      * 
0162      *  @param  pAlgorithm the algorithm associated with the temporary objects
0163      *  @param  isAlgorithmFinished whether the algorithm has completely finished and the algorithm info should be entirely removed
0164      */
0165     virtual StatusCode ResetAlgorithmInfo(const Algorithm *const pAlgorithm, bool isAlgorithmFinished);
0166 
0167     /**
0168      *  @brief  Erase all manager content
0169      */
0170     virtual StatusCode EraseAllContent();
0171 
0172     bool        m_canMakeNewObjects;            ///< Whether the manager is allowed to make new objects when requested by algorithms
0173 };
0174 
0175 } // namespace pandora
0176 
0177 #endif // #ifndef PANDORA_ALGORITHM_OBJECT_MANAGER