X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkCommon.h;h=31f28dc40637bd95e91dfec7974f23183edd43ac;hb=a061e3ce01b17350ff7cdf16eb2c3951d2492abb;hp=879d54f613b7e2cceefddbcbd2ad371d7b4868bd;hpb=c7f6f682ddc01d2a41740bbdb806f9ef967b57d5;p=clitk.git diff --git a/common/clitkCommon.h b/common/clitkCommon.h index 879d54f..31f28dc 100644 --- a/common/clitkCommon.h +++ b/common/clitkCommon.h @@ -3,7 +3,7 @@ Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -14,14 +14,14 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ +===========================================================================**/ #ifndef CLITKCOMMON_H #define CLITKCOMMON_H // clitk include -#include "clitkConfiguration.h" #include "clitkPortability.h" +#include "clitkDD.h" #include "clitkExceptionObject.h" // itk include (include std) @@ -30,8 +30,18 @@ #include #include +// std include #include +// Include for "rusage" +#include +#if defined(unix) || defined(__APPLE__) +# include +# include +#elif defined(WIN32) +# include +#endif + //-------------------------------------------------------------------- namespace clitk { @@ -39,15 +49,6 @@ namespace clitk { typedef unsigned short ushort; typedef unsigned int uint; - //-------------------------------------------------------------------- - // display -#define DD(a) std::cout << #a " = [ " << a << " ]" << std::endl;std::cout.flush(); -#define DDV(a,n) { std::cout << #a " = [ "; for(unsigned int _i_=0; _i_ -void _print_container(T const& a) - { for(typename T::const_iterator i=a.begin();i!=a.end();++i) { std::cout << *i << " "; };} -#define DDS(a) { std::cout << #a " = [ "; _print_container(a) ; std::cout << " ]" << std::endl;std::cout.flush():} - //-------------------------------------------------------------------- // when everything goes wrong #define WHEREAMI "[ " << __FILE__ << " ] line " << __LINE__ @@ -80,6 +81,9 @@ void _print_container(T const& a) template std::string toStringVector(const T * t, const int n); template std::string toStringVector(const T & t, const int n); template std::string toStringVector(const std::vector & t); + template bool fromString(T& t, + const std::string& s, + std::ios_base& (*f)(std::ios_base&)=std::dec); //-------------------------------------------------------------------- // Display a progress % @@ -202,6 +206,9 @@ void _print_container(T const& a) template void CloneImage(const typename ImageType::Pointer & input, typename ImageType::Pointer & output); + //-------------------------------------------------------------------- + void PrintMemoryUsed(); + #include "clitkCommon.txx" } // end namespace