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/Manager.h
0003  * 
0004  *  @brief  Header file for the manager class.
0005  * 
0006  *  $Log: $
0007  */
0008 #ifndef PANDORA_MANAGER_H
0009 #define PANDORA_MANAGER_H 1
0010 
0011 #include "Pandora/PandoraInternal.h"
0012 #include "Pandora/StatusCodes.h"
0013 
0014 namespace pandora
0015 {
0016 
0017 class Algorithm;
0018 class Pandora;
0019 
0020 //------------------------------------------------------------------------------------------------------------------------------------------
0021 
0022 /**
0023  *  @brief  Manager class
0024  */
0025 template<typename T>
0026 class Manager
0027 {
0028 public:
0029     /**
0030      *  @brief  Constructor
0031      * 
0032      *  @param  pPandora address of the associated pandora object
0033      */
0034     Manager(const Pandora *const pPandora);
0035 
0036     /**
0037      *  @brief  Destructor
0038      */
0039     virtual ~Manager();
0040 
0041 protected:
0042     typedef MANAGED_CONTAINER<const T *> ObjectList;
0043 
0044     /**
0045      *  @brief  Get a list
0046      * 
0047      *  @param  listName the name of the list
0048      *  @param  pObjectList to receive the list
0049      */
0050     virtual StatusCode GetList(const std::string &listName, const ObjectList *&pObjectList) const;
0051 
0052     /**
0053      *  @brief  Get the current list
0054      * 
0055      *  @param  pObjectList to receive the current list
0056      *  @param  listName to receive the name of the current list
0057      */
0058     virtual StatusCode GetCurrentList(const ObjectList *&pObjectList, std::string &listName) const;
0059 
0060     /**
0061      *  @brief  Get the current list name
0062      * 
0063      *  @param  listName to receive the current list name
0064      */
0065     virtual StatusCode GetCurrentListName(std::string &listName) const;
0066 
0067     /**
0068      *  @brief  Get the algorithm input list
0069      * 
0070      *  @param  pAlgorithm address of the algorithm
0071      *  @param  pObjectList to receive the algorithm input list
0072      *  @param  listName to receive the name of the algorithm input list
0073      */
0074     virtual StatusCode GetAlgorithmInputList(const Algorithm *const pAlgorithm, const ObjectList *&pObjectList, std::string &listName) const;
0075 
0076     /**
0077      *  @brief  Get the algorithm track list name
0078      * 
0079      *  @param  pAlgorithm address of the algorithm
0080      *  @param  listName to receive the algorithm input list name
0081      */
0082     virtual StatusCode GetAlgorithmInputListName(const Algorithm *const pAlgorithm, std::string &listName) const;
0083 
0084     /**
0085      *  @brief  Reset the current list to the algorithm input list
0086      *
0087      *  @param  pAlgorithm address of the algorithm changing the current track list
0088      */
0089     virtual StatusCode ResetCurrentListToAlgorithmInputList(const Algorithm *const pAlgorithm);
0090 
0091     /**
0092      *  @brief  Replace the current and algorithm input lists with a pre-existing list
0093      *
0094      *  @param  pAlgorithm address of the algorithm changing the current list
0095      *  @param  listName the name of the new current (and algorithm input) list
0096      */
0097     virtual StatusCode ReplaceCurrentAndAlgorithmInputLists(const Algorithm *const pAlgorithm, const std::string &listName);
0098 
0099     /**
0100      *  @brief  Drop the current list, returning the current list to its default empty/null state
0101      * 
0102      *  @param  pAlgorithm address of the algorithm altering the lists
0103      */
0104     virtual StatusCode DropCurrentList(const Algorithm *const pAlgorithm);
0105 
0106     /**
0107      *  @brief  Rename a saved list, altering its saved name from a specified old list name to a specified new list name
0108      * 
0109      *  @param  oldListName the old list name
0110      *  @param  newListName the new list name
0111      */
0112     virtual StatusCode RenameList(const std::string &oldListName, const std::string &newListName);
0113 
0114     /**
0115      *  @brief  Create a temporary list associated with a particular algorithm
0116      *
0117      *  @param  pAlgorithm address of the algorithm
0118      *  @param  temporaryListName to receive the name of the temporary list
0119      */
0120     virtual StatusCode CreateTemporaryListAndSetCurrent(const Algorithm *const pAlgorithm, std::string &temporaryListName);
0121 
0122     /**
0123      *  @brief  Register an algorithm with the manager
0124      * 
0125      *  @param  pAlgorithm address of the algorithm
0126      */
0127     virtual StatusCode RegisterAlgorithm(const Algorithm *const pAlgorithm);
0128 
0129     /**
0130      *  @brief  Remove temporary lists and reset the current list to that when algorithm was initialized
0131      * 
0132      *  @param  pAlgorithm address of the algorithm altering the lists
0133      *  @param  isAlgorithmFinished whether the algorithm has completely finished and the algorithm info should be entirely removed
0134      */
0135     virtual StatusCode ResetAlgorithmInfo(const Algorithm *const pAlgorithm, bool isAlgorithmFinished);
0136 
0137     /**
0138      *  @brief  Reset the manager
0139      */
0140     virtual StatusCode ResetForNextEvent();
0141 
0142     /**
0143      *  @brief  Erase all manager content
0144      */
0145     virtual StatusCode EraseAllContent();
0146 
0147     /**
0148      *  @brief  Create initial lists
0149      */
0150     virtual StatusCode CreateInitialLists();
0151 
0152     /**
0153      *  @brief  Access a modifiable object, when provided with address to const object
0154      * 
0155      *  @param  pT the address of the const object
0156      * 
0157      *  @return address of the modifiable object
0158      */
0159     virtual T *Modifiable(const T *const pT) const;
0160 
0161     /**
0162      *  @brief  AlgorithmInfo class
0163      */
0164     class AlgorithmInfo
0165     {
0166     public:
0167         std::string                 m_parentListName;                   ///< The current list when algorithm was initialized
0168         StringSet                   m_temporaryListNames;               ///< The temporary list names
0169         unsigned int                m_numberOfListsCreated;             ///< The number of lists created by the algorithm
0170     };
0171 
0172     const std::string               m_nullListName;                     ///< The name of the default empty (NULL) list
0173     const Pandora *const            m_pPandora;                         ///< The associated pandora object
0174 
0175     typedef std::map<std::string, ObjectList *> NameToListMap;
0176     typedef std::unordered_map<const Algorithm *, AlgorithmInfo> AlgorithmInfoMap;
0177 
0178     NameToListMap                   m_nameToListMap;                    ///< The name to list map
0179     AlgorithmInfoMap                m_algorithmInfoMap;                 ///< The algorithm info map
0180 
0181     std::string                     m_currentListName;                  ///< The name of the current list
0182     StringSet                       m_savedLists;                       ///< The set of saved lists
0183 };
0184 
0185 } // namespace pandora
0186 
0187 #endif // #ifndef PANDORA_MANAGER_H