Main Page | User's Guide | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

Common.hxx

00001 // Copyright (C) 2001-2004 Vivien Mallet
00002 //
00003 // This file is part of Seldon library.
00004 // Seldon library provides matrices and vectors structures for
00005 // linear algebra.
00006 // 
00007 // Seldon is free software; you can redistribute it and/or modify
00008 // it under the terms of the GNU General Public License as published by
00009 // the Free Software Foundation; either version 2 of the License, or
00010 // (at your option) any later version.
00011 // 
00012 // Seldon 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
00015 // GNU General Public License (file "license") for more details.
00016 //
00017 // For more information, please see the Seldon home page:
00018 //     http://spacetown.free.fr/lib/seldon/
00019 
00020 #ifndef SELDON_FILE_COMMON_HXX
00021 
00022 class Spacetown
00023 {
00024 };
00025 
00026 template <class T>
00027 void PrintArray(T* v, int lgth)
00028 {
00029   for (int k = 0; k < lgth - 1; k++)
00030     std::cout << v[k] << " | ";
00031   std::cout << v[lgth - 1] << std::endl;
00032 }
00033 
00034 namespace Seldon
00035 {
00036 
00037 
00039 
00043   template<typename T>
00044   std::string to_str(const T& input)
00045   {
00046     std::ostringstream output;
00047     output << input;
00048     return output.str();
00049   }
00050 
00052 
00056   template <class T>
00057   void to_num(std::string s, T& num)
00058   {
00059     std::istringstream str(s);
00060     str >> num;
00061   }
00062 
00064 
00068   template <class T>
00069   T to_num(std::string s)
00070   {
00071     T num;
00072     std::istringstream str(s);
00073     str >> num;
00074     return num;
00075   }
00076 
00077 
00078 }  // namespace Seldon.
00079 
00080 #define SELDON_FILE_COMMON_HXX
00081 #endif

Generated on Sun Jan 16 23:37:57 2005 for Multivac by  doxygen 1.4.0