|
||||
File indexing completed on 2024-04-06 12:30:26
0001 #ifndef SimG4Core_Notification_Observer_H 0002 #define SimG4Core_Notification_Observer_H 0003 // -*- C++ -*- 0004 // 0005 // Package: Notification 0006 // Class : Observer 0007 // 0008 /**\class Observer Observer.h SimG4Core/Notification/interface/Observer.h 0009 0010 Description: Adapts the COBRA signal handling for use in the OscarProducer 0011 0012 Usage: 0013 If a class that is loaded by OscarProducer, via its configuraiton file, inherits from Observer<T>, 0014 (e.g., Observer<const BeginOfTrack*>), the OscarProducer will make sure the appropriate signal 0015 is sent to an object of that class (e.g., the object will see the BeginOfTrack signal). To handle 0016 the signal the class must override the 'void update(T)' method (e.g., void update(const BeginOfTrack*)). 0017 0018 */ 0019 // 0020 // 0021 0022 template <class T> 0023 class Observer { 0024 public: 0025 Observer() {} 0026 virtual ~Observer() {} 0027 0028 /** This method is what is called when the signal is actually sent. The signal is not sent 0029 directly to 'update' because if we did 0030 1) If the user did not declare 'update' to be 'public' then we get a compilation failure 0031 2) we would not have a 'hook' to allow the 'pre' and 'post' functions to be called 0032 */ 0033 void slotForUpdate(T iT) { update(iT); } 0034 0035 protected: 0036 ///This routine will be called when the appropriate signal arrives 0037 virtual void update(T) = 0; 0038 0039 private: 0040 }; 0041 0042 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |