|
|
|||
File indexing completed on 2026-09-27 09:20:10
0001 /** 0002 * @file PandoraSDK/include/Pandora/ObjectFactory.h 0003 * 0004 * @brief Header file for the object factory class. 0005 * 0006 * $Log: $ 0007 */ 0008 #ifndef PANDORA_OBJECT_FACTORY_H 0009 #define PANDORA_OBJECT_FACTORY_H 1 0010 0011 #include "Pandora/StatusCodes.h" 0012 0013 namespace pandora 0014 { 0015 0016 class FileReader; 0017 class FileWriter; 0018 0019 //------------------------------------------------------------------------------------------------------------------------------------------ 0020 0021 /** 0022 * @brief ObjectFactory class responsible for extended pandora object creation 0023 */ 0024 template <typename PARAMETERS, typename OBJECT> 0025 class ObjectFactory 0026 { 0027 public: 0028 typedef PARAMETERS Parameters; 0029 typedef OBJECT Object; 0030 0031 /** 0032 * @brief Default constructor 0033 */ 0034 ObjectFactory(); 0035 0036 /** 0037 * @brief Destructor 0038 */ 0039 virtual ~ObjectFactory(); 0040 0041 /** 0042 * @brief Create new parameters instance on the heap (memory-management to be controlled by user) 0043 * 0044 * @return the address of the new parameters instance 0045 */ 0046 virtual Parameters *NewParameters() const = 0; 0047 0048 /** 0049 * @brief Read any additional (derived class only) object parameters from file using the specified file reader 0050 * 0051 * @param parameters the parameters to pass in constructor 0052 * @param fileReader the file reader, used to extract any additional parameters from file 0053 */ 0054 virtual StatusCode Read(Parameters ¶meters, FileReader &fileReader) const = 0; 0055 0056 /** 0057 * @brief Persist any additional (derived class only) object parameters using the specified file writer 0058 * 0059 * @param pObject the address of the object to persist 0060 * @param fileWriter the file writer 0061 */ 0062 virtual StatusCode Write(const Object *const pObject, FileWriter &fileWriter) const = 0; 0063 0064 protected: 0065 /** 0066 * @brief Create an object with the given parameters 0067 * 0068 * @param parameters the parameters to pass in constructor 0069 * @param pObject to receive the address of the object created 0070 */ 0071 virtual StatusCode Create(const Parameters ¶meters, const Object *&pObject) const = 0; 0072 0073 friend class CaloHitManager; 0074 friend class TrackManager; 0075 friend class MCManager; 0076 friend class ClusterManager; 0077 friend class VertexManager; 0078 friend class ParticleFlowObjectManager; 0079 friend class GeometryManager; 0080 }; 0081 0082 //------------------------------------------------------------------------------------------------------------------------------------------ 0083 0084 template <typename PARAMETERS, typename OBJECT> 0085 inline ObjectFactory<PARAMETERS, OBJECT>::ObjectFactory() 0086 { 0087 } 0088 0089 //------------------------------------------------------------------------------------------------------------------------------------------ 0090 0091 template <typename PARAMETERS, typename OBJECT> 0092 inline ObjectFactory<PARAMETERS, OBJECT>::~ObjectFactory() 0093 { 0094 } 0095 0096 } // namespace pandora 0097 0098 #endif // #ifndef PANDORA_OBJECT_FACTORY_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|