00001 //Dear emacs this is -*-c++-*- 00002 #ifndef XAODCALOCLUSTERCHANGESIGNALSTATE 00003 #define XAODCALOCLUSTERCHANGESIGNALSTATE 00004 00005 #include "xAODCaloEvent/CaloCluster.h" 00006 00014 class CaloClusterChangeSignalState 00015 { 00016 public: 00017 00018 #if __cplusplus >= 201100 00019 //Delete default and copy constructor 00020 CaloClusterChangeSignalState() = delete; 00021 CaloClusterChangeSignalState(const CaloClusterChangeSignalState&)=delete; 00022 CaloClusterChangeSignalState& operator=(const CaloClusterChangeSignalState&) = delete; 00023 #else 00024 CaloClusterChangeSignalState() : m_clus(0) {}; 00025 void init(const xAOD::CaloCluster* pClus, 00026 xAOD::CaloCluster::State s); 00027 #endif 00028 00029 00035 CaloClusterChangeSignalState (const xAOD::CaloCluster* pClus, 00036 xAOD::CaloCluster::State s); 00037 00038 00042 ~CaloClusterChangeSignalState (); 00043 00045 const xAOD::CaloCluster* cluster() {return m_clus;} 00046 00047 00048 private: 00050 const xAOD::CaloCluster* m_clus; 00052 xAOD::CaloCluster::State m_oldstate; 00053 }; 00054 00055 00056 #if __cplusplus >= 201100 00057 #include <forward_list> 00058 00065 class CaloClusterChangeSignalStateList { 00066 00067 public: 00073 void add(const xAOD::CaloCluster* clu, xAOD::CaloCluster::State s) { 00074 m_stateHelpers.emplace_front(clu,s); 00075 } 00076 00083 void reset() { 00084 m_stateHelpers.clear(); 00085 } 00086 00087 private: 00088 //As far as I can see this is the only stl container that doesn't require the payload to be 00089 //copy-constructable. 00090 std::forward_list<CaloClusterChangeSignalState> m_stateHelpers; 00091 00092 }; 00093 #else //C++11 00094 00095 #include <list> 00096 00103 class CaloClusterChangeSignalStateList { 00104 00105 public: 00111 void add(const xAOD::CaloCluster* clu, xAOD::CaloCluster::State s) { 00112 m_stateHelpers.push_back(CaloClusterChangeSignalState()); 00113 m_stateHelpers.back().init(clu,s); 00114 00115 } 00116 00123 void reset() { 00124 m_stateHelpers.clear(); 00125 } 00126 00127 private: 00128 //As far as I can see this is the only stl container that doesn't require the payload to be 00129 //copy-constructable. 00130 std::list<CaloClusterChangeSignalState> m_stateHelpers; 00131 00132 }; 00133 00134 00135 #endif //C++03 00136 00137 00138 #endif