XCalculator.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *
00003  * Copyright (C) 2009 Cassio Neri Moreira
00004  *
00005  * This file is part of the KeyValue library.
00006  *
00007  * The KeyValue library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License as published
00009  * by the Free Software Foundation, either version 3 of the License, or (at
00010  * your option) any later version.
00011  *
00012  * The KeyValue library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
00015  * Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License along
00018  * with KeyValue. If not, see <http://www.gnu.org/licenses/>.
00019  *
00020  **************************************************************************/
00021 
00029 #ifndef KEYVALUE_MNGT_XCALCULATOR_H_
00030 #define KEYVALUE_MNGT_XCALCULATOR_H_
00031 
00032 #include "keyvalue/mngt/Calculator.h"
00033 #include "keyvalue/value/Variant.h"
00034 
00035 namespace keyvalue {
00036 
00048 template <typename Tag>
00049 class XCalculator : public Calculator<Tag> {
00050 
00051 public:
00052 
00063   static Calculator&
00064   getInstance();
00065 
00075   value::Value
00076   getValue(const value::Variant& data) const;
00077 
00078 private:
00079 
00080   XCalculator();
00081 
00088   static Calculator&
00089   getSingleton();
00090 
00091 }; // class XCalculator
00092 
00093 /*--------------------------------------------------------------------------
00094  * getInstance()
00095  *------------------------------------------------------------------------*/
00096 
00097 template <typename Tag>
00098 Calculator<Tag>&
00099 XCalculator<Tag>::getInstance() {
00100   setGetter(getSingleton);
00101   return Calculator<Tag>::getInstance();
00102 }
00103 
00104 /*--------------------------------------------------------------------------
00105  * XCalculator()
00106  *------------------------------------------------------------------------*/
00107 
00108 template <typename Tag>
00109 XCalculator<Tag>::XCalculator() {
00110 }
00111 
00112 /*--------------------------------------------------------------------------
00113  * getSingleton()
00114  *------------------------------------------------------------------------*/
00115 
00116 template <typename Tag>
00117 Calculator<Tag>&
00118 XCalculator<Tag>::getSingleton() {
00119   static XCalculator<Tag> singleton;
00120   return singleton;
00121 }
00122 
00123 } // namespace keyvalue
00124 
00125 #endif // KEYVALUE_MNGT_XCALCULATOR_H_

Generated on Sat Mar 20 15:08:29 2010 for KeyValue by  doxygen 1.6.1