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
- BSD See included LICENSE.txt file
- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-======================================================================-====*/
+===========================================================================**/
#ifndef CLITKCOMMON_CXX
#define CLITKCOMMON_CXX
+// clitk include
#include "clitkCommon.h"
+
+// std include
#include <fstream>
#include <iomanip>
#include <sstream>
+#include <cerrno>
//------------------------------------------------------------------
// skip line which begin with a sharp '#'
is >> c;
if (is.eof()) return;
}
- is.unget();
+ if (!(is.fail()) || c != '\n')
+ is.unget();
} ////
//------------------------------------------------------------------
{
is.open(filename.c_str(), std::ios::in);
if ( is.fail() ) {
- clitkExceptionMacro("Could not open file (for reading): " << filename);
+ clitkExceptionMacro("Could not open file for reading: "
+ << filename << ". Error is : <"
+ << strerror(errno) << ">");
}
}
//--------------------------------------------------------------------
{
os.open(filename.c_str(), std::ios::out);
if ( os.fail() ) {
- clitkExceptionMacro("Could not open file (for writing): " << filename);
+ clitkExceptionMacro("Could not open file for writing: "
+ << filename << ". Error is : <"
+ << strerror(errno) << ">");
}
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+void clitk::PrintMemoryUsed()
+{
+#if defined(unix) || defined(__APPLE__)
+ rusage usage;
+ getrusage(RUSAGE_SELF, &usage);
+ DD(usage.ru_maxrss); /* maximum resident set size */
+ // DD(usage.ru_ixrss); /* integral shared memory size */
+ // DD(usage.ru_idrss); /* integral unshared data size */
+ // DD(usage.ru_isrss); /* integral unshared stack size */
+#endif
+}
+//--------------------------------------------------------------------
+
+
#endif /* end #define CLITKCOMMON_CXX */