Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

dataManager.h

Go to the documentation of this file.
00001 #ifndef DATAMANAGER_H
00002 #define DATAMANAGER_H
00003 
00004 //----------------------------------------------
00005 //             J.A Hernando, Santa Cruz 02/29/00
00006 //----------------------------------------------
00007 
00008 #include <vector>
00009 #include <string>
00010 #include <iostream>
00011 
00012 #include "Event/dataEventServer.h"
00013 #include "Event/dataDetectorServer.h"
00014 #include "Event/dataIOROOTServer.h"
00015 
00016 typedef dataIOROOTServer dataIOServer;
00017 
00018 //----------------------------------------
00020 /*! 
00021 <ul>
00022         <li> dataManager has/returns pointers to the following data servers:
00023         <ul>
00024                 <li> dataDetectorServer, with geometrycal and calibration transient data.
00025                 (\c det() method returns a pointer to dataDetectorServer).
00026                 <li> dataEventServer, with event transient data. \c evt() method
00027                 retruns a pointer to dataEventServer.
00028                 <li> dataIOServer, with the persistent data. \c IO() method returns
00029                 a pointer to the persistent data.
00030         </ul>
00031         <li> Any transient data can be recovered using the \c getData() method.
00032         <li> the \c update() method, update any transient data.
00033         <li> The persistent server could be replaced. The user should the typedef dataIOServer 
00034         to her/his defined <b>persistent data server </b> (i.e for ROOT, we use dataIOROOTServer).
00035 </ul>
00036 */
00037 //----------------------------------------
00038 // JA Hernando, Santa Cruz, CA, 02/15/00
00039 //----------------------------------------
00040 
00041 
00042 //#############################
00043 class dataManager : public serviceI
00044 //#############################
00045 {
00046 public:
00047 
00049         dataManager();
00051         virtual ~dataManager();
00052 
00054         static dataManager* instance() {return m_instance;}
00055 
00057 
00059         template<class T> T* getData(std::string name, const T* dummy = 0) const { 
00060                 T* t = static_cast<T*>(getTrsData(name));
00061                 return t;
00062         }
00063 
00065         inline dataEventServer*  evt()  const {return m_evt;}
00067         inline dataDetectorServer*    det()  const {return m_det;}
00069         inline dataIOServer*   IO()   const {return m_IO;}
00070 
00072         inline detectorGeo* geo()        const {return det()->geo();}
00073 
00075         virtual void writeOut() const;
00076 
00077 protected:
00078 
00080         virtual trsDataVI* getTrsData(std::string name) const;
00081 
00082 private:
00083 
00085         static dataManager* m_instance;
00086 
00088         dataEventServer* m_evt;
00090         dataDetectorServer* m_det;
00092         dataIOServer* m_IO;
00093 };
00094 
00095 #endif

Generated at Fri Aug 18 12:57:38 2000 for centella framework by doxygen 1.1.3 written by Dimitri van Heesch, © 1997-2000