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

StoreTranslator.h

Go to the documentation of this file.
00001  /**********************************************************************
00002   *                                                                    *
00003   * Copyright (c) 2002 Lorenzo Moneta, CERN/IT                       *
00004   *                   <Lorenzo.Moneta.cern.ch>                       *
00005   *                                                                    *
00006   * This library is free software; you can redistribute it and/or      *
00007   * modify it under the terms of the GNU Lesser General Public         *
00008   * License as published by the Free Software Foundation; either       *
00009   * version 2.1 of the License, or (at your option) any later version. *
00010   *                                                                    *
00011   * This library is distributed in the hope that it will be useful,    *
00012   * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
00013   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00014   * Lesser General Public License for more details.                    *
00015   *                                                                    *
00016   * You should have received a copy of the GNU Lesser General Public   *
00017   * License along with this library (see file COPYING); if not, write  *
00018   * to the Free Software Foundation, Inc., 59 Temple Place, Suite      *
00019   * 330, Boston, MA 02111-1307 USA, or contact the author.             *
00020   *                                                                    *
00021   **********************************************************************/
00022 
00023 // Header file for class StoreTranslator
00024 // 
00025 // Created by: moneta  at Tue Sep 17 10:39:41 2002
00026 // 
00027 // Last update: Tue Sep 17 10:39:41 2002
00028 // 
00029 #ifndef STORETRANSLATOR
00030 #define STORETRANSLATOR 1
00031 
00032 /*    
00033  *    class containing helper methods to write and read an 
00034  *    XML store 
00035  */
00036 
00037 #include "Translator.h"
00038 #include <string>
00039 #include <iostream>
00040 #include <map>
00041 
00042 #include "DataXML/DataObject.h"
00043 #include "DataXML/XMLStream.h"
00044 
00045 
00046 namespace AIDA { 
00047    class IHistogram1D; 
00048    class IHistogram2D; 
00049    class IHistogram3D; 
00050    class IProfile1D; 
00051    class IProfile2D; 
00052    class ICloud1D; 
00053    class ICloud2D; 
00054    class ICloud3D; 
00055    class IDataPointSet; 
00056    class IFunction;
00057    class ITuple;
00058  }
00059 
00060 
00061 namespace Anaphe { 
00062    namespace AIDA_XMLStore { 
00063 
00064 
00065 class StoreTranslator : public Translator {
00066 
00067 public: 
00068 
00069   //typedef std::multimap<std::string, const DataXML::DataObject *> ObjectMap;
00070 
00071   //StoreTranslator(const std::string & storeName); 
00072   StoreTranslator(std::istream & stream); 
00073   StoreTranslator(std::ostream & stream); 
00074   virtual ~StoreTranslator(); 
00075 
00076 private:
00077 // usually copying is non trivial, so we make this unaccessible
00078   StoreTranslator(const StoreTranslator &); 
00079   StoreTranslator & operator = (const StoreTranslator &); 
00080 
00081 public: 
00082 
00084   bool read(DataXML::DataObject & aidaElement); 
00086   bool write();    
00088    bool append(const AIDA::IHistogram1D & h, const std::string & name, const std::string & path);
00089    bool append(const AIDA::IHistogram2D & h, const std::string & name, const std::string & path);
00090    bool append(const AIDA::IHistogram3D & h, const std::string & name, const std::string & path);
00091    bool append(const AIDA::IProfile1D & p, const std::string & name, const std::string & path);
00092    bool append(const AIDA::IProfile2D & p, const std::string & name, const std::string & path);
00093    bool append(const AIDA::ICloud1D & c, const std::string & name, const std::string & path);
00094    bool append(const AIDA::ICloud2D & c, const std::string & name, const std::string & path);
00095    bool append(const AIDA::ICloud3D & c, const std::string & name, const std::string & path);
00096    bool append(const AIDA::IDataPointSet & dps, const std::string & name, const std::string & path);
00097    bool append(const AIDA::IFunction & f, const std::string & name, const std::string & path);
00098    bool append(AIDA::ITuple & t, const std::string & name, const std::string & path);
00099  
00100   // return root element 
00101   DataXML::DataObject & rootElement() { return m_element; } 
00102 
00103 protected: 
00104 
00105 
00106 private: 
00107 
00109   void writeFileHeader(std::ostream & stream) const; 
00110 
00111 
00113 
00115   DataXML::DataObject m_element;
00117   DataXML::InputXMLStream *  m_inputStream; 
00119   DataXML::OutputXMLStream *  m_outputStream; 
00120 
00121 }; 
00122 
00123    }      // end of namespace Anaphe::AIDA_XMLStore
00124 }
00125 
00126 #endif /* STORETRANSLATOR */
00127 
00128 
00129 
00130 
00131 

Generated on Tue Nov 19 12:32:57 2002 for AIDA_XMLStore by doxygen1.2.16