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

Histo3DTranslator.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 Histo3DTranslator
00024 // 
00025 // Created by: moneta  at Thu Sep 12 10:41:06 2002
00026 // 
00027 // Last update: Thu Sep 12 10:41:06 2002
00028 // 
00029 
00030 /*    
00031  *    class containing methods to transfrom a 3D Histogram to and from XML 
00032  *    using DataXML library.
00033  *    When translating to XML the class it is constructed using 
00034  *    AIDA Histogram3D plus name and path and creates a DataXML::DataObject. 
00035  *    The DataObject is filled with all histogram information when the 
00036  *    toXML() methos is called, and the data object is returned using the
00037  *    dataObject() method. 
00038  *    Transforming from XML, the class is constructed using a 
00039  *    DataXML::DataObject in the constructor and  method createFromXML
00040  *    takes an AIDA::Dev::IDevHistogramFactory to create the corresponding 
00041  *    AIDA Histogram
00042  *    The helper methods used to transfrom to/from XML are in the base class 
00043  *    Translator since are used also by the other AIDA objects. 
00044  * 
00045  */
00046 
00047 #ifndef HISTO3DTRANSLATOR
00048 #define HISTO3DTRANSLATOR 1
00049 
00050 #include "Translator.h"
00051 #include <string>
00052 
00053 #include "DataXML/DataObject.h"
00054 
00055 namespace AIDA { 
00056    class IHistogram3D; 
00057    namespace Dev { 
00058      class IDevHistogram3D;
00059      class IDevHistogramFactory;
00060    }
00061  }
00062 
00063 namespace Anaphe { 
00064    namespace AIDA_XMLStore { 
00065 
00066 
00067 class Histo3DTranslator : public Translator {
00068 
00069 public: 
00070   // constructor for writing to XML
00071   Histo3DTranslator(const AIDA::IHistogram3D * histo, const std::string & name, const std::string & path ); 
00072   // constructor for reading from XML
00073   Histo3DTranslator(const DataXML::DataObject * element); 
00074 
00075   virtual ~Histo3DTranslator(); 
00076 
00077 private:
00078 // usually copying is non trivial, so we make this unaccessible
00079   Histo3DTranslator(const Histo3DTranslator &); 
00080   Histo3DTranslator & operator = (const Histo3DTranslator &); 
00081 
00082 public: 
00083 
00085   bool toXML();
00087   AIDA::Dev::IDevHistogram3D * createFromXML(AIDA::Dev::IDevHistogramFactory& factory); 
00088 
00090   DataXML::DataObject & dataObject() { return m_element; } 
00091   const AIDA::IHistogram3D * histo() { return m_histo; } 
00092   const std::string & name() { return m_name; } 
00093   const std::string & path() { return m_path; } 
00094 
00095 protected: 
00096 
00097 private: 
00098 
00099   // private methods
00100   bool setAxes(); 
00101   bool setStatistics();
00102   bool setData(); 
00103 
00105 
00107   DataXML::DataObject m_element;
00109   const AIDA::IHistogram3D * m_histo;  
00111   std::string m_name; 
00113   std::string m_path;  
00114 }; 
00115 
00116 
00117 
00118    }      // end of namespace Anaphe::AIDA_XMLStore
00119 }
00120 
00121 #endif /* HISTO3DTRANSLATOR */

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