Warning: this documentation for the development version is under construction.

/home/vivien/public_html/.src_seldon/share/Common.hxx

00001 // Copyright (C) 2001-2012 Vivien Mallet
00002 //
00003 // This file is part of the linear-algebra library Seldon,
00004 // http://seldon.sourceforge.net/.
00005 //
00006 // Seldon is free software; you can redistribute it and/or modify it under the
00007 // terms of the GNU Lesser General Public License as published by the Free
00008 // Software Foundation; either version 2.1 of the License, or (at your option)
00009 // any later version.
00010 //
00011 // Seldon is distributed in the hope that it will be useful, but WITHOUT ANY
00012 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
00014 // more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public License
00017 // along with Seldon. If not, see http://www.gnu.org/licenses/.
00018 
00019 
00020 #ifndef SELDON_FILE_COMMON_HXX
00021 
00022 #include <complex>
00023 #include <iostream>
00024 #include <typeinfo>
00025 
00026 #ifdef SELDON_WITH_HDF5
00027 #include <hdf5.h>
00028 #endif
00029 
00030 template <class T>
00031 void PrintArray(T* v, int lgth);
00032 
00033 namespace Seldon
00034 {
00035 
00036 
00037   using namespace std;
00038 
00039 
00041 
00045   class Str
00046   {
00047   private:
00049     std::ostringstream output_;
00050 
00051   public:
00052     Str();
00053     Str(const Str& s);
00054     operator std::string() const;
00055     template <class T>
00056     Str& operator << (const T& input);
00057   };
00058 
00059   template <class T>
00060   Str operator + (const Str&, const T& input);
00061 
00062 #ifndef SWIG
00063   ostream& operator << (ostream& out, Str& in);
00064   ostream& operator << (ostream& out, Str in);
00065 #endif
00066 
00067 
00068   template<typename T>
00069   std::string to_str(const T& input);
00070 
00071   template <class T>
00072   void to_num(std::string s, T& num);
00073 
00074   template <class T>
00075   T to_num(std::string s);
00076 
00077   template <class T>
00078   void SetComplexZero(T& number);
00079 
00080   template <class T>
00081   void SetComplexZero(complex<T>& number);
00082 
00083   template <class T>
00084   void SetComplexOne(T& number);
00085 
00086   template <class T>
00087   void SetComplexOne(complex<T>& number);
00088 
00089 #ifdef SELDON_WITH_HDF5
00090   template <class T>
00091   hid_t GetH5Type(T& input);
00092 #endif
00093 
00094 
00095 }  // namespace Seldon.
00096 
00097 #define SELDON_FILE_COMMON_HXX
00098 #endif