CMS 3D CMS Logo

ActivityRegistry.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     ServiceRegistry
00004 // Class  :     ActivityRegistry
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Chris Jones
00010 //         Created:  Tue Sep  6 10:26:49 EDT 2005
00011 // $Id: ActivityRegistry.cc,v 1.15 2008/10/20 19:38:22 wmtan Exp $
00012 //
00013 
00014 // system include files
00015 #include <algorithm>
00016 
00017 // user include files
00018 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
00019 #include "FWCore/Utilities/interface/Algorithms.h"
00020 
00021 //
00022 // constants, enums and typedefs
00023 //
00024 
00025 //
00026 // static data member definitions
00027 //
00028 
00029 //
00030 // constructors and destructor
00031 //
00032 //edm::ActivityRegistry::ActivityRegistry()
00033 //{
00034 //}
00035    
00036 // ActivityRegistry::ActivityRegistry(ActivityRegistry const& rhs)
00037 // {
00038 //    // do actual copying here;
00039 // }
00040 
00041 //edm::ActivityRegistry::~ActivityRegistry()
00042 //{
00043 //}
00044    
00045 //
00046 // assignment operators
00047 //
00048 // ActivityRegistry const& ActivityRegistry::operator=(ActivityRegistry const& rhs)
00049 // {
00050 //   //An exception safe implementation is
00051 //   ActivityRegistry temp(rhs);
00052 //   swap(rhs);
00053 //
00054 //   return *this;
00055 // }
00056 
00057 //
00058 // member functions
00059 //
00060 void 
00061 edm::ActivityRegistry::connect(ActivityRegistry& iOther)
00062 {
00063    postBeginJobSignal_.connect(iOther.postBeginJobSignal_);
00064    postEndJobSignal_.connect(iOther.postEndJobSignal_);
00065 
00066    jobFailureSignal_.connect(iOther.jobFailureSignal_);
00067 
00068    preSourceSignal_.connect(iOther.preSourceSignal_);
00069    postSourceSignal_.connect(iOther.postSourceSignal_);
00070 
00071    preSourceLumiSignal_.connect(iOther.preSourceLumiSignal_);
00072    postSourceLumiSignal_.connect(iOther.postSourceLumiSignal_);
00073 
00074    preSourceRunSignal_.connect(iOther.preSourceRunSignal_);
00075    postSourceRunSignal_.connect(iOther.postSourceRunSignal_);
00076 
00077    preOpenFileSignal_.connect(iOther.preOpenFileSignal_);
00078    postOpenFileSignal_.connect(iOther.postOpenFileSignal_);
00079    
00080    preCloseFileSignal_.connect(iOther.preCloseFileSignal_);
00081    postCloseFileSignal_.connect(iOther.postCloseFileSignal_);
00082    
00083    preProcessEventSignal_.connect(iOther.preProcessEventSignal_);
00084    postProcessEventSignal_.connect(iOther.postProcessEventSignal_);
00085 
00086    preBeginRunSignal_.connect(iOther.preBeginRunSignal_);
00087    postBeginRunSignal_.connect(iOther.postBeginRunSignal_);
00088 
00089    preEndRunSignal_.connect(iOther.preEndRunSignal_);
00090    postEndRunSignal_.connect(iOther.postEndRunSignal_);
00091 
00092    preBeginLumiSignal_.connect(iOther.preBeginLumiSignal_);
00093    postBeginLumiSignal_.connect(iOther.postBeginLumiSignal_);
00094 
00095    preEndLumiSignal_.connect(iOther.preEndLumiSignal_);
00096    postEndLumiSignal_.connect(iOther.postEndLumiSignal_);
00097 
00098    preProcessPathSignal_.connect(iOther.preProcessPathSignal_);
00099    postProcessPathSignal_.connect(iOther.postProcessPathSignal_);
00100 
00101    prePathBeginRunSignal_.connect(iOther.prePathBeginRunSignal_);
00102    postPathBeginRunSignal_.connect(iOther.postPathBeginRunSignal_);
00103 
00104    prePathEndRunSignal_.connect(iOther.prePathEndRunSignal_);
00105    postPathEndRunSignal_.connect(iOther.postPathEndRunSignal_);
00106 
00107    prePathBeginLumiSignal_.connect(iOther.prePathBeginLumiSignal_);
00108    postPathBeginLumiSignal_.connect(iOther.postPathBeginLumiSignal_);
00109 
00110    prePathEndLumiSignal_.connect(iOther.prePathEndLumiSignal_);
00111    postPathEndLumiSignal_.connect(iOther.postPathEndLumiSignal_);
00112 
00113    preModuleSignal_.connect(iOther.preModuleSignal_);
00114    postModuleSignal_.connect(iOther.postModuleSignal_);
00115 
00116    preModuleBeginRunSignal_.connect(iOther.preModuleBeginRunSignal_);
00117    postModuleBeginRunSignal_.connect(iOther.postModuleBeginRunSignal_);
00118 
00119    preModuleEndRunSignal_.connect(iOther.preModuleEndRunSignal_);
00120    postModuleEndRunSignal_.connect(iOther.postModuleEndRunSignal_);
00121 
00122    preModuleBeginLumiSignal_.connect(iOther.preModuleBeginLumiSignal_);
00123    postModuleBeginLumiSignal_.connect(iOther.postModuleBeginLumiSignal_);
00124 
00125    preModuleEndLumiSignal_.connect(iOther.preModuleEndLumiSignal_);
00126    postModuleEndLumiSignal_.connect(iOther.postModuleEndLumiSignal_);
00127 
00128    preModuleConstructionSignal_.connect(iOther.preModuleConstructionSignal_);
00129    postModuleConstructionSignal_.connect(iOther.postModuleConstructionSignal_);
00130 
00131    preModuleBeginJobSignal_.connect(iOther.preModuleBeginJobSignal_);
00132    postModuleBeginJobSignal_.connect(iOther.postModuleBeginJobSignal_);
00133    
00134    preModuleEndJobSignal_.connect(iOther.preModuleEndJobSignal_);
00135    postModuleEndJobSignal_.connect(iOther.postModuleEndJobSignal_);
00136    
00137    preSourceConstructionSignal_.connect(iOther.preSourceConstructionSignal_);
00138    postSourceConstructionSignal_.connect(iOther.postSourceConstructionSignal_);
00139 
00140 }
00141 
00142 template<class T>
00143 static
00144 inline
00145 void
00146 copySlotsToFrom(T& iTo, T& iFrom)
00147 {
00148   typename T::slot_list_type slots = iFrom.slots();
00149   
00150   edm::for_all(slots, boost::bind( &T::connect, iTo, _1) );
00151 }
00152 
00153 template<class T>
00154 static
00155 inline
00156 void
00157 copySlotsToFromReverse(T& iTo, T& iFrom)
00158 {
00159   // This handles service slots that are supposed to be in reverse
00160   // order of construction. Copying new ones in is a little
00161   // tricky.  Here is an example of what follows
00162   // slots in iTo before  4 3 2 1  and copy in slots in iFrom 8 7 6 5
00163   // reverse both  1 2 3 4  plus 5 6 7 8
00164   // then do the copy 1 2 3 4 5 6 7 8
00165   // then reverse back again to get the desired order
00166   // 8 7 6 5 4 3 2 1
00167 
00168   typename T::slot_list_type slotsFrom = iFrom.slots();
00169   typename T::slot_list_type slotsTo   = iTo.slots();
00170   
00171   std::reverse(slotsTo.begin(), slotsTo.end());
00172   std::reverse(slotsFrom.begin(), slotsFrom.end());
00173 
00174   edm::for_all(slotsFrom, boost::bind( &T::connect, iTo, _1) );
00175 
00176   std::reverse(slotsTo.begin(), slotsTo.end());
00177 
00178   // Be nice and put these back in the state they were
00179   // at the beginning
00180   std::reverse(slotsFrom.begin(), slotsFrom.end());
00181 }
00182 
00183 void 
00184 edm::ActivityRegistry::copySlotsFrom(ActivityRegistry& iOther)
00185 {
00186   copySlotsToFrom(postBeginJobSignal_,iOther.postBeginJobSignal_);
00187   copySlotsToFromReverse(postEndJobSignal_,iOther.postEndJobSignal_);
00188   
00189   copySlotsToFromReverse(jobFailureSignal_,iOther.jobFailureSignal_);
00190   
00191   copySlotsToFrom(preSourceSignal_,iOther.preSourceSignal_);
00192   copySlotsToFromReverse(postSourceSignal_,iOther.postSourceSignal_);
00193 
00194   copySlotsToFrom(preSourceLumiSignal_,iOther.preSourceLumiSignal_);
00195   copySlotsToFromReverse(postSourceLumiSignal_,iOther.postSourceLumiSignal_);
00196 
00197   copySlotsToFrom(preSourceRunSignal_,iOther.preSourceRunSignal_);
00198   copySlotsToFromReverse(postSourceRunSignal_,iOther.postSourceRunSignal_);
00199 
00200   copySlotsToFrom(preOpenFileSignal_,iOther.preOpenFileSignal_);
00201   copySlotsToFromReverse(postOpenFileSignal_,iOther.postOpenFileSignal_);
00202   
00203   copySlotsToFrom(preCloseFileSignal_,iOther.preCloseFileSignal_);
00204   copySlotsToFromReverse(postCloseFileSignal_,iOther.postCloseFileSignal_);
00205   
00206   copySlotsToFrom(preProcessEventSignal_,iOther.preProcessEventSignal_);
00207   copySlotsToFromReverse(postProcessEventSignal_,iOther.postProcessEventSignal_);
00208   
00209   copySlotsToFrom(preBeginRunSignal_,iOther.preBeginRunSignal_);
00210   copySlotsToFromReverse(postBeginRunSignal_,iOther.postBeginRunSignal_);
00211 
00212   copySlotsToFrom(preEndRunSignal_,iOther.preEndRunSignal_);
00213   copySlotsToFromReverse(postEndRunSignal_,iOther.postEndRunSignal_);
00214 
00215   copySlotsToFrom(preBeginLumiSignal_,iOther.preBeginLumiSignal_);
00216   copySlotsToFromReverse(postBeginLumiSignal_,iOther.postBeginLumiSignal_);
00217 
00218   copySlotsToFrom(preEndLumiSignal_,iOther.preEndLumiSignal_);
00219   copySlotsToFromReverse(postEndLumiSignal_,iOther.postEndLumiSignal_);
00220 
00221   copySlotsToFrom(preProcessPathSignal_,iOther.preProcessPathSignal_);
00222   copySlotsToFromReverse(postProcessPathSignal_,iOther.postProcessPathSignal_);
00223 
00224   copySlotsToFrom(prePathBeginRunSignal_,iOther.prePathBeginRunSignal_);
00225   copySlotsToFromReverse(postPathBeginRunSignal_,iOther.postPathBeginRunSignal_);
00226 
00227   copySlotsToFrom(prePathEndRunSignal_,iOther.prePathEndRunSignal_);
00228   copySlotsToFromReverse(postPathEndRunSignal_,iOther.postPathEndRunSignal_);
00229 
00230   copySlotsToFrom(prePathBeginLumiSignal_,iOther.prePathBeginLumiSignal_);
00231   copySlotsToFromReverse(postPathBeginLumiSignal_,iOther.postPathBeginLumiSignal_);
00232 
00233   copySlotsToFrom(prePathEndLumiSignal_,iOther.prePathEndLumiSignal_);
00234   copySlotsToFromReverse(postPathEndLumiSignal_,iOther.postPathEndLumiSignal_);
00235 
00236   copySlotsToFrom(preModuleSignal_,iOther.preModuleSignal_);
00237   copySlotsToFromReverse(postModuleSignal_,iOther.postModuleSignal_);
00238   
00239   copySlotsToFrom(preModuleBeginRunSignal_,iOther.preModuleBeginRunSignal_);
00240   copySlotsToFromReverse(postModuleBeginRunSignal_,iOther.postModuleBeginRunSignal_);
00241   
00242   copySlotsToFrom(preModuleEndRunSignal_,iOther.preModuleEndRunSignal_);
00243   copySlotsToFromReverse(postModuleEndRunSignal_,iOther.postModuleEndRunSignal_);
00244   
00245   copySlotsToFrom(preModuleBeginLumiSignal_,iOther.preModuleBeginLumiSignal_);
00246   copySlotsToFromReverse(postModuleBeginLumiSignal_,iOther.postModuleBeginLumiSignal_);
00247   
00248   copySlotsToFrom(preModuleEndLumiSignal_,iOther.preModuleEndLumiSignal_);
00249   copySlotsToFromReverse(postModuleEndLumiSignal_,iOther.postModuleEndLumiSignal_);
00250   
00251   copySlotsToFrom(preModuleConstructionSignal_,iOther.preModuleConstructionSignal_);
00252   copySlotsToFromReverse(postModuleConstructionSignal_,iOther.postModuleConstructionSignal_);
00253   
00254   copySlotsToFrom(preModuleBeginJobSignal_,iOther.preModuleBeginJobSignal_);
00255   copySlotsToFromReverse(postModuleBeginJobSignal_,iOther.postModuleBeginJobSignal_);
00256   
00257   copySlotsToFrom(preModuleEndJobSignal_,iOther.preModuleEndJobSignal_);
00258   copySlotsToFromReverse(postModuleEndJobSignal_,iOther.postModuleEndJobSignal_);
00259   
00260   copySlotsToFrom(preSourceConstructionSignal_,iOther.preSourceConstructionSignal_);
00261   copySlotsToFromReverse(postSourceConstructionSignal_,iOther.postSourceConstructionSignal_);
00262   
00263 }
00264 
00265 //
00266 // const member functions
00267 //
00268 
00269 //
00270 // static member functions
00271 //

Generated on Tue Jun 9 17:36:35 2009 for CMSSW by  doxygen 1.5.4