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

FunctionTranslator.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 FunctionTranslator
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 1D Cloud to and from XML 
00032  *    using DataXML library.
00033  *    When translating to XML the class it is constructed using 
00034  *    AIDA Function 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::IDevCloudFactory to create the corresponding 
00041  *    AIDA Cloud
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 FUNCTIONTRANSLATOR
00048 #define FUNCTIONTRANSLATOR 1
00049 
00050 #include "Translator.h"
00051 #include <string>
00052 
00053 #include "DataXML/DataObject.h"
00054 
00055 namespace AIDA { 
00056    class IFunction; 
00057    namespace Dev { 
00058      class IDevFunction;
00059      class IDevFunctionFactory;
00060    }
00061  }
00062 
00063 namespace Anaphe { 
00064    namespace AIDA_XMLStore { 
00065 
00066 
00067 class FunctionTranslator : public Translator {
00068 
00069 public: 
00070   // constructor for writing
00071   FunctionTranslator(const AIDA::IFunction * cloud, const std::string & name, const std::string & path ); 
00072   // constructor for reading 
00073   FunctionTranslator(const DataXML::DataObject * element); 
00074 
00075   virtual ~FunctionTranslator(); 
00076 
00077 private:
00078 // usually copying is non trivial, so we make this unaccessible
00079   FunctionTranslator(const FunctionTranslator &); 
00080   FunctionTranslator & operator = (const FunctionTranslator &); 
00081 
00082 public: 
00083 
00084 
00085   DataXML::DataObject & dataObject() { return m_element; } 
00086   const AIDA::IFunction * function() { return m_function; } 
00087   const std::string & name() { return m_name; } 
00088   const std::string & path() { return m_path; } 
00089 
00091   bool toXML();
00093   AIDA::Dev::IDevFunction * createFromXML(AIDA::Dev::IDevFunctionFactory& factory); 
00094 
00095 protected: 
00096 
00097 
00098 
00099 
00100 
00101 
00102 private: 
00103 
00104   // private methods
00105   bool setData(); 
00106 
00108 
00110   DataXML::DataObject m_element;
00112   const AIDA::IFunction * m_function;  
00114   std::string m_name; 
00116   std::string m_path;  
00117 }; 
00118 
00119 
00120 
00121    }      // end of namespace Anaphe::AIDA_XMLStore
00122 }
00123 
00124 #endif /* CLOUD1DTRANSLATOR */

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